[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.
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{}} ->