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] V7.2.0 Breaks Schema Validation Imports #17485

Closed
5 of 6 tasks
jnels124 opened this issue Dec 27, 2023 · 3 comments · Fixed by #17857
Closed
5 of 6 tasks

[BUG] V7.2.0 Breaks Schema Validation Imports #17485

jnels124 opened this issue Dec 27, 2023 · 3 comments · Fixed by #17857

Comments

@jnels124
Copy link

jnels124 commented Dec 27, 2023

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

Upgrading to version 7.2 produces errors when defining array parameters with pattern validation on the items

openapi-generator version

7.2

OpenAPI declaration file content or url
openapi: 3.0.3
paths:
  /api/v1/list:
    get:
      summary: List stuff
      description: |
        The description

      operationId: listStuff
      parameters:
        - $ref: "#/components/parameters/timestampQueryParam"
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StuffResponse"
      tags:
        - stuff

tags:
  - name: stuff
    description: somestuff
info:
  title: Example
  version: 0.0.0-SNAPSHOT
  license:
    name: Apache-2.0
    url: "https://www.apache.org/licenses/LICENSE-2.0.html"
  description: "description"

externalDocs:
  description: EXAMPLE
  url: "https://google.com"
components:
  schemas:
    StuffResponse:
      type: object
      properties:
        someProp:
          description: "This is a description"
          type: string
          example: "This is an example"
  parameters:
    timestampQueryParam:
      description: a timestamp param
      name: timestamp
      in: query
      explode: true
      schema:
        type: array
        items:
          type: string
          pattern: ^((eq|gt|gte|lt|lte|ne):)?\d{1,10}(.\d{1,9})?$
Generation Details
Steps to reproduce
  1. Configure the above spec and run openApiGenerate
Related issues/PRs
Suggest a fix
@jnels124
Copy link
Author

The error produced with this spec is:

/StuffApi.java:91: error: cannot find symbol
  public StuffResponse listStuff(List<@Pattern(regexp = "^((eq|gt|gte|lt|lte|ne):)?\\d{1,10}(.\\d{1,9})?$")String> timestamp) throws ApiException {
                                       ^
  symbol:   class Pattern
  location: class StuffApi
/Users/jessenelson/IdeaProjects/hedera-mirror-node2/hedera-mirror-rest-java/build/generate-resources/main/com/hedera/mirror/rest/api/StuffApi.java:103: error: cannot find symbol
  public ApiResponse<StuffResponse> listStuffWithHttpInfo(List<@Pattern(regexp = "^((eq|gt|gte|lt|lte|ne):)?\\d{1,10}(.\\d{1,9})?$")String> timestamp) throws ApiException {
                                                                ^
  symbol:   class Pattern
  location: class StuffApi
/Users/jessenelson/IdeaProjects/hedera-mirror-node2/hedera-mirror-rest-java/build/generate-resources/main/com/hedera/mirror/rest/api/StuffApi.java:132: error: cannot find symbol
  private HttpRequest.Builder listStuffRequestBuilder(List<@Pattern(regexp = "^((eq|gt|gte|lt|lte|ne):)?\\d{1,10}(.\\d{1,9})?$")String> timestamp) throws ApiException {
                                                            ^
  symbol:   class Pattern
  location: class StuffApi

@steven-sheehy
Copy link
Contributor

This is a regression caused by #17165 and a comment on that PR also notes the same.

@evialina
Copy link

Hi @wing328, @jimschubert , @cbornet , @jmini , @etherealjoy. This is still a problem using v7.7.0 for jaxrs-spec generator when schemaMappings or typeMappings are used.

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.

3 participants