Skip to content

[BUG] [ruby] port :-1 generated in configuration.rb #8047

@jfeltesse-mdsol

Description

@jfeltesse-mdsol

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

In the case no port is defined in the server's URL, in the generated configuration.rb file the @host variable would feature :-1 as the port, which is of course invalid in a URL.

openapi-generator version

master @ cb1a620

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  title: test api
  version: v1
servers:
  - url: https://hello-{stage}.world.{tld}{basePath}
    variables:
      stage:
        default: sandbox
      tld:
        default: net
      basePath:
        default: /v1
paths:
  /test:
    get:
      description: this is a test
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: string
Generation Details
openapi-generator generate -i port-openapi.yml -g ruby --library faraday -o ./port-client
Steps to reproduce
  1. run the above command with the above openapi.yaml file
  2. cat port-client/lib/openapi_client/configuration.rb | grep -n hello-sandbox
  3. prints out: 137: @host = 'hello-sandbox.world.net:-1'
Related issues/PRs

@cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) @wing328

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions