@e22m4u/js-openapi 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +226 -146
  2. package/dist/cjs/index.cjs +2024 -2092
  3. package/package.json +10 -8
  4. package/schema/openapi-3-1/dialect/base.js +21 -0
  5. package/schema/openapi-3-1/meta/base.js +76 -0
  6. package/schema/openapi-3-1/schema-base.js +32 -0
  7. package/schema/openapi-3-1/schema.js +1403 -0
  8. package/src/ajv.js +32 -0
  9. package/src/errors/index.d.ts +1 -1
  10. package/src/errors/index.js +1 -1
  11. package/src/errors/oa-document-object-validation-error.d.ts +6 -0
  12. package/src/errors/oa-document-object-validation-error.js +6 -0
  13. package/src/errors/oa-document-object-validation-error.spec.js +10 -0
  14. package/src/index.d.ts +1 -3
  15. package/src/index.js +1 -3
  16. package/src/json-pointer/resolve-json-pointer.js +1 -1
  17. package/src/json-pointer/unescape-json-pointer.d.ts +1 -2
  18. package/src/oa-document-builder.d.ts +302 -111
  19. package/src/oa-document-builder.js +208 -142
  20. package/src/oa-document-builder.spec.js +1408 -0
  21. package/src/oa-document-object/index.d.ts +1 -1
  22. package/src/oa-document-object/index.js +1 -1
  23. package/src/oa-document-object/validate-oa-document-object.d.ts +18 -0
  24. package/src/oa-document-object/validate-oa-document-object.js +53 -0
  25. package/src/oa-document-object/validate-oa-document-object.spec.js +122 -0
  26. package/src/{oa-document-scope.d.ts → oa-operation-group.d.ts} +7 -7
  27. package/src/{oa-document-scope.js → oa-operation-group.js} +101 -46
  28. package/src/oa-operation-group.spec.js +544 -0
  29. package/src/oa-reference-object/is-oa-reference-object.js +1 -1
  30. package/src/oa-reference-object/is-oa-reference-object.spec.js +1 -1
  31. package/src/oa-reference-object/oa-ref.js +7 -0
  32. package/src/oa-reference-object/resolve-oa-reference-object.js +1 -11
  33. package/src/oa-reference-object/resolve-oa-reference-object.spec.js +0 -10
  34. package/src/oa-specification.d.ts +54 -66
  35. package/src/oa-specification.js +10 -22
  36. package/src/data-type/index.d.ts +0 -1
  37. package/src/data-type/index.js +0 -1
  38. package/src/data-type/infer-openapi-data-type.d.ts +0 -30
  39. package/src/data-type/infer-openapi-data-type.js +0 -38
  40. package/src/data-validation/data-format-validator-map.d.ts +0 -13
  41. package/src/data-validation/data-format-validator-map.js +0 -36
  42. package/src/data-validation/data-format-validator-map.spec.js +0 -39
  43. package/src/data-validation/data-format-validators.d.ts +0 -84
  44. package/src/data-validation/data-format-validators.js +0 -217
  45. package/src/data-validation/index.d.ts +0 -3
  46. package/src/data-validation/index.js +0 -3
  47. package/src/data-validation/validate-data-with-openapi-schema.d.ts +0 -46
  48. package/src/data-validation/validate-data-with-openapi-schema.js +0 -1913
  49. package/src/data-validation/validate-data-with-openapi-schema.spec.js +0 -6953
  50. package/src/errors/oa-data-validation-error.d.ts +0 -6
  51. package/src/errors/oa-data-validation-error.js +0 -6
  52. package/src/errors/oa-data-validation-error.spec.js +0 -17
  53. package/src/oa-document-object/validate-shallow-oa-document.d.ts +0 -10
  54. package/src/oa-document-object/validate-shallow-oa-document.js +0 -209
  55. package/src/oa-document-object/validate-shallow-oa-document.spec.js +0 -362
  56. package/src/utils/count-unicode.d.ts +0 -11
  57. package/src/utils/count-unicode.js +0 -15
  58. package/src/utils/index.d.ts +0 -5
  59. package/src/utils/index.js +0 -5
  60. package/src/utils/join-path.d.ts +0 -6
  61. package/src/utils/join-path.js +0 -36
  62. package/src/utils/join-path.spec.js +0 -104
  63. package/src/utils/normalize-path.d.ts +0 -12
  64. package/src/utils/normalize-path.js +0 -22
  65. package/src/utils/normalize-path.spec.js +0 -56
  66. package/src/utils/to-pascal-case.d.ts +0 -6
  67. package/src/utils/to-pascal-case.js +0 -26
  68. package/src/utils/to-pascal-case.spec.js +0 -15
  69. package/src/utils/to-spaced-json.d.ts +0 -17
  70. package/src/utils/to-spaced-json.js +0 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e22m4u/js-openapi",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "JavaScript модуль для создания OpenAPI Документа",
5
5
  "author": "Mikhail Evstropov <e22m4u@yandex.ru>",
6
6
  "license": "MIT",
@@ -37,27 +37,29 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@e22m4u/js-format": "~0.3.2",
40
- "@e22m4u/js-service": "~0.5.1"
40
+ "@e22m4u/js-service": "~0.5.1",
41
+ "ajv": "~8.17.1",
42
+ "ajv-formats": "~3.0.1"
41
43
  },
42
44
  "devDependencies": {
43
- "@commitlint/cli": "~20.3.1",
44
- "@commitlint/config-conventional": "~20.3.1",
45
+ "@commitlint/cli": "~20.4.1",
46
+ "@commitlint/config-conventional": "~20.4.1",
45
47
  "@eslint/js": "~9.39.2",
46
48
  "@types/chai": "~5.2.3",
47
49
  "@types/mocha": "~10.0.10",
48
50
  "c8": "~10.1.3",
49
51
  "chai": "~6.2.2",
50
- "esbuild": "~0.27.2",
52
+ "esbuild": "~0.27.3",
51
53
  "eslint": "~9.39.2",
52
54
  "eslint-config-prettier": "~10.1.8",
53
55
  "eslint-plugin-chai-expect": "~3.1.0",
54
56
  "eslint-plugin-import": "~2.32.0",
55
- "eslint-plugin-jsdoc": "~62.0.0",
57
+ "eslint-plugin-jsdoc": "~62.5.4",
56
58
  "eslint-plugin-mocha": "~11.2.0",
57
- "globals": "~17.0.0",
59
+ "globals": "~17.3.0",
58
60
  "husky": "~9.1.7",
59
61
  "mocha": "~11.7.5",
60
- "prettier": "~3.8.0",
62
+ "prettier": "~3.8.1",
61
63
  "rimraf": "~6.1.2",
62
64
  "typescript": "~5.9.3"
63
65
  }
@@ -0,0 +1,21 @@
1
+ export default {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$vocabulary": {
4
+ "https://json-schema.org/draft/2020-12/vocab/core": true,
5
+ "https://json-schema.org/draft/2020-12/vocab/applicator": true,
6
+ "https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
7
+ "https://json-schema.org/draft/2020-12/vocab/validation": true,
8
+ "https://json-schema.org/draft/2020-12/vocab/meta-data": true,
9
+ "https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
10
+ "https://json-schema.org/draft/2020-12/vocab/content": true,
11
+ "https://spec.openapis.org/oas/3.1/vocab/base": false
12
+ },
13
+
14
+ "title": "OpenAPI 3.1 Schema Object Dialect",
15
+ "description": "A JSON Schema dialect describing schemas found in OpenAPI v3.1 Descriptions",
16
+
17
+ "allOf": [
18
+ { "$ref": "https://json-schema.org/draft/2020-12/schema" },
19
+ { "$ref": "https://spec.openapis.org/oas/3.1/meta/base" }
20
+ ]
21
+ };
@@ -0,0 +1,76 @@
1
+ export default {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+
4
+ "title": "OAS Base Vocabulary",
5
+ "description": "A JSON Schema Vocabulary used in the OpenAPI Schema Dialect",
6
+
7
+ "type": ["object", "boolean"],
8
+ "properties": {
9
+ "example": true,
10
+ "discriminator": { "$ref": "#/$defs/discriminator" },
11
+ "externalDocs": { "$ref": "#/$defs/external-docs" },
12
+ "xml": { "$ref": "#/$defs/xml" }
13
+ },
14
+ "$defs": {
15
+ "extensible": {
16
+ "patternProperties": {
17
+ "^x-": true
18
+ }
19
+ },
20
+ "discriminator": {
21
+ "$ref": "#/$defs/extensible",
22
+ "type": "object",
23
+ "properties": {
24
+ "propertyName": {
25
+ "type": "string"
26
+ },
27
+ "mapping": {
28
+ "type": "object",
29
+ "additionalProperties": {
30
+ "type": "string"
31
+ }
32
+ }
33
+ },
34
+ "required": ["propertyName"],
35
+ "unevaluatedProperties": false
36
+ },
37
+ "external-docs": {
38
+ "$ref": "#/$defs/extensible",
39
+ "type": "object",
40
+ "properties": {
41
+ "url": {
42
+ "type": "string",
43
+ "format": "uri-reference"
44
+ },
45
+ "description": {
46
+ "type": "string"
47
+ }
48
+ },
49
+ "required": ["url"],
50
+ "unevaluatedProperties": false
51
+ },
52
+ "xml": {
53
+ "$ref": "#/$defs/extensible",
54
+ "type": "object",
55
+ "properties": {
56
+ "name": {
57
+ "type": "string"
58
+ },
59
+ "namespace": {
60
+ "type": "string",
61
+ "format": "uri"
62
+ },
63
+ "prefix": {
64
+ "type": "string"
65
+ },
66
+ "attribute": {
67
+ "type": "boolean"
68
+ },
69
+ "wrapped": {
70
+ "type": "boolean"
71
+ }
72
+ },
73
+ "unevaluatedProperties": false
74
+ }
75
+ }
76
+ };
@@ -0,0 +1,32 @@
1
+ export default {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+
4
+ "$vocabulary": {
5
+ "https://json-schema.org/draft/2020-12/vocab/core": true,
6
+ "https://json-schema.org/draft/2020-12/vocab/applicator": true,
7
+ "https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
8
+ "https://json-schema.org/draft/2020-12/vocab/validation": true,
9
+ "https://json-schema.org/draft/2020-12/vocab/meta-data": true,
10
+ "https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
11
+ "https://json-schema.org/draft/2020-12/vocab/content": true,
12
+ "https://spec.openapis.org/oas/3.1/vocab/base": false
13
+ },
14
+
15
+ "description": "The description of OpenAPI v3.1.x Documents using the OpenAPI JSON Schema dialect",
16
+
17
+ "$ref": "https://spec.openapis.org/oas/3.1/schema",
18
+ "properties": {
19
+ "jsonSchemaDialect": { "$ref": "#/$defs/dialect" }
20
+ },
21
+
22
+ "$defs": {
23
+ "dialect": { "const": "https://spec.openapis.org/oas/3.1/dialect/base" },
24
+
25
+ "schema": {
26
+ "$ref": "https://spec.openapis.org/oas/3.1/dialect/base",
27
+ "properties": {
28
+ "$schema": { "$ref": "#/$defs/dialect" }
29
+ }
30
+ }
31
+ }
32
+ };