Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. #1

Closed
remarkablemark opened this issue Aug 9, 2023 · 0 comments · Fixed by #2
Assignees
Labels
bug Something isn't working

Comments

@remarkablemark
Copy link
Member

Expected Behavior

openapi-generator generates spec without issues

Actual Behavior

openapi-generator throws error:

Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
 | Error count: 3, Warning count: 0
Errors:
        -attribute paths.'//rest.example.braze.com/catalogs/{catalog_name}/items'(patch).requestBody.content with no media type is unsupported
        -attribute paths.'//rest.example.braze.com/catalogs'(post).requestBody.content with no media type is unsupported
        -attribute paths.'//rest.example.braze.com/catalogs/{catalog_name}/items'(post).requestBody.content with no media type is unsupported

        at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:620)
        at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:647)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:479)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Exception in thread "main" java.lang.RuntimeException: Could not process operation:
  Tag: class Tag {
    name: Catalogs > Catalog Management > Synchronous
    description: null
    externalDocs: null
}
  Operation: null
  Resource: post //rest.example.braze.com/catalogs
  Schemas: {}
  Exception: Request body cannot be null. Possible cause: missing schema in body parameter (OAS v2): class RequestBody {
    description: null
    content: null
    required: null
}
        at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1221)
        at org.openapitools.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:1115)
        at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:586)
        at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:949)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:487)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: java.lang.RuntimeException: Request body cannot be null. Possible cause: missing schema in body parameter (OAS v2): class RequestBody {
    description: null
    content: null
    required: null
}
        at org.openapitools.codegen.DefaultCodegen.fromRequestBody(DefaultCodegen.java:7362)
        at org.openapitools.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:4489)
        at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1189)
        ... 6 more

Steps to Reproduce

openapi-generator generate -i openapi/spec.json -g php -o src
openapi-generator generate -i openapi/spec.json -g php -o src  --skip-validate
-spec

Reproducible Demo

N/A

Environment

  • Version:
  • Platform:
  • Browser:
  • OS: macOS

Keywords

openapi, error, exception

@remarkablemark remarkablemark added the bug Something isn't working label Aug 9, 2023
@remarkablemark remarkablemark self-assigned this Aug 9, 2023
remarkablemark added a commit that referenced this issue Aug 9, 2023
Fixes #1

```
/catalogs/{catalog_name}/items'(post).requestBody.content with no media type is unsupported
```
remarkablemark added a commit that referenced this issue Aug 9, 2023
Fixes #1

```
/catalogs'(post).requestBody.content with no media type is unsupported
```
remarkablemark added a commit that referenced this issue Aug 9, 2023
Fixes #1

```
-attribute paths.'/catalogs/{catalog_name}/items'(patch).requestBody.content with no media type is unsupported
```
@remarkablemark remarkablemark mentioned this issue Aug 9, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant