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

Schema attribute "type" doesn't work for value "boolean" #3088

Closed
AdrianMF opened this issue Jan 25, 2019 · 0 comments
Closed

Schema attribute "type" doesn't work for value "boolean" #3088

AdrianMF opened this issue Jan 25, 2019 · 0 comments

Comments

@AdrianMF
Copy link
Contributor

@Schema(type = "boolean") test_boolean:MyBooleanClass = false

Specifying type=boolean in the schema always produces type:Object in the resulting json. I have tracked the issue down to PrimitiveType.java in package io.swagger.v3.core.util, line 215

It appears that
dms.put("boolean", "boolean");
Should be :
dms.put("boolean_", "boolean");
Because of this function

public static PrimitiveType fromTypeAndFormat(String type, String format) {
        if (StringUtils.isNotBlank(type) && type.equals("object")) {
            return null;
        }
        return fromName(datatypeMappings.get(String.format("%s_%s", StringUtils.isBlank(type) ? "" : type, StringUtils.isBlank(format) ? "" : format)));
    }

always formats the string with an underscore.

frantuma added a commit that referenced this issue Feb 17, 2019
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

1 participant