otter icon indicating copy to clipboard operation
otter copied to clipboard

[Bug]: Mandatory dictionary field remain mandatory when part of the request

Open kpanot opened this issue 9 months ago • 0 comments

Package name

core, schematics

Package version

Reproduction steps

  • Create a definition with mandatory field link to the dictionary (following example:)
definitions:
  Amount:
    type: object
    description: Amount expressed as value and currency code.
    required:
      - value
      - currencyCode
    properties:
      value:
        type: integer
        format: int64
        minimum: 0
      rawValue:
        type: string
      currencyCode:
        type: string
        pattern: '[A-Z]{3}'
        x-dictionary-name: currency
        x-field-name: currency
        x-field-type: CurrencyDictionaryItem
  • Use this definition in API response and in API request parameter

Current result

First issue: The request function typing requires the parameter to be provided with the dictionary field (which can be complicated to provided by the application). Second issue: The dictionary field is serialized and sent to the API (which can lead to call rejection if strongly checked by the API).

Expected result

  • The definition should have a dictionary mandatory in response but optional or removed in request (maybe via a type helper or a duplication of interface?)
  • The serialization of the request should ignore the dictionary fields

Additional comments

No response

kpanot avatar May 21 '24 06:05 kpanot