[BUG] [Java Spring OAS3] api.mustache does not import Hidden annotation when oas3 is enabled
Created by: jameswynn
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
When oas3 is enabled, the Hidden annotation should be imported. It is used by ServerWebExchange and Pageable.
openapi-generator version
5.3.1
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: Api Documentation
description: Api Documentation
termsOfService: urn:tos
contact: {}
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0
version: '1.0'
paths:
/thingy:
get:
operationId: get
x-spring-paginated: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ResponseList'
components:
schemas:
ResponseList:
type: array
items:
$ref: '#/components/schemas/ResponseEntry'
ResponseEntry:
type: object
properties:
id:
type: string
format: uuid
name:
type: string
Generation Details
Generator name: spring Library: spring-cloud Config options:
- oas3: true
Generated Code from an API:
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
Expected Code from an API:
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
Suggest a fix
Add a new import statement around line 11 of JavaSpring/api.mustache inside the oas3 block.
import io.swagger.v3.oas.annotations.Hidden;