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

[JAVA SPRING] error: constant string too long #9055

Open
drej1 opened this issue Jan 11, 2019 · 0 comments · May be fixed by #8691 or #12136
Open

[JAVA SPRING] error: constant string too long #9055

drej1 opened this issue Jan 11, 2019 · 0 comments · May be fixed by #8691 or #12136

Comments

@drej1
Copy link

drej1 commented Jan 11, 2019

Description

The swagger-codegen generates for spring server an interface where there is a too long string constant based on the swagger definition.

...
default ResponseEntity<List<Customer>> customerFind(@ApiParam(value = "") @Valid @RequestParam(value = "relatedPartyId", required = false) String relatedPartyId,@ApiParam(value = "") @Valid @RequestParam(value = "relatedPartyRole", required = false) String relatedPartyRole,@ApiParam(value = "") @Valid @RequestParam(value = "fields", required = false) String fields,@ApiParam(value = "") @Valid @RequestParam(value = "query", required = false) String query,@ApiParam(value = "Defines page") @Valid @RequestParam(value = "page", required = false) BigDecimal page,@ApiParam(value = "Limits the number of results for paging") @Valid @RequestParam(value = "size", required = false) BigDecimal size,@ApiParam(value = "Entity ordering") @Valid @RequestParam(value = "sort", required = false) String sort) {
        if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
            if (getAcceptHeader().get().contains("application/json")) {
                try {
                    return new ResponseEntity<>(getObjectMapper().get().readValue("[ {  \"characteristics\" : [ .................... too long string constant

It ends with compilation error:

...\build\generated-sources\swagger\src\main\java\sk\telekom\oneapp\hal\api\CustomersApi.java:71: error: constant string too long
                    return new ResponseEntity<>(getObjectMapper().get().readValue("[ {  \"charact
Swagger-codegen version

2.4.0

Swagger declaration file content or url

https://gist.github.com/drej1/418d1dfa7924471a664fcd4e6fb6b3d2

Command line used for generation

used created gradle task using swagger-codegen with:

config.setLang("spring")
config.setAdditionalProperties([
    "modelPackage"     : modelPackage,
    "apiPackage"       : apiPackage,
    "java8"            : true,
    "serializableModel": true,
    "interfaceOnly"    : true
])
Steps to reproduce
  1. generate spring API server interfaces for yaml with a really complex type definition
Suggest a fix/enhancement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant