oapi-codegen icon indicating copy to clipboard operation
oapi-codegen copied to clipboard

Flag `skip-optional-pointer` is not respected for oneOf props

Open lzap opened this issue 6 months ago • 0 comments

It looks like when skip-optional-pointer is set and a propery has oneOf it is generated as a pointer anyway so the global setting is ignored. Luckily, setting it locally works. Example:

  ignition:
    description: |
      Provides Ignition configuration files to be used in edge-raw-image and
      edge-simplified-installer images. Check the RHEL for Edge butane specification for
      a description of the supported configuration options.

      The blueprint configuration can be done either by embedding an Ignition configuration
      file into the image, or providing a provisioning URL that will be fetched at first boot.
    oneOf:
      - "$ref": "ignition_url.yaml"
      - "$ref": "ignition_text.yaml"
    x-go-name: Ignition
    x-go-type-name: Ignition
    # Must be kept because oneOf is used
    x-go-type-skip-optional-pointer: true

lzap avatar Aug 06 '25 11:08 lzap