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] 7.1.0 generates broken APIs for models consisting only of typing additionalProperties #17580

Closed
5 of 6 tasks
jorgerod opened this issue Jan 10, 2024 · 1 comment · Fixed by #17612
Closed
5 of 6 tasks

Comments

@jorgerod
Copy link
Contributor

Bug Report Checklist

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

This PR fixed this bug caused by this PR.

Additionally, when additionalProperties is typed, the error is maintained.

openapi-generator version

7.1.0 and higher

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  version: 1.7.0
  title: my api
servers:
  - url: http://localhost:8080
    description: Localhost
tags:
  - name: queries
    description: Generic query api
paths:
  /rest/v1/queries:
    post:
      tags:
        - queries
      summary: generic queries
      operationId: postQuery
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/QueryParameters"
      responses:
        '200':
          description: The table data
          content:
            application/json:
              schema:
                type: string
components:
  schemas:
    QueryParameters:
      type: object
      additionalProperties: 
        type: string //don't work
Generation Details

java -jar openapi-generator-cli.jar generate -g java -i openapi-rest.yml -o openapi --library resttemplate

Steps to reproduce

Generate the provided api-specification using the provided configuration.

The generator logs:

[ERROR] /api/QueriesApi.java:[70,68] cannot find symbol
[ERROR]   symbol:   class QueryParameters
[ERROR]   location: class api.QueriesApi
Related issues/PRs

cc/ @martin-mfg @wing328

@martin-mfg
Copy link
Contributor

I will have a look. 👍

Until a fix is merged, you can set generateAliasAsModel to true as a workaround.

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

Successfully merging a pull request may close this issue.

2 participants