swagger-api / swagger-api/swagger-codegen
[Bug]swagger-codegen-maven-plugin does mot generate api tests when the language is specified as jaxrs-spec
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When target generation language is specified as jaxrs-spec, it does not generate api tests. I have configured swagger-codegen-maven-plugin as follows in pom.xml.
Swagger-codegen version
3.0.23
Swagger declaration file content or url
<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.23</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<skip>false</skip>
<inputSpec>${project.basedir}/src/main/resources/swagger.yaml</inputSpec>
<language>jaxrs-spec</language>
<configOptions>
<sourceFolder>src/main/java/</sourceFolder>
<useGenericResponse>true</useGenericResponse>
</configOptions>
<generateApiTests>true</generateApiTests>
<modelPackage>org.abc.dashboard.rest.model</modelPackage>
<apiPackage>org.abc.dashboard.rest.api</apiPackage>
<output>${project.basedir}</output>
</configuration>
</execution>
</executions>
</plugin>
The swagger file is as below
openapi: 3.0.0
info:
description: This is to retrieve details from the rest api to the UI.
version: "1.0.0"
title: Cluster Aware Dashboard
tags:
- name: "groups"
description: "Access group list"
paths:
/groups:
get:
tags:
- "groups"
summary: "Get set of groups"
operationId: "RetrieveGroups"
responses:
200:
description: "The list of groups registered to dashboard"
content:
application/json:
schema:
$ref: '#/components/schemas/GroupList'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
GroupList:
type: array
items:
type: object
properties:
groupId:
type: string
groupName:
type: string
example: [{groupId: group_01, groupName: dev_env}]
Error:
type: object
properties:
code:
type: integer
message:
type: string
example:
{code: 500, message: Internal server error}
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
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
Start with the pom.xml configuration and the swagger.yaml example, then run the swagger-codegen-maven-plugin generate goal using language jaxrs-spec and generateApiTests=true. Trace the jaxrs-spec generator and its test-generation templates, comparing the generated output with the expected API tests; done means API test files are produced for the supplied specification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100