@mintlify/common
Version:
Commonly shared code within Mintlify
16 lines (15 loc) • 634 B
JavaScript
// Functions used for both OpenAPI and AsyncAPI schemas
export const schemaFileFrontmatterIsOriginalFileLocation = (filenameFromFrontmatter) => {
return (filenameFromFrontmatter.toLowerCase().endsWith('.json') ||
filenameFromFrontmatter.toLowerCase().endsWith('.yaml') ||
filenameFromFrontmatter.toLowerCase().endsWith('.yml'));
};
export const isRemoteSchemaUrl = (url) => {
return url.startsWith('https:') || url.startsWith('http:');
};
export const isAllowedLocalSchemaUrl = (url, localSchema) => {
if (localSchema) {
return isRemoteSchemaUrl(url);
}
return url.startsWith('https:');
};