Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2334
Closed
Open
Issue created Mar 08, 2019 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][ELIXIR] deserialisation only happens when response has status 200

Created by: mrmstn

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Based on the sigature of RequestBuilder.decode, a deserialisation only happens when the statuscode is 200 - no mather of what's defined in the OpenApi Spec

openapi-generator version
  • v3.3.4
  • v4.0.0-beta2
OpenAPI declaration file content
openapi: 3.0.0
info:
  title: Random Title
  version: 1.0.0
servers:
  - url: https://api.example.com/
paths:
  /create:
    post:
      operationId: createSomething
      responses:
        201:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Something'

components:
  schemas:
    Something:
      type: object
      properties:
        id:
          type: string
          example: OK
Command line used for generation
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
    -i /local/openapi.yaml \
    -g elixir \
    -o /local/out
Steps to reproduce

Based on the following line, a propper match on the 201 statuscode would be imposible.

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/elixir/request_builder.ex.mustache#L124

the function createSomething will always return the tesla.env instead of the propper deserialized Something Model

Related issues/PRs

none

Suggest a fix

Add a switch case to the createSomething pipe sequence (in this example...) to determinate the expected module based on the response statuscode, default should be matched with {:ok, %Tesla.Env{}} ->

Assignee
Assign to
Time tracking