question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Broken readOnly + required combination

See original GitHub issue

Describe the bug if prop is set to readOnly and required POST/PUT body validation is failing with “required item is missing” (I’m at version 4.1.0)

To Reproduce example schemas:

Item:
      allOf:
        - $ref: '#/components/schemas/id'
        - $ref: '#/components/schemas/name'

    id:
      properties:
        id:
          type: string
          readOnly: true
      required:
        - id

    name:
      properties:
        name:
          type: string
      required:
        - name

Actual behavior Error is thrown:

{
  "errorCode": "required.openapi.validation",
  "message": "should have required property 'id'",
  "path": ".body.id"
}

Expected behavior if prop is set to readOnly it’s not checked in POST/PUT body

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
karlismelderiscommented, Nov 4, 2020

👍 true. we missed some type: object in yml.

and issue is gone with latest version. thank you for fixing it.

1reaction
karlismelderiscommented, Oct 16, 2020

ah missed comment. I will definitely try to create some code example for the case… or will find a bug in our schemas 🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

ios - Does @property copy in combination with readonly make ...
So yes, you're correct... readonly creates a getter method and copy would be effectively ignored, since there's no setter method that does assignment....
Read more >
[SOLVED 2022] Attempted to Write to Read-Only Memory Issue
Method 2. Check your computer's memory ... This is possible on the command line; the only command that you need to enter is...
Read more >
Spread properties on inputs have unexpected readonly ...
We need to re-set input.required = is_required after every time attrs is updated as well. This is why the code was originally written...
Read more >
Unable to open /dev/sdb read-write (Read-only file system)
First try the command sudo hdparm -r0 /dev/sdb (method taken from another askubuntu answer). Then try remounting rw the partition. If these steps...
Read more >
read-only - CSS: Cascading Style Sheets - MDN Web Docs
The :read-only pseudo-class is used to remove all the styling that makes the inputs look like clickable fields, making them look more like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found