Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Provide a consistent way of describing the difference between DB schema and request/response #135

Open
cebe opened this issue Jan 27, 2023 · 1 comment
Assignees
Labels
generator-feature Functionality missing from the generator
Milestone

Comments

@cebe
Copy link
Owner

cebe commented Jan 27, 2023

For simple CRUD operations the DB schema often matches the JSON schema of the request response exactly.
However there are a lot of use cases where the schema returned by the API is very different from the API.

Example:

User:
  type: object
  properties:
    id:
      type: integer
    username:
       type: string
       maxLength: 32
    password_hash:
       type: string
       maxLength: 64

For obvious reasons we do not want to expose the password_hash on the API.

Possible solutions:

  1. use readOnly and writeOnly (related to Properties that are marked as readOnly are not read only #4)
  2. use sepearate Schemas for DB and API and find a way to link them together
@cebe cebe added the generator-feature Functionality missing from the generator label Jan 27, 2023
@cebe cebe added this to the 2.0 milestone Jan 27, 2023
@cebe cebe self-assigned this Jan 27, 2023
@cebe cebe moved this to 📋 Backlog in yii2-openapi Project Jan 27, 2023
@cebe cebe moved this from 📋 Backlog to 🔢 Concept Needed in yii2-openapi Project Jan 27, 2023
@SOHELAHMED7
Copy link
Contributor

I suggest 2nd option: "use sepearate Schemas for DB and API and find a way to link them together"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
generator-feature Functionality missing from the generator
Projects
Status: 🔢 Concept Needed
Development

No branches or pull requests

2 participants