codeconsole commented on PR #16275:
URL: https://github.com/apache/grails-core/pull/16275#issuecomment-5874512673

   Thanks. All three are fixed at 9ab310da75, and your `ReviewRegressionSpec` 
passes unmodified (6/6). Each of its cases is also in the module's specs, with 
the same annotations and assertions.
   
   **1. Nullable reference** (3a71b8fa2d). A reference its `@Schema` makes 
nullable now takes the path a nullable constraint does:
   - in 3.1, `oneOf` the reference and a `null` type;
   - in 3.0, `allOf` the reference with `nullable: true`.
   
   That also fixed a reference both the annotation and the constraint make 
nullable. The reference inside the `oneOf` still carried swagger-core's `type: 
"null"`, giving `oneOf: [{type: null, $ref}, {type: null}]`. 
`AnnotatedPropertySpec` compares whole property maps in both versions, for four 
cases: a `Validateable`, a plain class, one with a description, and one made 
nullable both ways.
   
   **2. Numeric values** (9755d73b53, 9ab310da75). This turned out broader than 
the declared `type`. In swagger-core's 3.1 path:
   - `AnnotationsUtils.addTypeWhenSiblingsAllowed` resolves the property as 
`ctxSchema.type().getClass()`, which is `String`;
   - `JsonSchema.cast` converts neither an integer nor a fractional number;
   - `setEnum` doesn't cast at all.
   
   So resolving with the declared type honored wouldn't have been enough. A 
plain `@Schema(allowableValues = ['1', '2']) Integer rank`, with no `type`, was 
also written as `enum: ["1", "2"]` in 3.1, and a `BigDecimal` default as 
`"1.5"`. Now the `enum`, `default`, `example` and `const` of a schema 
describing one integer, number or boolean type are written as that type. That 
applies to properties and to the schemas an operation annotation declares.
   
   Two more turned up on the way:
   - A response or body schema an annotation declares by its type alone kept 
string values in 3.0 too, since swagger-core builds it as a generic `Schema`.
   - A parameter declared on the action, such as `@Parameter(name = 'band', 
schema = @Schema(type = 'integer'))`, was written as `type: string` in both 
versions. It was resolved as `String` unless it named an `implementation`; now 
it's resolved as the class of its declared type and format (9755d73b53).
   
   **3. Controller success** (ff6c850420). A success status the controller 
declares is no longer counted among the derived codes. So the controller's 
`200` stays beside the action's `202`, whether the action declares it directly 
or in `@Operation(responses)`. The guide says so.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to