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

Plyex javax.validations size #94

Open
notnigel opened this issue Apr 12, 2024 · 0 comments
Open

Plyex javax.validations size #94

notnigel opened this issue Apr 12, 2024 · 0 comments

Comments

@notnigel
Copy link

notnigel commented Apr 12, 2024

There is a snakeyaml error being thrown on minlength and maxlength when

  1. Using @Size on the model property.
  2. Using @ParameterObject and @Valid on the request controller method argument

Model:

public class User {
   @Size(min=0, max=20)
   private String name;

   public User(String name) {
      this.name = name;
}

Controller

@RestController
@RequestMapping("api/v1/users")
public class UserController {
    @GetMapping(
            value = "/iwhoami",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<?> whoami(
            @ParameterObject
            @Valid
            User user) {
                 return new ResponseEntity<>(new User(), HttpStatus.OK);
   }
}

Partial Exception Stack Trace:

Caused by: Cannot create property=get for JavaBean=org.plyct.plyex.openapi.OpenApi$Path@132e0cc
 in 'string', line 646, column 5:
        get:
        ^
Cannot create property=parameters for JavaBean=org.plyct.plyex.openapi.OpenApi$Operation@2c78d320
 in 'string', line 647, column 7:
          tags:
          ^
Cannot create property=schema for JavaBean=org.plyct.plyex.openapi.OpenApi$Parameter@67d18ed7
 in 'string', line 651, column 9:
          - name: accountNumber
            ^
Cannot create property=maxLength for JavaBean=org.plyct.plyex.openapi.OpenApi$Schema@5c44c582
 in 'string', line 655, column 11:
              maxLength: 1
              ^
Unable to find property 'maxLength' on class: org.plyct.plyex.openapi.OpenApi$Schema
 in 'string', line 655, column 22:
              maxLength: 1
                         ^

 in 'string', line 655, column 11:
              maxLength: 1
              ^

 in 'string', line 651, column 7:
          - name: accountNumber
          ^

 in 'string', line 647, column 7:
          tags:
          ^

        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:291)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:172)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:480)
        at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:190)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:461)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:159)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.newInstance(Constructor.java:306)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:268)
        ... 11 more
Caused by: Cannot create property=parameters for JavaBean=org.plyct.plyex.openapi.OpenApi$Operation@2c78d320
 in 'string', line 647, column 7:
          tags:
          ^
Cannot create property=schema for JavaBean=org.plyct.plyex.openapi.OpenApi$Parameter@67d18ed7
 in 'string', line 651, column 9:
          - name: accountNumber
            ^
Cannot create property=maxLength for JavaBean=org.plyct.plyex.openapi.OpenApi$Schema@5c44c582
 in 'string', line 655, column 11:
              maxLength: 1
              ^
Unable to find property 'maxLength' on class: org.plyct.plyex.openapi.OpenApi$Schema
 in 'string', line 655, column 22:
              maxLength: 1
                         ^

 in 'string', line 655, column 11:
              maxLength: 1
              ^

 in 'string', line 651, column 7:
          - name: accountNumber
          ^

        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:291)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:172)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:268)
        ... 22 more
Caused by: Cannot create property=schema for JavaBean=org.plyct.plyex.openapi.OpenApi$Parameter@67d18ed7
 in 'string', line 651, column 9:
          - name: accountNumber
            ^
Cannot create property=maxLength for JavaBean=org.plyct.plyex.openapi.OpenApi$Schema@5c44c582
 in 'string', line 655, column 11:
              maxLength: 1
              ^
Unable to find property 'maxLength' on class: org.plyct.plyex.openapi.OpenApi$Schema
 in 'string', line 655, column 22:
              maxLength: 1
                         ^

 in 'string', line 655, column 11:
              maxLength: 1
              ^

        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:291)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:172)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructArrayStep2(BaseConstructor.java:405)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructArray(BaseConstructor.java:386)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructSequence.construct(Constructor.java:549)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.newInstance(Constructor.java:306)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:268)
        ... 26 more
Caused by: Cannot create property=maxLength for JavaBean=org.plyct.plyex.openapi.OpenApi$Schema@5c44c582
 in 'string', line 655, column 11:
              maxLength: 1
              ^
Unable to find property 'maxLength' on class: org.plyct.plyex.openapi.OpenApi$Schema
 in 'string', line 655, column 22:
              maxLength: 1
                         ^

        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:291)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:172)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:268)
        ... 36 more
Caused by: org.yaml.snakeyaml.error.YAMLException: Unable to find property 'maxLength' on class: org.plyct.plyex.openapi.OpenApi$Schema
        at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:158)
        at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:148)
        at org.yaml.snakeyaml.TypeDescription.discoverProperty(TypeDescription.java:254)
        at org.yaml.snakeyaml.TypeDescription.getProperty(TypeDescription.java:265)
        at org.plyct.plyex.openapi.YamlDoc$TypeDescription.getProperty(YamlDoc.java:158)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:231)
        ... 40 more
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