Skip to content

[BUG] rust-server generates a app that tries to bind to the same port twice. #22117

@monksy

Description

@monksy

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • 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

Sample code for http services tries to rebind the same port.

openapi-generator version

rust-service

OpenAPI declaration file content or url
openapi: 3.0.3                                                     

info:                                                              
  title: Helloworld API                                            
  description: API defining the operations available in the Helloworld API                                                                                                                                                                                                    
  version: 0.1.0                                                   
servers:                                                           
  - url: "https://helloapi.apptocracy.com/v1"                                                                                          
    description: Production API endpoint for the Hello World API                                                                       

components:                                                        
  schemas:                                                         
    Message:                                                       
      type: object                                                 
      properties:                                                  
        message:                                                   
          type: string                                             
paths:                                                             
  /hello/{name}:                                                   
    get:                                                           
      operationId: sayHello                                        
      description: say hello                                                                                                           
      parameters:                                                  
        - name: name                                               
          in: path                                                 
          required: true                                           
          description: name of the individual to say hello to                                                                          
          schema:                                                  
            type: string                                           
      responses:                                                   
        "200":                                                     
          description: OK                                          
          content:                                                 
            application/json:                                      
              schema:                                              
                $ref: "#/components/schemas/Message"
Generation Details
openapi-generator generate \                                                                                                                                                               -i hello.yml \
  -g rust-server \
  -o ./generated-server

Generator used:

openapi-generator-cli 7.16.0
  commit : unknown
  built  : -999999999-01-01T00:00:00+18:00
  source : https://github.com/openapitools/openapi-generator
  docs   : https://openapi-generator.tech/

Steps to reproduce
cd generated-server 
cargo run --example server 

Output is that the address its binding to is already binded before.

Related issues/PRs

N/A

Suggest a fix

Remove unneeded port binding.

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