Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support readOnly + required combination #145

Closed
dotMortis opened this issue Nov 26, 2019 · 2 comments
Closed

Support readOnly + required combination #145

dotMortis opened this issue Nov 26, 2019 · 2 comments

Comments

@dotMortis
Copy link

Hello there.

There is a problem if a property is required and readOnly at the same time.

In follow case the schema works fine in the response validation.
However, the request validation fails if no id is passed.

Current validation result

    response:
        id*
        username*
        name
    request:
        id*
        username*
        name

Expected validation result

    response:
        id*
        username*
        name
    request:
        username*
        name

Schema

  UserListViewDefault:
      description: default
      type: object
      required:
        - id
        - username
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        username:
           type: string
        name:
           type: string

Documentation definition
readOnly
Relevant only for Schema "properties" definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.

writeOnly (The writeOnly functionality has not been checked yet)
Relevant only for Schema "properties" definitions. Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.

@dotMortis dotMortis changed the title Doesen't support readOnly combination + required Doesen't support readOnly + required combination Nov 26, 2019
@cdimascio
Copy link
Owner

cdimascio commented Nov 27, 2019

@Haruki-Mortis Thanks for the issue. I working on a fix for readOnly and required. writeOnly and required likely need a similar fix. i'll create a separate issue for writeOnly and copy the relevant notes from your post above.

cdimascio added a commit that referenced this issue Nov 27, 2019
Doesen't support readOnly + required combination #145
@cdimascio cdimascio changed the title Doesen't support readOnly + required combination Support readOnly + required combination Nov 27, 2019
@cdimascio
Copy link
Owner

@Haruki-Mortis please give v2.17.1 a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants