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

Loss of opaque names for simple types #1590

Open
MF1-MS opened this issue Nov 30, 2018 · 4 comments
Open

Loss of opaque names for simple types #1590

MF1-MS opened this issue Nov 30, 2018 · 4 comments
Assignees

Comments

@MF1-MS
Copy link
Contributor

MF1-MS commented Nov 30, 2018

Description

I am trying to wrap a primitive type such as a string with an opaqueWrapper. This is correctly rendered using swagger, but OpenAPI 'sees through' the wrapper and the underlying primitive type appears in the method signatures of the resulting generated code.

openapi-generator version

current master

OpenAPI declaration file content or url
definitions:
  request:
    type: object
    required:
      - opaque
    properties:
      opaque:
        $ref: '#/definitions/opaqueWrapper'

opaqueWrapper:
  type : string
  description: A string in an opaque format.
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
@bjgill
Copy link
Contributor

bjgill commented Dec 4, 2018

Hmm. I'm not sure whether this is a rust-server-specific problem or not.

@bjgill
Copy link
Contributor

bjgill commented Dec 4, 2018

In fact, I think this comes from DefaultCodegen.java:fromRequestBody

        Schema schema = ModelUtils.getSchemaFromRequestBody(body);
        if (StringUtils.isNotBlank(schema.get$ref())) {
            name = ModelUtils.getSimpleRef(schema.get$ref());
            schema = schemas.get(name);
        }

It looks as if we're deliberately throwing the outer wrapper away.

@bjgill
Copy link
Contributor

bjgill commented Dec 4, 2018

@wing328 - it looks as if this change was made in 5359776 (Add OpenAPI spec 3.0 support (beta)). Do you remember why this change was made (and/or have any ideas how to turn this behaviour off)?

@MF1-MS MF1-MS changed the title [rust-server] Loss of opaque names for simple types Loss of opaque names for simple types Dec 5, 2018
@bjgill
Copy link
Contributor

bjgill commented Dec 17, 2018

I think I've got a fix for this issue for rust-server. I'm hoping to be able to deliver it within the week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants