Skip to content

Client Server URLs: support handling an enum with default as a value clashing with the default value constant #2003

Closed

Description

@jamietanna
openapi: "3.0.0"
info:
  version: 1.0.0
  title: Server URLs can be optionally generated
servers:
- url: https://{username}.gigantic-server.com:{port}/{basePath}
  description: The production API server
  variables:
    # TODO this conflict will cause broken generated code
    conflicting:
      enum:
        - 'default'
        - '443'
      default: 'default'

Activity

  1. acm19 commented on Jul 12, 2025

    @acm19

    Have you thought how you want to go about this? It seems there's no sensible fix without breaking backward compatibility. Something like this seems sensible, is this what you had in mind?

    ...
    - const {{ $prefix }}{{ . | ucFirst }} {{ $prefix }} = "{{ . }}"
    + const {{ $prefix }}Enum{{ . | ucFirst }} {{ $prefix }} = "{{ . }}"
    ...
    - const {{ $prefix }}Default {{ $prefix }} = {{ $prefix }}{{ $v.Default | ucFirst }}
    + const {{ $prefix }}Default {{ $prefix }} = {{ $prefix }}Enum{{ $v.Default | ucFirst }}
    ...
    
    
  2. jamietanna commented on Jul 15, 2025

    @jamietanna
    MemberAuthor

    I haven't really thought about it at all, to be honest - but glad you have!

    I think a slight breaking change (with a Compatibility Option) may be OK, but otherwise making it opt-in via an Output Option would also be reasonable.

    If you're interested and up for raising a PR, would be happy to review!

  3. added a commit that references this issue on Jul 25, 2025
  4. acm19 commented on Jul 25, 2025

    @acm19

    I've created a proposal there ☝️ Please let me know what you think. I think it'd be a good idea to have flipping this behaviour to opt-out once the major is bumped though.

  5. added a commit that references this issue on Aug 12, 2025
  6. added a commit that references this issue on May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions