Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #13677
Closed
Open
Issue created Oct 12, 2022 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] [Spring] Generated test classes are marked as sources instead of test

Created by: mariusmanastireanu

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • [N/A] 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 generating interfaces (invoker) for spring generator the generated test resources are marked as Sources instead of Test Sources. This will break the compilation if test resources are marked as test scope. Also see my response on this question: https://stackoverflow.com/questions/73450027/java-maven-openapi-3-0-codegen-is-generating-unwanted-test-file-how-to-remove

Workaround: run with <interfaceOnly>true</interfaceOnly> (avoid test generation).

openapi-generator version

6.2.0, 6.0.1

OpenAPI declaration file content or url

N/A - anything is sufficient

openapi: 3.0.3
info:
  title: test
  version: "1.0"
servers:
  - url: http://localhost:8080/
    description: Local
tags:
  - name: Target
    description: Targets related REST endpoints.
paths:
  /target:
    get:
      tags:
        - Target
      summary: Retrieves all targets
      description: Returns all targets
      operationId: getTargets
      responses:
        '200':
          description: successful operation
                    <plugin>
				<groupId>org.openapitools</groupId>
				<artifactId>openapi-generator-maven-plugin</artifactId>
				<version>${openapi-generator.version}</version>
				<executions>
					<execution>
						<goals>
							<goal>generate</goal>
						</goals>
						<id>generate-files-from-openapi</id>
						<configuration>
							<inputSpec>${project.basedir}/src/main/resources/static/api.yaml</inputSpec>
							<generatorName>spring</generatorName>
							<library>spring-boot</library>
							<configOptions>
<!--								<interfaceOnly>true</interfaceOnly>-->
							</configOptions>
						</configuration>
					</execution>
				</executions>
			</plugin>
Generation Details

spring

Steps to reproduce

Generate sources and check project strcture.

Related issues/PRs
Suggest a fix
Assignee
Assign to
Time tracking