api-definitions icon indicating copy to clipboard operation
api-definitions copied to clipboard

fix: Remove illogical oneOf definitions

Open adamaltman opened this issue 1 year ago • 0 comments

Summary

invoiceTimeShift:
    description: |-
      Shifts issue time and due time of invoices for this subscription.

      This setting overrides plan settings.
      To use plan settings, set this value to `null`.

      To use multiple plans in one subscription,
      all plans must have the same billing period,
      this property enables the customer to subscribe to different plans.
    example: null
    oneOf:
      - $ref: ./InvoiceTimeShift.yaml
      - type: 'null'

Now, let's look at InvoiceTimeShift.yaml (only the first couple of lines):

type:
  - 'object'
  - 'null'

This makes the oneOf illogical for the null value (because it could match either the null part of the oneOf or the InvoiceTimeShift because that is also null. (A bit of a head 🤯 )

Links

  • I'll probably write a blog post about it.
  • https://github.com/Redocly/redocly-cli/issues/1486

Checklist

  • [x] Writing style
  • [x] API design standards

adamaltman avatar Mar 24 '24 13:03 adamaltman