-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ns-workflows-1): add support for JSONSchema Object (#3445)
Refs #3392
- Loading branch information
Showing
19 changed files
with
855 additions
and
119 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
230 changes: 115 additions & 115 deletions
230
packages/apidom-ns-openapi-3-1/src/refractor/specification.ts
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,47 @@ | ||
import type { Attributes, Meta } from '@swagger-api/apidom-core'; | ||
import { SchemaElement } from '@swagger-api/apidom-ns-openapi-3-1'; | ||
|
||
class JSONSchema extends SchemaElement { | ||
constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.element = 'jSONSchemaDraft202012'; | ||
} | ||
|
||
/** | ||
* We're redefining the getters/setters here so that the following keywords | ||
* are not part of the OAS base vocabulary, but rather an arbitrary custom dialect. | ||
*/ | ||
get discriminator(): any { | ||
return this.get('discriminator'); | ||
} | ||
|
||
set discriminator(discriminator: any) { | ||
this.set('discriminator', discriminator); | ||
} | ||
|
||
get xml(): any { | ||
return this.get('xml'); | ||
} | ||
|
||
set xml(xml: any) { | ||
this.set('xml', xml); | ||
} | ||
|
||
get externalDocs(): any { | ||
return this.get('externalDocs'); | ||
} | ||
|
||
set externalDocs(externalDocs: any) { | ||
this.set('externalDocs', externalDocs); | ||
} | ||
|
||
get example(): any { | ||
return this.get('example'); | ||
} | ||
|
||
set example(example: any) { | ||
this.set('example', example); | ||
} | ||
} | ||
|
||
export default JSONSchema; |
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
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
20 changes: 20 additions & 0 deletions
20
packages/apidom-ns-workflows-1/src/refractor/visitors/workflows-1/json-schema/index.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,20 @@ | ||
import { always } from 'ramda'; | ||
import stampit from 'stampit'; | ||
import { specificationObj as OpenApi3_1Specification } from '@swagger-api/apidom-ns-openapi-3-1'; | ||
|
||
import JSONSchemaElement from '../../../../elements/JSONSchema'; | ||
|
||
const { $visitor: SchemaVisitor } = OpenApi3_1Specification.visitors.document.objects.Schema; | ||
|
||
const JSONSchemaVisitor = stampit(SchemaVisitor, { | ||
props: { | ||
specPath: always(['document', 'objects', 'JSONSchema']), | ||
canSupportSpecificationExtensions: false, | ||
jsonSchemaDefaultDialect: 'https://json-schema.org/draft/2020-12/schema', | ||
}, | ||
init() { | ||
this.element = new JSONSchemaElement(); | ||
}, | ||
}); | ||
|
||
export default JSONSchemaVisitor; |
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
Oops, something went wrong.