-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Open
Labels
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?
Description
The Pojo and Jackson annotation templates are not honoring required fields in the spec. Adjacent @JsonBProperty annotations do.
Expected annotations with required fields:
@JsonProperty(value = JSON_PROPERTY_NAME, required = true)
Actual annotations
@JsonProperty(JSON_PROPERTY_NAME)
openapi-generator version
master
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: 'Some API'
version: 1.0.0
servers:
- url: 'https://localhost'
paths:
/v1/some_path:
get:
responses:
'200':
content:
application/json:
schema:
type: object
properties:
foo:
type: string
required:
- foo
description: "some description"
Steps to reproduce
- Have a spec with any required field
- Run the Java codegen with Jackson serialization
- See the generated model is not honoring required in the @JsonProperty annotation
Related issues/PRs
Have searched but not found any.
Suggest a fix
I will submit a PR with changes for further consideration.
WallmanBinnette