Skip to content

Refactor metaToJsonProperty to accept AJV keywords #2684

@iqbaldjulfri

Description

@iqbaldjulfri

Description

We need to add additional attributes (AJV keywords) from PropertyDefinition so they will be written to openapi.json and we can use it as validation. Currently, only type, description, items (for arrays), and $ref are written (and a hard-coded format: 'date-time' for Date instances).

Current Behavior

@model()
export class Employee extends Entity {
  @property({
    type: 'string',
    required: true,
    format: 'email', // this won't be written to openapi.json
  })
  email: string;

  @property({
    type: 'string',
    required: true,
    pattern: '(staff|manager|director)', // this also won't be written to openapi spec
  })
  type: string;
}

Expected Behavior

Other AJV keywords is written to openapi spec

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions