Skip to content

Commit

Permalink
fix schema additional* methods
Browse files Browse the repository at this point in the history
  • Loading branch information
magicmatatjahu committed Oct 7, 2022
1 parent 9924460 commit e3f0302
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/models/v2/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ export class Schema extends BaseModel<v2.AsyncAPISchemaObject, { id?: string, pa

additionalItems(): boolean | SchemaInterface {
if (typeof this._json === 'boolean') return this._json;
if (this._json.additionalItems === undefined) return true;
if (typeof this._json.additionalItems === 'boolean') return this._json.additionalItems;
if (this._json.additionalItems === undefined) return true;
if (this._json.additionalItems === null) return false;
return this.createModel(Schema, this._json.additionalItems, { pointer: `${this._meta.pointer}/additionalItems`, parent: this });
}

additionalProperties(): boolean | SchemaInterface {
if (typeof this._json === 'boolean') return this._json;
if (this._json.additionalProperties === undefined) return true;
if (typeof this._json.additionalProperties === 'boolean') return this._json.additionalProperties;
if (this._json.additionalProperties === undefined) return true;
if (this._json.additionalProperties === null) return false;
return this.createModel(Schema, this._json.additionalProperties, { pointer: `${this._meta.pointer}/additionalProperties`, parent: this });
}

Expand Down

0 comments on commit e3f0302

Please sign in to comment.