Skip to content

[BUG][jaxrs-cxf-extended][server] Certain data types not handled correctly #2193

@demonfiddler

Description

@demonfiddler

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

The recently added jaxrs-cxf-extended generator has a corresponding samples/jaxrs-cxf-petstore-server-test-data, whose generated tests actually invoke the dummy services. Several of these tests fail on account of problems handling certain data types such as Attachment and enums. Consequently, the failing tests are now annotated with @ignore but the problems still need to be investigated:

  • org.openapitools.api.FakeApiTest
    • testEndpointParametersTest()
    • testEnumParametersTest()
    • testJsonFormDataTest()
  • org.openapitools.api.PetApiTest
    • updatePetWithFormTest()
    • uploadFileTest()
    • uploadFileWithRequiredFileTest()
openapi-generator version

4.0.0-SNAPSHOT

OpenAPI declaration file content or url

openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml

Command line used for generation

generate --artifact-id jaxrs-cxf-petstore-server-test-data -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf-extended -o samples/server/petstore/jaxrs-cxf-test-data -DhideGenerationTimestamp=true -DuseAnnotatedBasePath=true --generate-alias-as-model --additional-properties java8=true,generateSpringApplication=true,generateSpringBootApplication=true,generateOperationBody=true,loadTestDataFromFile=true

Steps to reproduce

Generate using bin/jaxrs-cxf-petstore-server-test-data.sh, build the POM, then run the tests.

Related issues/PRs

See also PR##1879.

Suggest a fix

I've spent a fair amount of time debugging this without arriving at an understanding of the root cause. I don't know enough about Apache CXF internals to see what the problem is and fix it. I suspect we haven't seen similar issues with the other samples generated from petstore-with-fake-endpoints-models-for-testing.yaml simply because they don't actually start a server and invoke operations on it.

I've created this in advance of PR acceptance so that the code I'm committing can refer to this bug report as a known issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions