Skip to content

Commit

Permalink
feat: add type definitions (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
George-Payne authored Mar 17, 2021
1 parent 45c080c commit d0c75d9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
32 changes: 32 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
declare namespace OpenapiSchemaToJsonSchema {
interface Options {
dateToDateTime?: boolean;
cloneSchema?: boolean;
supportPatternProperties?: boolean;
keepNotSupported?: NotSupported[];
strictMode?: boolean;
}
type NotSupported =
| "nullable"
| "discriminator"
| "readOnly"
| "writeOnly"
| "xml"
| "externalDocs"
| "example"
| "deprecated";

function fromSchema<T = Record<string | number, any>>(
schema: Record<string | number, any>,
options?: Options
): T;
function fromParameter<T = Record<string | number, any>>(
parameter: Record<string | number, any>,
options?: Options
): T;
}
declare function OpenapiSchemaToJsonSchema<T = Record<string | number, any>>(
schema: Record<string | number, any>,
options?: OpenapiSchemaToJsonSchema.Options
): T;
export = OpenapiSchemaToJsonSchema;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.0-development",
"description": "Converts OpenAPI Schema Object to JSON Schema",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"pretest": "npm run lint",
"test": "tape test/**/*.test.js | tap-spec",
Expand Down

0 comments on commit d0c75d9

Please sign in to comment.