(parts: Parts, options?: Options)
| 39 | } |
| 40 | |
| 41 | const getSpec = (parts: Parts, options?: Options): OpenApi.OpenAPISpec => { |
| 42 | const additionalPropertiesStrategy = (options?.additionalPropertiesStrategy ?? "strict") === "allow" |
| 43 | return { |
| 44 | "openapi": "3.1.0", |
| 45 | "info": { "title": "Api", "version": "0.0.1" }, |
| 46 | "paths": parts.paths, |
| 47 | "tags": parts.tags ?? [{ "name": "group" }], |
| 48 | "components": { |
| 49 | "schemas": { |
| 50 | "HttpApiDecodeError": { |
| 51 | "type": "object", |
| 52 | "required": ["issues", "message", "_tag"], |
| 53 | "properties": { |
| 54 | "issues": { |
| 55 | "type": "array", |
| 56 | "items": { |
| 57 | "$ref": "#/components/schemas/Issue" |
| 58 | } |
| 59 | }, |
| 60 | "message": { "type": "string" }, |
| 61 | "_tag": { |
| 62 | "type": "string", |
| 63 | "enum": [ |
| 64 | "HttpApiDecodeError" |
| 65 | ] |
| 66 | } |
| 67 | }, |
| 68 | "additionalProperties": additionalPropertiesStrategy, |
| 69 | "description": "The request did not match the expected schema" |
| 70 | }, |
| 71 | "Issue": { |
| 72 | "type": "object", |
| 73 | "description": "Represents an error encountered while parsing a value to match the schema", |
| 74 | "required": ["_tag", "path", "message"], |
| 75 | "properties": { |
| 76 | "_tag": { |
| 77 | "type": "string", |
| 78 | "description": "The tag identifying the type of parse issue", |
| 79 | "enum": [ |
| 80 | "Pointer", |
| 81 | "Unexpected", |
| 82 | "Missing", |
| 83 | "Composite", |
| 84 | "Refinement", |
| 85 | "Transformation", |
| 86 | "Type", |
| 87 | "Forbidden" |
| 88 | ] |
| 89 | }, |
| 90 | "path": { |
| 91 | "type": "array", |
| 92 | "description": "The path to the property where the issue occurred", |
| 93 | "items": { |
| 94 | "$ref": "#/components/schemas/PropertyKey" |
| 95 | } |
| 96 | }, |
| 97 | "message": { |
| 98 | "type": "string", |
no outgoing calls
no test coverage detected