Skip to content

Commit

Permalink
Data is optional when create a new entity
Browse files Browse the repository at this point in the history
You can create an empty entity with default values
  • Loading branch information
w3nl committed Nov 22, 2023
1 parent c2e69bf commit a15d96a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 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
2 changes: 1 addition & 1 deletion src/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const openapiToModel = (schema, options = {}) => {

/**
* Set the data for the model, including defaults, and validate it against the schema
* @param {object} data
* @param {object=} data
*/
set data (data) {
const newData = {
Expand Down
4 changes: 2 additions & 2 deletions src/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export interface Options {
}

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

0 comments on commit a15d96a

Please sign in to comment.