Skip to content

Add support for the new requiredMode to replace required #962

@swaechter

Description

@swaechter

Problem

Swagger Core deprecated the required field in Schema with requiredMode. For more information see swagger-api/swagger-core#4286 . Upgrading to the latest Micronaut OpenAPI + Swagger OpenAPI core version marks this field as deprecated:

Bug11_1

Switching to the new annotation value makes the compiler happy (No warning):

Bug11_2

But this new annotation value isn't picked up by Micronaut OpenAPI, so the required field in the generated OpenAPI file is dropped, which leads to a compiler error in our TypeScript frontend (The value is now undefined):

Bug11_3

Solution

Is it possible to add support for requiredMode which takes precedence over required? There was another annotation value that was deprecated but I can't remember.

Example

You can reproduce the problem with bug 11 in https://github.com/swaechter/openapiproblems

Version

  • Platform: Linux Debian
  • Java: OpenJDK 64-Bit Server VM (build 17.0.4+8-Debian-1deb11u1, mixed mode, sharing)
  • Micronaut Application Gradle Plugin: 3.7.2
  • Micronaut Version: 3.8.7

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