Skip to content

feat(rest): refactoring common filter schemas #4328

@achrinza

Description

@achrinza

Related: #4290 (comment)

Currently, the filter schemas are generated inline in the OAS openapi.json document. This may lead to the filter schemas being repeated within the same OAS docs.

Suggestion

Instead, these schemas should be refactored into /components/schemas.

Use Cases

The OAS document may be more compact and have increased readability as the filter schemas will not be repeated. Furthermore, the generated client-side code may also benefit similarly.

Examples

(Taken from: #4290 (comment))

{
  "TodoFields": {
    "title": "TodoFields",
    "type": "object",
    "properties": {
      "id": {
        "type": "boolean"
      }
     // ...
    }
  },
  "TodoFilter": {
    "title": "TodoFilter",
    "type": "object",
    "properties": {
      "where": {
        "type": "object"
      },
      "fields": {
        "$ref": "#/components/schemas/TodoFields"
      },
      "offset": {
        "minimum": 0,
        "type": "integer",
        "format": "int32"
      },
      "limit": {
        "minimum": 1,
        "type": "integer",
        "format": "int32",
        "example": 100
      },
      "skip": {
        "minimum": 0,
        "type": "integer",
        "format": "int32"
      },
      "order": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": ""
      },
      "include": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Include"
        },
        "description": ""
      }
    }
  }

Acceptance criteria

TBD - will be filled by the team.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions