Skip to content

Commit

Permalink
feat(ns-openapi-3-1): use JSON Schema 2020-12 namespace (#4691)
Browse files Browse the repository at this point in the history
Refs #1822
  • Loading branch information
char0n authored Jan 27, 2025
1 parent 23f22ec commit f68adb7
Show file tree
Hide file tree
Showing 33 changed files with 267 additions and 1,400 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1038,11 +1038,11 @@ exports[`given OpenAPI 3.1 definition should decorate with API Design Systems St
"value": {
"element": "schema",
"meta": {
"inherited$schema": {
"inheritedDialectIdentifier": {
"element": "string",
"content": "https://spec.openapis.org/oas/3.1/dialect/base"
},
"inherited$id": {
"ancestorsSchemaIdentifiers": {
"element": "array"
}
},
Expand Down
66 changes: 22 additions & 44 deletions packages/apidom-ns-json-schema-2019-09/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,50 +50,28 @@ export { default as JSONSchemaVisitor } from './refractor/visitors/json-schema/i
export type { JSONSchemaVisitorOptions } from './refractor/visitors/json-schema/index.ts';
export { default as LinkDescriptionVisitor } from './refractor/visitors/json-schema/link-description/index.ts';
export type { LinkDescriptionVisitorOptions } from './refractor/visitors/json-schema/link-description/index.ts';
export type {
default as $defsVisitor,
$defsVisitorOptions,
} from './refractor/visitors/json-schema/$defsVisitor.ts';
export type {
default as $refVisitor,
$refVisitorOptions,
} from './refractor/visitors/json-schema/$refVisitor.ts';
export type {
default as $vocabularyVisitor,
$vocabularyVisitorOptions,
} from './refractor/visitors/json-schema/$vocabularyVisitor.ts';
export type {
default as AllOfVisitor,
AllOfVisitorOptions,
} from './refractor/visitors/json-schema/AllOfVisitor.ts';
export type {
default as AnyOfVisitor,
AnyOfVisitorOptions,
} from './refractor/visitors/json-schema/AnyOfVisitor.ts';
export type {
default as DependentRequiredVisitor,
DependentRequiredVisitorOptions,
} from './refractor/visitors/json-schema/DependentRequiredVisitor.ts';
export type {
default as DependentSchemasVisitor,
DependentSchemasVisitorOptions,
} from './refractor/visitors/json-schema/DependentSchemasVisitor.ts';
export type {
default as ItemsVisitor,
ItemsVisitorOptions,
} from './refractor/visitors/json-schema/ItemsVisitor.ts';
export type {
default as OneOfVisitor,
OneOfVisitorOptions,
} from './refractor/visitors/json-schema/OneOfVisitor.ts';
export type {
default as PatternPropertiesVisitor,
PatternPropertiesVisitorOptions,
} from './refractor/visitors/json-schema/PatternPropertiesVisitor.ts';
export type {
default as PropertiesVisitor,
PropertiesVisitorOptions,
} from './refractor/visitors/json-schema/PropertiesVisitor.ts';
export { default as $defsVisitor } from './refractor/visitors/json-schema/$defsVisitor.ts';
export type { $defsVisitorOptions } from './refractor/visitors/json-schema/$defsVisitor.ts';
export { default as $refVisitor } from './refractor/visitors/json-schema/$refVisitor.ts';
export type { $refVisitorOptions } from './refractor/visitors/json-schema/$refVisitor.ts';
export { default as $vocabularyVisitor } from './refractor/visitors/json-schema/$vocabularyVisitor.ts';
export type { $vocabularyVisitorOptions } from './refractor/visitors/json-schema/$vocabularyVisitor.ts';
export { default as AllOfVisitor } from './refractor/visitors/json-schema/AllOfVisitor.ts';
export type { AllOfVisitorOptions } from './refractor/visitors/json-schema/AllOfVisitor.ts';
export { default as AnyOfVisitor } from './refractor/visitors/json-schema/AnyOfVisitor.ts';
export type { AnyOfVisitorOptions } from './refractor/visitors/json-schema/AnyOfVisitor.ts';
export { default as DependentRequiredVisitor } from './refractor/visitors/json-schema/DependentRequiredVisitor.ts';
export type { DependentRequiredVisitorOptions } from './refractor/visitors/json-schema/DependentRequiredVisitor.ts';
export { default as DependentSchemasVisitor } from './refractor/visitors/json-schema/DependentSchemasVisitor.ts';
export type { DependentSchemasVisitorOptions } from './refractor/visitors/json-schema/DependentSchemasVisitor.ts';
export { default as ItemsVisitor } from './refractor/visitors/json-schema/ItemsVisitor.ts';
export type { ItemsVisitorOptions } from './refractor/visitors/json-schema/ItemsVisitor.ts';
export { default as OneOfVisitor } from './refractor/visitors/json-schema/OneOfVisitor.ts';
export type { OneOfVisitorOptions } from './refractor/visitors/json-schema/OneOfVisitor.ts';
export { default as PatternPropertiesVisitor } from './refractor/visitors/json-schema/PatternPropertiesVisitor.ts';
export type { PatternPropertiesVisitorOptions } from './refractor/visitors/json-schema/PatternPropertiesVisitor.ts';
export { default as PropertiesVisitor } from './refractor/visitors/json-schema/PropertiesVisitor.ts';
export type { PropertiesVisitorOptions } from './refractor/visitors/json-schema/PropertiesVisitor.ts';

export { keyMap, getNodeType } from './traversal/visitor.ts';

Expand Down
112 changes: 0 additions & 112 deletions packages/apidom-ns-json-schema-2020-12/src/elements/JSONSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,125 +71,13 @@ class JSONSchema extends JSONSchemaElement {
* URI: https://json-schema.org/draft/2020-12/vocab/applicator
*/

get not(): this | BooleanElement | undefined {
return this.get('not');
}

set not(not: this | BooleanElement | undefined) {
this.set('not', not);
}

get if(): this | BooleanElement | undefined {
return this.get('if');
}

set if(ifSchema: this | BooleanElement | undefined) {
this.set('if', ifSchema);
}

get then(): this | BooleanElement | undefined {
return this.get('then');
}

set then(thenSchema: this | BooleanElement | undefined) {
this.set('then', thenSchema);
}

get else(): this | BooleanElement | undefined {
return this.get('else');
}

set else(elseSchema: this | BooleanElement | undefined) {
this.set('else', elseSchema);
}

get prefixItems(): ArrayElement | undefined {
return this.get('prefixItems');
}

set prefixItems(prefixItems: ArrayElement | undefined) {
this.set('prefixItems', prefixItems);
}

get items(): this | BooleanElement | undefined {
return this.get('items');
}

set items(items: this | BooleanElement | undefined) {
this.set('items', items);
}

get containsProp(): this | BooleanElement | undefined {
return this.get('contains');
}

set containsProp(containsProp: this | BooleanElement | undefined) {
this.set('contains', containsProp);
}

get additionalProperties(): this | BooleanElement | undefined {
return this.get('additionalProperties');
}

set additionalProperties(additionalProperties: this | BooleanElement | undefined) {
this.set('additionalProperties', additionalProperties);
}

get additionalItems(): this | BooleanElement | undefined {
throw new UnsupportedOperationError(
'additionalItems keyword from Applicator vocabulary has been removed.',
);
}

set additionalItems(additionalItems: this | BooleanElement | undefined) {
throw new UnsupportedOperationError(
'additionalItems keyword from Applicator vocabulary has been removed.',
);
}

get propertyNames(): this | BooleanElement | undefined {
return this.get('propertyNames');
}

set propertyNames(propertyNames: this | BooleanElement | undefined) {
this.set('propertyNames', propertyNames);
}

/**
* Unevaluated Locations vocabulary
*
* URI: https://json-schema.org/draft/2020-12/json-schema-core#section-11
*/

get unevaluatedItems(): this | BooleanElement | undefined {
return this.get('unevaluatedItems');
}

set unevaluatedItems(unevaluatedItems: this | BooleanElement | undefined) {
this.set('unevaluatedItems', unevaluatedItems);
}

get unevaluatedProperties(): this | BooleanElement | undefined {
return this.get('unevaluatedProperties');
}

set unevaluatedProperties(unevaluatedProperties: this | BooleanElement | undefined) {
this.set('unevaluatedProperties', unevaluatedProperties);
}

/**
* Vocabulary for the Contents of String-Encoded Data
*
* URI: https://json-schema.org/draft/2020-12/vocab/content
*/

get contentSchema(): this | BooleanElement | undefined {
return this.get('contentSchema');
}

set contentSchema(contentSchema: this | BooleanElement | undefined) {
this.set('contentSchema', contentSchema);
}
}

export default JSONSchema;
28 changes: 24 additions & 4 deletions packages/apidom-ns-json-schema-2020-12/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,30 @@ export { default as JSONSchemaVisitor } from './refractor/visitors/json-schema/i
export type { JSONSchemaVisitorOptions } from './refractor/visitors/json-schema/index.ts';
export { default as LinkDescriptionVisitor } from './refractor/visitors/json-schema/link-description/index.ts';
export type { LinkDescriptionVisitorOptions } from './refractor/visitors/json-schema/link-description/index.ts';
export type {
default as PrefixItemsVisitor,
PrefixItemsVisitorOptions,
} from './refractor/visitors/json-schema/PrefixItemsVisitor.ts';
export { $defsVisitor } from '@swagger-api/apidom-ns-json-schema-2019-09';
export type { $defsVisitorOptions } from '@swagger-api/apidom-ns-json-schema-2019-09';
export { $refVisitor } from '@swagger-api/apidom-ns-json-schema-2019-09';
export type { $refVisitorOptions } from '@swagger-api/apidom-ns-json-schema-2019-09';
export { $vocabularyVisitor } from '@swagger-api/apidom-ns-json-schema-2019-09';
export type { $vocabularyVisitorOptions } from '@swagger-api/apidom-ns-json-schema-2019-09';
export { AllOfVisitor } from '@swagger-api/apidom-ns-json-schema-2019-09';
export type { AllOfVisitorOptions } from '@swagger-api/apidom-ns-json-schema-2019-09';
export { AnyOfVisitor } from '@swagger-api/apidom-ns-json-schema-2019-09';
export type { AnyOfVisitorOptions } from '@swagger-api/apidom-ns-json-schema-2019-09';
export { DependentRequiredVisitor } from '@swagger-api/apidom-ns-json-schema-2019-09';
export type { DependentRequiredVisitorOptions } from '@swagger-api/apidom-ns-json-schema-2019-09';
export { DependentSchemasVisitor } from '@swagger-api/apidom-ns-json-schema-2019-09';
export type { DependentSchemasVisitorOptions } from '@swagger-api/apidom-ns-json-schema-2019-09';
export { ItemsVisitor } from '@swagger-api/apidom-ns-json-schema-2019-09';
export type { ItemsVisitorOptions } from '@swagger-api/apidom-ns-json-schema-2019-09';
export { OneOfVisitor } from '@swagger-api/apidom-ns-json-schema-2019-09';
export type { OneOfVisitorOptions } from '@swagger-api/apidom-ns-json-schema-2019-09';
export { PatternPropertiesVisitor } from '@swagger-api/apidom-ns-json-schema-2019-09';
export type { PatternPropertiesVisitorOptions } from '@swagger-api/apidom-ns-json-schema-2019-09';
export { PropertiesVisitor } from '@swagger-api/apidom-ns-json-schema-2019-09';
export type { PropertiesVisitorOptions } from '@swagger-api/apidom-ns-json-schema-2019-09';
export { default as PrefixItemsVisitor } from './refractor/visitors/json-schema/PrefixItemsVisitor.ts';
export type { PrefixItemsVisitorOptions } from './refractor/visitors/json-schema/PrefixItemsVisitor.ts';

/**
* JSON Schema 2020-12 specification elements.
Expand Down
21 changes: 0 additions & 21 deletions packages/apidom-ns-json-schema-draft-7/src/elements/JSONSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ class JSONSchema extends JSONSchemaElement {
/**
* Validation keywords for arrays
*/

get containsProp(): this | BooleanElement | JSONReferenceElement | undefined {
return this.get('contains');
}

set containsProp(contains: this | BooleanElement | JSONReferenceElement | undefined) {
this.set('contains', contains);
}

get items(): this | BooleanElement | JSONReferenceElement | ArrayElement | undefined {
return this.get('items');
}
Expand All @@ -62,18 +53,6 @@ class JSONSchema extends JSONSchemaElement {
this.set('items', items);
}

/**
* Validation keywords for objects
*/

get propertyNames(): this | BooleanElement | JSONReferenceElement | undefined {
return this.get('propertyNames');
}

set propertyNames(propertyNames: this | BooleanElement | JSONReferenceElement | undefined) {
this.set('propertyNames', propertyNames);
}

/**
* Keywords for Applying Subschemas Conditionally
*
Expand Down
1 change: 1 addition & 0 deletions packages/apidom-ns-openapi-3-1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@swagger-api/apidom-core": "^1.0.0-beta.10",
"@swagger-api/apidom-json-pointer": "^1.0.0-beta.10",
"@swagger-api/apidom-ns-openapi-3-0": "^1.0.0-beta.10",
"@swagger-api/apidom-ns-json-schema-2020-12": "^1.0.0-beta.10",
"@types/ramda": "~0.30.0",
"ramda": "~0.30.0",
"ramda-adjunct": "^5.0.0",
Expand Down
Loading

0 comments on commit f68adb7

Please sign in to comment.