-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ability to resolve remote or relative schema $refs (#8293)
* bundle schemas when initializing project * update input type options * remove extraneous config * filter out equalExpression before making options
- Loading branch information
1 parent
06897d0
commit 86f05c3
Showing
6 changed files
with
75 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
Composer/packages/server/src/models/utilities/bundleSchema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import $RefParser from '@apidevtools/json-schema-ref-parser'; | ||
|
||
import logger from '../../logger'; | ||
|
||
const log = logger.extend('schema'); | ||
|
||
export async function bundleSchema(schemaPath: string) { | ||
try { | ||
const parser = new $RefParser(); | ||
const bundled = await parser.bundle(schemaPath); | ||
return JSON.stringify(bundled); | ||
} catch (err) { | ||
log('Error while bundling schema at %s', schemaPath); | ||
log('%O', err); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters