@sapporta/rest-open-api 3.52.1 → 3.52.2

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 (42) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +76 -9
  3. package/index.cjs.d.ts +1 -0
  4. package/index.cjs.default.js +1 -0
  5. package/index.cjs.js +673 -0
  6. package/index.cjs.mjs +2 -0
  7. package/index.esm.js +668 -0
  8. package/package.json +15 -5
  9. package/src/index.d.ts +2 -0
  10. package/src/lib/contract-traversal.d.ts +14 -0
  11. package/src/lib/parsers/body.d.ts +14 -0
  12. package/src/lib/parsers/headers.d.ts +14 -0
  13. package/src/lib/parsers/path-params.d.ts +20 -0
  14. package/src/lib/parsers/query-params.d.ts +15 -0
  15. package/src/lib/parsers/test-helpers.d.ts +4 -0
  16. package/src/lib/parsers/utils.d.ts +11 -0
  17. package/src/lib/ts-rest-open-api.d.ts +46 -0
  18. package/src/lib/types.d.ts +83 -0
  19. package/src/lib/utils.d.ts +5 -0
  20. package/.babelrc +0 -10
  21. package/.eslintrc.json +0 -21
  22. package/jest.config.ts +0 -16
  23. package/project.json +0 -51
  24. package/src/index.ts +0 -6
  25. package/src/lib/contract-traversal.ts +0 -217
  26. package/src/lib/parsers/body.ts +0 -71
  27. package/src/lib/parsers/headers.ts +0 -163
  28. package/src/lib/parsers/path-params.spec.ts +0 -235
  29. package/src/lib/parsers/path-params.ts +0 -140
  30. package/src/lib/parsers/query-params.spec.ts +0 -129
  31. package/src/lib/parsers/query-params.ts +0 -89
  32. package/src/lib/parsers/test-helpers.ts +0 -26
  33. package/src/lib/parsers/utils.spec.ts +0 -117
  34. package/src/lib/parsers/utils.ts +0 -82
  35. package/src/lib/ts-rest-open-api.ts +0 -245
  36. package/src/lib/types.ts +0 -109
  37. package/src/lib/utils.ts +0 -92
  38. package/tsconfig.json +0 -22
  39. package/tsconfig.lib.json +0 -10
  40. package/tsconfig.spec.json +0 -9
  41. package/typedoc.json +0 -5
  42. /package/src/lib/parsers/{index.ts → index.d.ts} +0 -0
package/src/lib/utils.ts DELETED
@@ -1,92 +0,0 @@
1
- import { SchemaObject, MediaTypeObject, ReferenceObject } from 'openapi3-ts';
2
-
3
- export const convertSchemaObjectToMediaTypeObject = (
4
- input: SchemaObject,
5
- ): MediaTypeObject => {
6
- const { mediaExamples: examples, ...schema } = input;
7
-
8
- return {
9
- schema,
10
- ...(examples && { examples }),
11
- };
12
- };
13
-
14
- export const extractReferenceSchemas = (
15
- schema: SchemaObject,
16
- referenceSchemas: { [id: string]: SchemaObject },
17
- ): SchemaObject => {
18
- if (schema.allOf) {
19
- schema.allOf = schema.allOf?.map((subSchema) =>
20
- extractReferenceSchemas(subSchema, referenceSchemas),
21
- );
22
- }
23
-
24
- if (schema.anyOf) {
25
- schema.anyOf = schema.anyOf?.map((subSchema) =>
26
- extractReferenceSchemas(subSchema, referenceSchemas),
27
- );
28
- }
29
-
30
- if (schema.oneOf) {
31
- schema.oneOf = schema.oneOf?.map((subSchema) =>
32
- extractReferenceSchemas(subSchema, referenceSchemas),
33
- );
34
- }
35
-
36
- if (schema.not) {
37
- schema.not = extractReferenceSchemas(schema.not, referenceSchemas);
38
- }
39
-
40
- if (schema.items) {
41
- schema.items = extractReferenceSchemas(schema.items, referenceSchemas);
42
- }
43
-
44
- if (schema.properties) {
45
- schema.properties = Object.entries(schema.properties).reduce<{
46
- [p: string]: SchemaObject | ReferenceObject;
47
- }>((prev, [propertyName, schema]) => {
48
- prev[propertyName] = extractReferenceSchemas(schema, referenceSchemas);
49
- return prev;
50
- }, {});
51
- }
52
-
53
- if (schema.additionalProperties) {
54
- schema.additionalProperties =
55
- typeof schema.additionalProperties != 'boolean'
56
- ? extractReferenceSchemas(schema.additionalProperties, referenceSchemas)
57
- : schema.additionalProperties;
58
- }
59
-
60
- if (schema.title) {
61
- const nullable = schema.nullable;
62
- schema.nullable = undefined;
63
- if (schema.title in referenceSchemas) {
64
- if (
65
- JSON.stringify(referenceSchemas[schema.title]) !==
66
- JSON.stringify(schema)
67
- ) {
68
- throw new Error(
69
- `Schema title '${schema.title}' already exists with a different schema`,
70
- );
71
- }
72
- } else {
73
- referenceSchemas[schema.title] = schema;
74
- }
75
-
76
- if (nullable) {
77
- schema = {
78
- nullable: true,
79
- allOf: [
80
- {
81
- $ref: `#/components/schemas/${schema.title}`,
82
- },
83
- ],
84
- };
85
- } else {
86
- schema = {
87
- $ref: `#/components/schemas/${schema.title}`,
88
- };
89
- }
90
- }
91
- return schema;
92
- };
package/tsconfig.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "module": "commonjs",
5
- "forceConsistentCasingInFileNames": true,
6
- "strict": true,
7
- "noImplicitOverride": true,
8
- "noPropertyAccessFromIndexSignature": true,
9
- "noImplicitReturns": true,
10
- "noFallthroughCasesInSwitch": true
11
- },
12
- "files": [],
13
- "include": [],
14
- "references": [
15
- {
16
- "path": "./tsconfig.lib.json"
17
- },
18
- {
19
- "path": "./tsconfig.spec.json"
20
- }
21
- ]
22
- }
package/tsconfig.lib.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../../dist/out-tsc",
5
- "declaration": true,
6
- "types": []
7
- },
8
- "include": ["**/*.ts"],
9
- "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"]
10
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../../dist/out-tsc",
5
- "module": "commonjs",
6
- "types": ["jest", "node"]
7
- },
8
- "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
9
- }
package/typedoc.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": ["../../../typedoc.base.json"],
3
- "entryPoints": ["src/index.ts"],
4
- "tsconfig": "./tsconfig.lib.json"
5
- }
File without changes