[ 
https://issues.apache.org/jira/browse/CAMEL-17765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504147#comment-17504147
 ] 

Claus Ibsen edited comment on CAMEL-17765 at 3/10/22, 9:54 AM:
---------------------------------------------------------------

             * 1. Regular getters ("getX")
             * 2. Is-getters ("isX")
             * 3. Implicit, possible getters ("x")
             */


Its jackson-databind that reads the pojo model, and they use this standard, 
meaning that your isXXX boolean is detected as number 2 as an isX type (see 
above)


    protected int _getterPriority(AnnotatedMethod m)
    {
        final String name = m.getName();
        // [databind#238]: Also, regular getters have precedence over 
"is-getters"
        if (name.startsWith("get") && name.length() > 3) {
            // should we check capitalization?
            return 1;
        }
        if (name.startsWith("is") && name.length() > 2) {
            return 2;
        }
        return 3;
    }



was (Author: davsclaus):
             * 1. Regular getters ("getX")
             * 2. Is-getters ("isX")
             * 3. Implicit, possible getters ("x")
             */


Its jackson-databind that reads the pojo model, and they use this standard


    protected int _getterPriority(AnnotatedMethod m)
    {
        final String name = m.getName();
        // [databind#238]: Also, regular getters have precedence over 
"is-getters"
        if (name.startsWith("get") && name.length() > 3) {
            // should we check capitalization?
            return 1;
        }
        if (name.startsWith("is") && name.length() > 2) {
            return 2;
        }
        return 3;
    }


> camel-quarkus-openapi-java not marking required boolean properties if 
> variable prefixed with is
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-17765
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17765
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-openapi-java, tooling
>    Affects Versions: 3.14.1
>         Environment: Oracle JDK 17, macOS 12.2.1, Quarkus 2.7.3, 
> camel-quarkus-openapi-java 2.7.0, camel-openapi-java 3.14.1.
>            Reporter: M. Bergin
>            Assignee: Claus Ibsen
>            Priority: Minor
>         Attachments: camel-openapi-boolean-bug.zip
>
>
> Boolean properties are not marked as required in the openapi document if the 
> respective member variable name is prefixed with is.  The Fruit class in the 
> attached project contains two boolean properties described below which are 
> treated differently if the member variable name is prefixed.
> The property definition below _doesn't_ appear as required in the openapi 
> document although it's marked as required.  The expectation is that it would 
> appear in the list of required properties.
> @NotBlank
> private boolean isNotWorking;
> public boolean isNotWorking() {
> return isNotWorking;
> }
> public void setNotWorking(boolean isNotWorking) {
> this.isNotWorking = isNotWorking;
> }
>  
> The property definition below _does_ appear as required in the openapi 
> document as expected.
> @NotBlank
> private boolean working;
> public boolean isWorking() {
> return working;
> }
> public void setWorking(boolean working) {
> this.working = working;
> }
>  
> Additionally, the text below is printed when viewing the openapi document.
> 2022-03-08 11:38:20,704 WARN  [org.apa.cam.ope.RestModelConverters] 
> (vert.x-worker-thread-0) Encountered unexpected type boolean in processing 
> schema.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to