elements icon indicating copy to clipboard operation
elements copied to clipboard

Objects with all readOnly properties appearing in POST requests

Open steve-nay-sage opened this issue 4 years ago • 1 comments

Describe the bug

If an object within a schema only contains readOnly properties, the POST request display shows the object name with no properties underneath it. The object name should not be shown as it is not involved in POST requests.

To Reproduce

  1. We have an employee-expense schema that contains this object:
  nonReimbursable:
    type: object
    title: nonReimbursable
    properties:
      baseTotalEntered:
        type: number
        description: Non-reimbursable amount in base currency.
        readOnly: true
      reimbursementTotalEntered:
        type: number
        description: Total non-reimbursable amount.
        readOnly: true

Notice that both of the properties are readOnly: true.

The display of the POST command looks like this:

image

Expected behavior

Objects that only contain readOnly:true properties should not appear in POST requests.

Environment (remove any that are not applicable):

  • OS: Windows 10
  • Browser: Chrome
  • Platform: web

steve-nay-sage avatar Aug 30 '21 17:08 steve-nay-sage

I'm experiencing the same issues. writeOnly attributes are correctly omitted from response bodies, but readOnly ones are not omitted from request bodies, which makes schemas non-reusable on requests and responses (which is very useful when using REST) and it introduces the need to separate request and response bodies in two different documentation objects rather than one "resource".

NemesisMate avatar Jul 03 '24 08:07 NemesisMate