Skip to content

Custom UUID wrapper class can't be used anymore after 2.2.28 #4923

Open
@lukas-loibnegger-dt

Description

@lukas-loibnegger-dt

We are using custom classes to represent different IDs for our entities to have type safety:

@Schema(type = "string", format = "uuid", example = "\"\\\"92c1fe60-02a9-4317-9a66-1e8031cfef43\\\"\"")
public class AccountUuid extends StrictUuid {
    private static final String JSON_NAME = "accountUuid";

    @JsonCreator
    public static AccountUuid accountUuid(@JsonProperty(JSON_NAME) String accountUuid) {
        return new AccountUuid(accountUuid);
    }

    public static AccountUuid random() {
        return accountUuid(randomUUID().toString());
    }

    private AccountUuid(String uuid) {
        super(uuid);
    }

    @Override
    @JsonProperty(JSON_NAME)
    public String get() {
        return super.get();
    }

    public static AccountUuid valueOf(String accountUuid) {
        return new AccountUuid(accountUuid);
    }
}

This has worked fine until version 2.2.28, but after upgrading to anything >= 2.2.29, we get the following error in our SwaggerUI:

swagger-ui-bundle.js:2 Error: Could not parse parameter value string as JSON Object or JSON Array
    at parseJsonObjectOrArray (swagger-ui-bundle.js:2:1081613)
    at swagger-ui-bundle.js:2:1086301
    at Array.forEach (<anonymous>)
    at Object.execute_buildRequest [as buildRequest] (swagger-ui-bundle.js:2:1085597)
    at swagger-ui-bundle.js:2:687925
    at swagger-ui-bundle.js:2:543649
    at swagger-ui-bundle.js:2:539731
    at swagger-ui-bundle.js:2:692220
    at Object.newAction (swagger-ui-bundle.js:2:552088)
    at Object.executeRequest (swagger-ui-bundle.js:2:555884)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions