Skip to content

Commit

Permalink
Finetune types
Browse files Browse the repository at this point in the history
  • Loading branch information
w3nl committed Nov 22, 2023
1 parent 6dffa50 commit 43ddad6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@hckrnews/openapi-model",
"description": "OpenAPI Model",
"version": "0.2.4",
"version": "0.2.5",
"author": {
"name": "Pieter Wigboldus",
"url": "https://hckr.news/"
Expand Down
5 changes: 0 additions & 5 deletions src/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ const createBaseObjectFromSchema = (schema) => Object.fromEntries(
Object.entries(schema.properties).map(createPropertyWithDefaultValue)
)

/**
* @param {BaseSchemaObject} schema
* @param {Options=} options
* @returns {any}
*/
const openapiToModel = (schema, options = {}) => {
const { validate = true } = options
const emptyObject = createBaseObjectFromSchema(schema)
Expand Down
15 changes: 9 additions & 6 deletions src/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ export interface Options {
strict?: boolean;
extraAjvFormats?: any[];
}
export class Model {
new(...args: any): T;
constructor(data?: object);
set data(data: object);

export declare class Model {
constructor(data: object);
data: object;
value: object;
set data(data: object): void;
get data(): object;
valueOf(): any;
valueOf(): object;
}

export function openapiToModel(
schema: BaseSchemaObject,
options?: Options
): Model;
): typeof Model;

0 comments on commit 43ddad6

Please sign in to comment.