OpenAPITools / OpenAPITools/openapi-generator

[BUG] [JavaSpring] Using deepObject with additional properties not possible for server mode

Open
#13,409 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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

In case of using JavaSpring generator start from 4.3.0 using deepObject and additional parameters in query properties not possible.
Actually in version 4.2.0 was result
default ResponseEntity<Void> getRequests(@RequestParam(value = "sortDir", required = false) String sortDir, @RequestParam(value = "meta", required = false) Map<String, Object> meta) ;

in version 4.3.0 got result
default ResponseEntity<Void> getRequests(@RequestParam(value = "sortDir", required = false) String sortDir, @RequestParam(value = "", required = false) Map<String, Object> meta) ;

In next version value for request param in case of Map deleted. It is mean all parameter will put in map.

Changes witch create this problems in file queryParams.mustache
queryParams.mustache v4.2.3
queryParams.mustache v4.3.0

openapi-generator version
        openapi: 3.0.3
        info:
          version: 1.0.0
          title: Test Resource
          description: Diese TEST API
        servers:
          - url: /
        paths:
          "/requests":
            get:
              tags:
              - Request
              description: Get requests
              summary: Get requests
              operationId: getRequests
              parameters:
                - name: sortDir
                  in: query
                  description: sorting directing, one of asc or desc
                  schema:
                    type: string
                    enum: 
                      - asc
                      - desc
                - name: meta
                  in: query
                  style: deepObject
                  description: Parameters for querying process lgos based on their metadata. ?meta[myKey]=myValue&meta[myKey2]=myValue2
                  schema:
                    type: object
                    additionalProperties: true
                    example:
                      myKey: myValue
                      myKey2: 242839744
              responses:
                "200":
                  description: OK
Generation Details

spring delegate pattern

Steps to reproduce
Related issues/PRs
Suggest a fix

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache and compare the v4.2.3 and v4.3.0 versions linked in the issue. Generate the provided OpenAPI 3.0.3 example using the Spring delegate pattern, then verify that the deepObject map parameter retains its request-parameter name while sortDir remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.