No operations defined in spec!
See original GitHub issueHi, So I attempted to follow the getting started guide, and get inspiration from the sample projects, however for some reason my endpoint or models are not visible on the swagger UI, instead I’m faced with “No operations defined in spec!”
I would appreciate any tips to what I’ve might have missed 😃
My controller/interface:
@Tag(name = "Test", description = "Just a test endpoint")
@RequestMapping(value = DEFAULT_PATH, produces = APPLICATION_JSON_VALUE)
@RestController
public interface TestEndpoint {
String DEFAULT_PATH = "/test";
String ID = "/{test-id}";
@Operation(
description = "Get test by test-id",
summary = "Get test summary"
)
@ResponseStatus(code = HttpStatus.OK)
@ApiResponses({
@ApiResponse(
responseCode = HttpURLConnection.HTTP_OK + "",
description = "The request succeeded.",
content = @Content(schema = @Schema(implementation = TestModel.class))
)
})
@GetMapping(value = ID)
TestModel getAgreement(@Parameter(description = "Id of the test", required = true) @PathVariable("test-id") Long testId);
}
Application properties:
server.port=8090
application-description=@project.description@
application-version=@project.version@
springdoc.packages-to-scan=*
springdoc.paths-to-match=/*
My application runner
@SpringBootApplication
public class AuthApplication {
@Bean
public OpenAPI springShopOpenAPI(@Value("${application-version}") String appVersion) {
return new OpenAPI()
.info(new Info().title("HoN Core Auth API")
.description("Authentication & authorization API")
.version(appVersion)
.license(new License().name("(C) HoN")));
}
// @Bean
// public GroupedOpenApi publicApi() {
// String[] paths = {TestEndpoint.DEFAULT_PATH.concat("/**")};
// return GroupedOpenApi.builder()
// .group("public")
// .pathsToMatch(paths)
// .build();
// }
public static void main(String[] args) {
SpringApplication.run(AuthApplication.class, args);
}
}
My model:
@Schema(description = "This model represents a test result")
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@Builder
@Data
public class TestModel {
@Schema(description = "Test description", example = "First test case")
String description;
@Schema(description = "Test id", example = "1", required = true)
@NotNull
Long id;
@Schema(description = "Was the test a success", example = "true", required = true)
@NotNull
Boolean isSuccess;
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
No operations defined in spec! - I get this error even though ...
I am trying to setup swagger on top of my node application using the swagger npm package. I have my end points and...
Read more >No operations defined in spec - IBM
If you see No operations defined in spec in the Swagger editor, the project is not yet ready for testing. Refresh the Swagger...
Read more >No operations defined in spec! #66 - swaggo/echo-swagger
I follow the echo-wagger README tutorial and get the error bellow And I google so many times and have no answer. so any...
Read more >Solved: Error: "No operations defined in spec!" - using ES...
My problem is that I've started a React Native project that needs to consume my own API, but we're using ES6 javascripts with...
Read more >Paths and Operations - Swagger
Swagger defines a unique operation as a combination of a path and an HTTP method. This means that two GET or two POST...
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

@jerryleooo,
Your config is wrong. You are inverting the
groupand thepackage.This is the correct configuration.
@mikt,
This can be contract, but an interface is not going to generate a spring controller. If the controller does not effectively exist, springdoc-openapi will not detect it.
You need to add the implementation class even it’s not yet complete… You can have a look at the project tests for samples.