Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Support multiple responses #46

Open
Condor70 opened this issue Jul 30, 2019 · 0 comments
Open

Support multiple responses #46

Condor70 opened this issue Jul 30, 2019 · 0 comments

Comments

@Condor70
Copy link

The current raml-java-client-generator only maps the lowest 2xx HTTP response in the RAML file and assumes this type is valid for all 2xx responses.

The following example will create a Java client that incorrectly maps the 201 response to a TypeA instead of a TypeB class:

types:
  typeA:
    type: object
    properties:
      fieldA: string
  typeB:
    type: object
    properties:
      fieldB: integer
/test:
  get:
    responses:
      200:
        body:
          type: typeA
      201:
        body:
          type: typeB

The same is true for non-2xx responses.

The following example will throw an execption for a 401 response, but you will need to create the TypeB class and add the mapping yourself:

types:
  typeA:
    type: object
    properties:
      fieldA: string
  typeB:
    type: object
    properties:
      fieldB: integer
/test:
  get:
    responses:
      200:
        body:
          type: typeA
      401:
        body:
          type: typeB

Can support for multiple responses be added to the generator?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant