swagger-api / swagger-api/swagger-codegen
Spring generator not including UniqueElements annotation
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When the openapi has the uniqueItems: true on an array it does not set @UniqueElements on the code
Swagger-codegen version
3.0.19
Swagger declaration file content or url
If you post the code inline, please wrap it with
openapi: 3.0.0
info:
title: Concierge
version: 1.0.0
description: Concierge API
contact:
name: data-stack
email: data-stack@truphone.com
servers:
- url: 'http://localhost:8080'
description: local
paths:
/foo:
get:
summary: Your GET endpoint
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/FooObject'
components:
schemas:
FooObject:
title: FooObject
type: object
properties:
sources:
type: array
uniqueItems: true
items:
type: string
Command line used for generation
swagger-codegen generate -i docs/contract.yml -l spring -o ./
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 schema and the swagger-codegen generate -i docs/contract.yml -l spring -o ./ command. Trace the Spring generator's handling of uniqueItems: true for the sources array, then verify that the generated model includes @UniqueElements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, spring
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100