So I'm using openAPI to generate API classes in Golang and Java. The way the generators of the respective languages interpret the yml file seems to be different.
Here is a part of the yml file:
parameters:
- name: collectionName
schema:
type: string
- name: filter_by
in: query
schema:
type: string
required: true
- name: batch_size
in: query
required: true
schema:
type: integer
And the generator for Golang generated the following structure:
type DeleteDocumentsParams struct {
FilterBy string `json:"filter_by"`
BatchSize int `json:"batch_size"`
}
while for Java, no such class was created. However if I wrap the filter_by and batch_size parameters within an object like this
parameters:
- name: collectionName
in: path
description: The name of the collection to delete documents from
required: true
schema:
type: string
- name: deleteQueryParams
in: query
schema:
type: object
properties:
filter_by:
type: string
batch_size:
type: integer
A DeleteQueryParams class gets created in Java. But in Golang the parameters are added to a nested structure like this
type DeleteDocumentsParams struct {
DeleteQueryParams *struct {
BatchSize *int `json:"batch_size,omitempty"`
FilterBy *string `json:"filter_by,omitempty"`
} `json:"deleteQueryParams,omitempty"`
}
Long story short, the Golang generator adds a layer of wrapping for the query parameters I specify while the Java generator does not. Is it possible to achieve an uniformity in this case. Or, is there any flags that I can use to enable or disable the object wrapping of parameters?