contiamo / restful-react

A consistent, declarative way of interacting with RESTful backends, featuring code-generation from Swagger and OpenAPI specs 🔥
MIT License
1.87k stars 109 forks source link

Upgrading from v9 to v11 no longer allows parameter components to be used in DELETE requests #259

Closed ChristianIvicevic closed 4 years ago

ChristianIvicevic commented 4 years ago

Describe the bug With a parameter defined in components.paramters the code generator no longer finds it for DELETE requests when referencing them after upgrading from v9 to v11. (Surprisingly enough only DELETE fails apparently)

To Reproduce

  1. Create a test.yaml file:
    openapi: 3.0.2
    info:
    title: Backend
    description: Description
    version: 2.0.0-SNAPSHOT
    paths:
    /api/v2/library/connectors/{connectorName}:
    put:
      summary: Summmary
      operationId: putLibraryConnector
      parameters:
        - $ref: '#/components/parameters/connectorName'
      responses:
        200:
          description: Ok
    delete:
      summary: Summmary
      operationId: deleteLibraryConnector
      parameters:
        - $ref: '#/components/parameters/connectorName'
      responses:
        204:
          description: No content
    components:
    parameters:
    connectorName:
      name: connectorName
      in: path
      description: Name of a connector to query
      required: true
      schema:
        type: string
      example: rc_mehrfachoffer_cme_mapper
    examples: {}
    schemas: {}
  2. Run restful-react import --file ./test.yaml --output generated.tsx

Expected behavior No errors.

Screenshots Error: The path params connectorName can't be found in parameters (deleteLibraryConnector)

Desktop (please complete the following information):

fabien0102 commented 4 years ago

Thanks for the repro steps, sorry for the delay, but the fix is finally coming 😁 (it was because we didn't resolved the parameters ref) in the schema.