OpenAPITools / OpenAPITools/openapi-generator
[BUG][Angular] Query parameters with additionalProperties not serialized
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
Having the following spec:
'/v1/job':
get:
parameters:
...
- name: sort
in: query
required: false
style: form
explode: false
schema:
type: object
additionalProperties:
type: string
enum:
- asc
- desc
The TS is correctly generated:
getJobs(jobType: string, search?: string, limit?: number, page?: number, sort?: {
[key: string]: 'asc' | 'desc';
}, observe?: 'body', reportProgress?: boolean): Observable<Page>;
But the item is not serialized, instead I get a query like this: host/job?sort=[object Object]
Command line used for generation
/bin/docker run [...] openapitools/openapi-generator-cli generate -i source.yaml -g typescript-angular -o /data/sdk/angular --additional-properties=npmName=@api,withInterfaces=true,ngVersion=7.0.0
Suggest a fix/enhancement
Dictionary types should be serialized according to https://swagger.io/docs/specification/serialization/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the supplied OpenAPI specification and the typescript-angular generator command. Start by tracing how the generated getJobs method serializes query parameters, focusing on object values with additionalProperties. Done means the sort dictionary is serialized according to the referenced OpenAPI rules instead of becoming [object Object].
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, openapi, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100