Class ParameterMappingModel

java.lang.Object
io.micronaut.gradle.openapi.ParameterMappingModel
All Implemented Interfaces:
Serializable

public final class ParameterMappingModel extends Object implements Serializable
A model that can be used to specify parameter mappings during the OpenAPI gneration

An equivalent to Micronaut OpenAPI's ParameterMapping but without using classes from that dependency so that we can isolate execution in workers.

See Also:
  • Constructor Details

    • ParameterMappingModel

      public ParameterMappingModel(String name, ParameterMappingModel.ParameterLocation location, String mappedType)
      Create a prameter mapping
      Parameters:
      name - The name of the parameter as described by the name field in specification.
      location - The location of parameter. Path parameters cannot be mapped, as this behavior should not be used.
      mappedType - The type to which the parameter should be mapped. If multiple parameters have the same mapping, only one parameter will be present. If set to null, the original parameter will simply be deleted. The type should contain the package name if required.
  • Method Details

    • withName

      public ParameterMappingModel withName(String name)
      Specify the name of the parameter to trigger the mapping. The name should correspond to a field name in the OpenAPI specification.
      Parameters:
      name - the name
      Returns:
      new instance with the updated name
    • withLocation

      Specify the location of the parameter that triggers the mapping.
      Parameters:
      location - the name
      Returns:
      new instance with the updated location
    • withMappedType

      public ParameterMappingModel withMappedType(String mappedType)
      Specify the fully-qualified type to which the parameter will be mapped .
      Parameters:
      mappedType - the type
      Returns:
      new instance with the updated mapped type
    • withMappedName

      public ParameterMappingModel withMappedName(String mappedName)
      Specify the unique name of the parameter to be used as method parameter name.
      Parameters:
      mappedName - the name
      Returns:
      new instance with the name specified
    • withValidated

      public ParameterMappingModel withValidated(boolean isValidated)
      Specify whether the parameter requires validation.
      Parameters:
      isValidated - the value
      Returns:
      new instance with the validation requirement specified
    • getName

      public String getName()
    • getLocation

    • getMappedType

      public String getMappedType()
    • getMappedName

      public String getMappedName()
    • isValidated

      public boolean isValidated()