Skip to content

Commit

Permalink
Merge branch 'main' into 4385-apidom-ns-openapi-3-1
Browse files Browse the repository at this point in the history
  • Loading branch information
glowcloud authored Nov 8, 2024
2 parents 411b309 + 16f9c84 commit 451aa2c
Show file tree
Hide file tree
Showing 221 changed files with 5,816 additions and 4,197 deletions.
7,925 changes: 4,719 additions & 3,206 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
},
"scripts": {
"prebuild": "cd ./node_modules/tree-sitter && node-gyp rebuild && cd ../tree-sitter-json && tree-sitter generate --abi=13 ./grammar.js && tree-sitter build-wasm && node-gyp rebuild && cd ../tree-sitter-yaml && cross-env BABEL_ENV=cjs NODE_OPTIONS='-r core-js/stable @babel/register' tree-sitter generate --abi=13 ./grammar.js && tree-sitter build-wasm && node-gyp rebuild",
"prebuild": "cd ./node_modules/tree-sitter && node-gyp rebuild && cd ../tree-sitter-json && tree-sitter generate ./grammar.js && tree-sitter build --wasm && node-gyp rebuild && cd ../@tree-sitter-grammars/tree-sitter-yaml && tree-sitter generate ./grammar.js && tree-sitter build --wasm && node-gyp rebuild",
"build": "lerna run build",
"build:es": "lerna run build:es",
"build:cjs": "lerna run build:cjs",
Expand Down Expand Up @@ -50,7 +50,6 @@
"@babel/plugin-transform-runtime": "=7.25.9",
"@babel/preset-env": "=7.26.0",
"@babel/preset-typescript": "=7.26.0",
"@babel/register": "=7.25.9",
"@commitlint/cli": "=19.5.0",
"@commitlint/config-conventional": "=19.5.0",
"@types/benchmark": "^2.1.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/apidom-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"lint": "eslint ./",
"lint:fix": "eslint ./ --fix",
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
"typescript:check-types": "tsc -p check-types.tsconfig.json --noEmit && tsc -p check-types-test.tsconfig.json --noEmit",
"typescript:declaration": "tsc -p declaration.tsconfig.json && rollup -c config/rollup/types.dist.js && copyfiles -u 2 ../@types/minim.d.ts ./types && node ../../scripts/file-replace-bof.js './types/dist.d.ts' '/// <reference path=\"./minim.d.ts\" />\nimport * as minim from \"minim\";'",
"typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit",
"typescript:declaration": "tsc -p tsconfig.declaration.json && rollup -c config/rollup/types.dist.js && copyfiles -u 2 ../@types/minim.d.ts ./types && node ../../scripts/file-replace-bof.js './types/dist.d.ts' '/// <reference path=\"./minim.d.ts\" />\nimport * as minim from \"minim\";'",
"test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
"test:update-snapshots": "cross-env UPDATE_SNAPSHOT=1 NODE_ENV=test mocha",
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
Expand Down
10 changes: 10 additions & 0 deletions packages/apidom-core/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "esnext",
"moduleResolution": "node"
},
"include": [
"."
]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"extends": "./tsconfig.json",
"exclude": [
"test/**/*"
],
"compilerOptions": {
"declaration": true,
"declarationDir": "types",
Expand Down
1 change: 0 additions & 1 deletion packages/apidom-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
},
"include": [
"src/**/*",
"test/**/*",
"../@types/**/*.d.ts"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ asyncapi: 2.4.0
info:
version: '1.0.0'
title: Something
channels: {}
31 changes: 29 additions & 2 deletions packages/apidom-ls/test/openapi-yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ describe('apidom-ls-yaml', function () {
];
assert.deepEqual(result, expected as Diagnostic[]);
});

it('test validate invalid YAML indent', async function () {
const validationContext: ValidationContext = {
comments: DiagnosticSeverity.Error,
Expand All @@ -871,8 +872,8 @@ describe('apidom-ls-yaml', function () {
{
range: {
start: {
line: 3,
character: 4,
line: 2,
character: 18,
},
end: {
line: 3,
Expand All @@ -884,6 +885,32 @@ describe('apidom-ls-yaml', function () {
code: 0,
source: 'syntax',
},
{
range: {
start: {
line: 1,
character: 0,
},
end: {
line: 1,
character: 4,
},
},
message: "should always have a 'title'",
severity: 1,
code: 70101,
source: 'apilint',
data: {
quickFix: [
{
message: "add 'title' field",
action: 'addChild',
snippetYaml: 'title: \n ',
snippetJson: '"title": "",\n ',
},
],
},
},
];
assert.deepEqual(result, expected as Diagnostic[]);
});
Expand Down
22 changes: 22 additions & 0 deletions packages/apidom-ns-json-schema-draft-4/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"settings": {
"import/resolver": {
"typescript": {
"project": ["./tsconfig.json"]
}
}
},
"rules": {
"import/extensions": [
"error",
"always",
{
"ts": "always",
"tsx": "always",
"js": "always",
"jsx": "never",
"ignorePackages": true
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"allowImportingTsExtensions": true
},
"include": [
"src/**/*",
"../@types/**/*.d.ts"
"src/**/*"
]
}
2 changes: 1 addition & 1 deletion packages/apidom-ns-json-schema-draft-4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
"test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
"test:update-snapshots": "cross-env UPDATE_SNAPSHOT=1 BABEL_ENV=cjs mocha",
"typescript:check-types": "tsc --noEmit",
"typescript:check-types": "tsc -p check-types.tsconfig.json --noEmit && tsc -p check-types-test.tsconfig.json --noEmit",
"typescript:declaration": "tsc -p declaration.tsconfig.json && rollup -c config/rollup/types.dist.js",
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
"postpack": "rimraf NOTICE LICENSES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
Meta,
} from '@swagger-api/apidom-core';

import JSONReferenceElement from './JSONReference';
import MediaElement from './Media';
import JSONReferenceElement from './JSONReference.ts';
import MediaElement from './Media.ts';

class JSONSchema extends ObjectElement {
constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ObjectElement, StringElement, Attributes, Meta } from '@swagger-api/apidom-core';

import JSONSchema from './JSONSchema';
import JSONReferenceElement from './JSONReference';
import JSONSchema from './JSONSchema.ts';
import JSONReferenceElement from './JSONReference.ts';

/**
* URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-hyperschema-00#section-5
Expand Down
88 changes: 44 additions & 44 deletions packages/apidom-ns-json-schema-draft-4/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,118 +11,118 @@ export {
isStringElement,
} from '@swagger-api/apidom-core';

export { default as mediaTypes, JSONSchemaDraft4MediaTypes } from './media-types';
export { default as mediaTypes, JSONSchemaDraft4MediaTypes } from './media-types.ts';

// eslint-disable-next-line no-restricted-exports
export { default } from './namespace';
export { default } from './namespace.ts';

export { default as refractorPluginReplaceEmptyElement } from './refractor/plugins/replace-empty-element';
export { default as refractorPluginReplaceEmptyElement } from './refractor/plugins/replace-empty-element.ts';

export { default as refract, createRefractor } from './refractor';
export { default as specificationObj } from './refractor/specification';
export { default as refract, createRefractor } from './refractor/index.ts';
export { default as specificationObj } from './refractor/specification.ts';

export {
isJSONReferenceElement,
isJSONSchemaElement,
isLinkDescriptionElement,
isMediaElement,
} from './predicates';
} from './predicates.ts';

export { isJSONReferenceLikeElement } from './refractor/predicates';
export { isJSONReferenceLikeElement } from './refractor/predicates.ts';

export { default as Visitor } from './refractor/visitors/Visitor';
export type { VisitorOptions } from './refractor/visitors/Visitor';
export { default as SpecificationVisitor } from './refractor/visitors/SpecificationVisitor';
export type { SpecificationVisitorOptions } from './refractor/visitors/SpecificationVisitor';
export { default as FallbackVisitor } from './refractor/visitors/FallbackVisitor';
export type { FallbackVisitorOptions } from './refractor/visitors/FallbackVisitor';
export { default as FixedFieldsVisitor } from './refractor/visitors/generics/FixedFieldsVisitor';
export type { FixedFieldsVisitorOptions } from './refractor/visitors/generics/FixedFieldsVisitor';
export { default as PatternedFieldsVisitor } from './refractor/visitors/generics/PatternedFieldsVisitor';
export type { PatternedFieldsVisitorOptions } from './refractor/visitors/generics/PatternedFieldsVisitor';
export { default as MapVisitor } from './refractor/visitors/generics/MapVisitor';
export type { MapVisitorOptions } from './refractor/visitors/generics/MapVisitor';
export { default as AlternatingVisitor } from './refractor/visitors/generics/AlternatingVisitor';
export type { AlternatingVisitorOptions } from './refractor/visitors/generics/AlternatingVisitor';
export { default as ParentSchemaAwareVisitor } from './refractor/visitors/json-schema/ParentSchemaAwareVisitor';
export type { ParentSchemaAwareVisitorOptions } from './refractor/visitors/json-schema/ParentSchemaAwareVisitor';
export { default as Visitor } from './refractor/visitors/Visitor.ts';
export type { VisitorOptions } from './refractor/visitors/Visitor.ts';
export { default as SpecificationVisitor } from './refractor/visitors/SpecificationVisitor.ts';
export type { SpecificationVisitorOptions } from './refractor/visitors/SpecificationVisitor.ts';
export { default as FallbackVisitor } from './refractor/visitors/FallbackVisitor.ts';
export type { FallbackVisitorOptions } from './refractor/visitors/FallbackVisitor.ts';
export { default as FixedFieldsVisitor } from './refractor/visitors/generics/FixedFieldsVisitor.ts';
export type { FixedFieldsVisitorOptions } from './refractor/visitors/generics/FixedFieldsVisitor.ts';
export { default as PatternedFieldsVisitor } from './refractor/visitors/generics/PatternedFieldsVisitor.ts';
export type { PatternedFieldsVisitorOptions } from './refractor/visitors/generics/PatternedFieldsVisitor.ts';
export { default as MapVisitor } from './refractor/visitors/generics/MapVisitor.ts';
export type { MapVisitorOptions } from './refractor/visitors/generics/MapVisitor.ts';
export { default as AlternatingVisitor } from './refractor/visitors/generics/AlternatingVisitor.ts';
export type { AlternatingVisitorOptions } from './refractor/visitors/generics/AlternatingVisitor.ts';
export { default as ParentSchemaAwareVisitor } from './refractor/visitors/json-schema/ParentSchemaAwareVisitor.ts';
export type { ParentSchemaAwareVisitorOptions } from './refractor/visitors/json-schema/ParentSchemaAwareVisitor.ts';

export type {
default as JSONReferenceVisitor,
JSONReferenceVisitorOptions,
} from './refractor/visitors/json-schema/json-reference';
} from './refractor/visitors/json-schema/json-reference/index.ts';
export type {
default as JSONReference$RefVisitor,
$RefVisitorOptions as JSONReference$RefVisitorOptions,
} from './refractor/visitors/json-schema/json-reference/$RefVisitor';
} from './refractor/visitors/json-schema/json-reference/$RefVisitor.ts';
export type {
default as LinkDescriptionVisitor,
LinkDescriptionVisitorOptions,
} from './refractor/visitors/json-schema/link-description';
} from './refractor/visitors/json-schema/link-description/index.ts';
export type {
default as MediaVisitor,
MediaVisitorOptions,
} from './refractor/visitors/json-schema/media';
} from './refractor/visitors/json-schema/media/index.ts';
export type {
default as AllOfVisitor,
AllOfVisitorOptions,
} from './refractor/visitors/json-schema/AllOfVisitor';
} from './refractor/visitors/json-schema/AllOfVisitor.ts';
export type {
default as AnyOfVisitor,
AnyOfVisitorOptions,
} from './refractor/visitors/json-schema/AnyOfVisitor';
} from './refractor/visitors/json-schema/AnyOfVisitor.ts';
export type {
default as DefinitionsVisitor,
DefinitionsVisitorOptions,
} from './refractor/visitors/json-schema/DefinitionsVisitor';
} from './refractor/visitors/json-schema/DefinitionsVisitor.ts';
export type {
default as DependenciesVisitor,
DependenciesVisitorOptions,
} from './refractor/visitors/json-schema/DependenciesVisitor';
} from './refractor/visitors/json-schema/DependenciesVisitor.ts';
export type {
default as EnumVisitor,
EnumVisitorOptions,
} from './refractor/visitors/json-schema/EnumVisitor';
} from './refractor/visitors/json-schema/EnumVisitor.ts';
export type {
default as JSONSchemaVisitor,
JSONSchemaVisitorOptions,
} from './refractor/visitors/json-schema';
} from './refractor/visitors/json-schema/index.ts';
export type {
default as ItemsVisitor,
ItemsVisitorOptions,
} from './refractor/visitors/json-schema/ItemsVisitor';
} from './refractor/visitors/json-schema/ItemsVisitor.ts';
export type {
default as SchemaOrReferenceVisitor,
SchemaOrReferenceVisitorOptions,
} from './refractor/visitors/json-schema/JSONSchemaOrJSONReferenceVisitor';
} from './refractor/visitors/json-schema/JSONSchemaOrJSONReferenceVisitor.ts';
export type {
default as LinksVisitor,
LinksVisitorOptions,
} from './refractor/visitors/json-schema/LinksVisitor';
} from './refractor/visitors/json-schema/LinksVisitor.ts';
export type {
default as OneOfVisitor,
OneOfVisitorOptions,
} from './refractor/visitors/json-schema/OneOfVisitor';
} from './refractor/visitors/json-schema/OneOfVisitor.ts';
export type {
default as PatternPropertiesVisitor,
PatternPropertiesVisitorOptions,
} from './refractor/visitors/json-schema/PatternPropertiesVisitor';
} from './refractor/visitors/json-schema/PatternPropertiesVisitor.ts';
export type {
default as PropertiesVisitor,
PropertiesVisitorOptions,
} from './refractor/visitors/json-schema/PropertiesVisitor';
} from './refractor/visitors/json-schema/PropertiesVisitor.ts';
export type {
default as RequiredVisitor,
RequiredVisitorOptions,
} from './refractor/visitors/json-schema/RequiredVisitor';
} from './refractor/visitors/json-schema/RequiredVisitor.ts';
export type {
default as TypeVisitor,
TypeVisitorOptions,
} from './refractor/visitors/json-schema/TypeVisitor';
} from './refractor/visitors/json-schema/TypeVisitor.ts';

export type { SpecPath } from './refractor/visitors/generics/FixedFieldsVisitor';
export type { SpecPath } from './refractor/visitors/generics/FixedFieldsVisitor.ts';

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

/**
* JSON Schema Draft 4 specification elements.
Expand All @@ -132,4 +132,4 @@ export {
JSONReferenceElement,
MediaElement,
LinkDescriptionElement,
} from './refractor/registration';
} from './refractor/registration.ts';
8 changes: 4 additions & 4 deletions packages/apidom-ns-json-schema-draft-4/src/namespace.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NamespacePluginOptions } from '@swagger-api/apidom-core';

import JSONSchemaElement from './elements/JSONSchema';
import JSONReferenceElement from './elements/JSONReference';
import MediaElement from './elements/Media';
import LinkDescriptionElement from './elements/LinkDescription';
import JSONSchemaElement from './elements/JSONSchema.ts';
import JSONReferenceElement from './elements/JSONReference.ts';
import MediaElement from './elements/Media.ts';
import LinkDescriptionElement from './elements/LinkDescription.ts';

const jsonSchemaDraft4 = {
namespace: (options: NamespacePluginOptions) => {
Expand Down
8 changes: 4 additions & 4 deletions packages/apidom-ns-json-schema-draft-4/src/predicates.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createPredicate } from '@swagger-api/apidom-core';

import JSONSchemaElement from './elements/JSONSchema';
import JSONReferenceElement from './elements/JSONReference';
import MediaElement from './elements/Media';
import LinkDescriptionElement from './elements/LinkDescription';
import JSONSchemaElement from './elements/JSONSchema.ts';
import JSONReferenceElement from './elements/JSONReference.ts';
import MediaElement from './elements/Media.ts';
import LinkDescriptionElement from './elements/LinkDescription.ts';

export const isJSONSchemaElement = createPredicate(
({ hasBasicElementProps, isElementType, primitiveEq }) => {
Expand Down
8 changes: 4 additions & 4 deletions packages/apidom-ns-json-schema-draft-4/src/refractor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {
} from '@swagger-api/apidom-core';
import { path } from 'ramda';

import type VisitorClass from './visitors/Visitor';
import specification from './specification';
import { keyMap, getNodeType } from '../traversal/visitor';
import createToolbox from './toolbox';
import type VisitorClass from './visitors/Visitor.ts';
import specification from './specification.ts';
import { keyMap, getNodeType } from '../traversal/visitor.ts';
import createToolbox from './toolbox.ts';

const refract = <T extends Element>(
value: unknown,
Expand Down
Loading

0 comments on commit 451aa2c

Please sign in to comment.