[JAVA] [SPRING] Missed ApiUtil when generated interface only
See original GitHub issueDescription
task buildAPI(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){
verbose = true
generatorName = "spring"
systemProperties = [apis: ""]
additionalProperties = [
"sourceFolder" : "",
"interfaceOnly" : "true",
]
}
Generates code:
@ApiOperation(value = "List all pets", nickname = "listPets", notes = "", response = Error.class, tags={ "pets", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "unexpected error", response = Error.class) })
@RequestMapping(value = "/pets",
produces = { "application/json" },
method = RequestMethod.GET)
default ResponseEntity<Error> listPets() {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"message\" : \"message\"}");
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
But class ApiUtil is not generated.
openapi-generator version
openapiGeneratorVersion = ‘3.2.0-SNAPSHOT’
OpenAPI declaration file content or url
openapi: "3.0.0"
info:
version: 1.0.0
title: IBAN Register
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
get:
summary: List all pets
operationId: listPets
tags:
- pets
responses:
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
schemas:
Error:
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
Suggest a fix/enhancement
Probably duplicate of #386
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:11 (3 by maintainers)
Top Results From Across the Web
How to remove ApiUtil.java from openApi ... - Stack Overflow
Answering my own question. I had to do following things: Increase Open Api version in build.gradle. This is important becuase it was not ......
Read more >Documentation for the spring Generator
helpTxt, Generates a Java SpringBoot Server application using the SpringDoc ... interfaceOnly, Whether to generate only API interface stubs ...
Read more >Open API Server Implementation Using OpenAPI Generator
Learn how to generate a Spring-based server stub from a YAML specification using the OpenAPI generator's Maven plugin.
Read more >17. Web MVC framework - Spring
The model (the M in MVC) is a Map interface, which allows for the complete ... configuration of both framework and application classes...
Read more >FileNet P8 - Getting Started - IBM
Important: In the development of your applications, use only the exposed classes and interfaces that are documented in the Content Engine Java™ and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I prefer solution when
generateSupportingFiles
isfalse
then default interface implementation does not rely onApiUtil
class.same issue setting the property
generateSupportingFiles=true
helped