Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][JAVA][SPRING] Invalid allOf generation for RestAssured library #7951

Open
1 task
fablerq opened this issue Nov 16, 2020 · 3 comments
Open
1 task

[BUG][JAVA][SPRING] Invalid allOf generation for RestAssured library #7951

fablerq opened this issue Nov 16, 2020 · 3 comments

Comments

@fablerq
Copy link

fablerq commented Nov 16, 2020

Bug Report Checklist

  • [ x ] Have you provided a full/minimal spec to reproduce the issue?
  • [ x ] Have you validated the input using an OpenAPI validator (example)?
  • [ x ] Have you tested with the latest master to confirm the issue still exists?
  • [ x ] Have you searched for related issues/PRs?
  • [ x ] What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Yaml files containing the allOf keywords don't work well with the rest-assured library. I'm getting a list of objects instead of a list of something reasonable, so I don't have direct access to its field.

openapi-generator version

I tested with the latest beta release (v5.0.0-beta2) and latest stable release

OpenAPI declaration file content or url
openapi: 3.0.2
info:
  title: ''
  description: ''
  version: 0.1.0
servers:
  - url: /v1/bar
paths:
  /foo:
    get:
      description: ''
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  foo:
                    description: ''
                    type: array
                    items:
                      allOf:
                        - type: object
                          properties:
                            first_id:
                              type: number
                              format: int64
                        - type: object
                          properties:
                            second_id:
                              type: number
                              format: int64
Generation Details

java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i example.yaml -o /var/tmp/restassured --library rest-assured

Steps to reproduce, actual/expected output
  • Generate classes
  • Look inside InlineResponse200 class. Foo field is a list of Objects, not list of special generated POJOs
Related issues/PRs
Suggest a fix

It could be fixed by merging properties of each object into single object, but it requires time and this is manual operation

@auto-labeler
Copy link

auto-labeler bot commented Nov 16, 2020

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@fablerq fablerq changed the title [BUG][JAVA][SRPING] Invalid allOf generation for RestAssured library [BUG][JAVA][SPRING] Invalid allOf generation for RestAssured library Nov 16, 2020
@beytun
Copy link
Contributor

beytun commented Dec 4, 2020

I face the same issue. I tried with versions 4.3.1 and 5.0.0-beta3.

@spacether
Copy link
Contributor

spacether commented Dec 9, 2020

Have you tried extracting the composed schema into a separate schema and $refing it from this one? That may work.

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

No branches or pull requests

3 participants