All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mapping.v9.mapping.yaml.json Maven / Gradle / Ivy

There is a newer version: 2024.6.1
Show newest version
{
  "$id": "https://openapiprocessor.io/schemas/mapping/mapping-v9.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "JSON Schema for openapi-processor mapping.yaml v9",
  "description": "openapi-processor configuration and type mappings",
  "type": "object",
  "properties": {
    "openapi-processor-mapping": {
      "description": "version of the mapping format.",
      "enum": ["v9"]
    },
    "options": {
      "$ref": "#/definitions/Options"
    },
    "compatibility": {
      "$ref": "#/definitions/Compatibility"
    },
    "map": {
      "$ref": "#/definitions/Map"
    }
  },
  "required": [
    "openapi-processor-mapping",
    "options"
  ],
  "definitions": {
    "Options": {
      "description": "general processor configuration options.",
      "type": "object",
      "properties": {
        "package-name": {
          "description": "java root package name to use in the generated source files.",
          "type": "string",
          "default": "io.openapiprocessor.generated"
        },
        "bean-validation": {
          "description": "enable bean validation annotations for OpenAPI constraints.",
          "default": false,
          "enum": [false, true, "javax", "jakarta"]
        },
        "javadoc": {
          "description": "generate javadoc from OpenAPI 'description' properties.",
          "type": "boolean",
          "default": false
        },
        "model-name-suffix": {
          "description": "suffix for model class names and enum names. Default is none, i.e. an empty string.",
          "type": "string",
          "default": "",
          "examples": [
            "Resource", "Dto"
          ]
        },
        "model-type": {
          "description": "generate pojo or record based models. Default is default, i.e. classic pojos.",
          "default": "default",
          "enum": ["default", "record"]
        },
        "enum-type": {
          "description": "generate default enum, string or framework enum. Default is default.",
          "default": "default",
          "enum": ["default", "string", "framework"]
        },
        "one-of-interface": {
          "description": "generate common interface for a `oneOf` object list.",
          "type": "boolean",
          "default": false
        },
        "format-code": {
          "description": "enable/disable code formatting.",
          "type": "boolean",
          "default": true
        },
        "generated-annotation": {
          "description": "enable/disable the @Generated annotation.",
          "type": "boolean",
          "default": true
        },
        "generated-date": {
          "description": "enable/disable generated date on the @Generated annotation.",
          "type": "boolean",
          "default": true
        },
        "clear-target-dir": {
          "description": "enable/disable deletion of targetDir. (overridden by target-dir.clear)",
          "type": "boolean",
          "default": true
        },
        "json-property-annotation": {
          "description": "generate @JsonProperty annotation.",
          "default": "always",
          "enum": ["always", "auto", "never"]
        },
        "target-dir": {
          "description": "target-dir related options",
          "type": "object",
          "properties": {
            "clear": {
              "description": "enable/disable deletion of targetDir.",
              "type": "boolean",
              "default": true
            },
            "layout": {
              "description": "target dir layout. classic: targetDir/packages, standard: targetDir/java/packages & targetDir/resources",
              "default": "classic",
              "enum": ["classic", "standard"]
            }
          }
        },
        "base-path": {
          "description": "base-path related options",
          "type": "object",
          "properties": {
            "server-url": {
              "description": "index of the OpenAPI 'server.url' that is used as base path. Default is 'false', i.e. no prefix. 'true' == 0",
              "default": false,
              "type": ["boolean", "integer"],
              "minimum": 0,
              "examples": [
                "true", "false", "0", "1"
              ]
            },
            "properties-name": {
              "description": "name of the resource properties file with the base path configuration",
              "default": "api.properties",
              "examples": ["api.properties", "openapi.properties"]
            }
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "package-name"
      ]
    },
    "Compatibility": {
      "description": "backward compatibility options.",
      "type": "object",
      "properties": {
        "bean-validation-valid-on-reactive": {
          "description": "add bean validation @Valid annotation to reactive types.",
          "type": "boolean",
          "default": true
        },
        "identifier-word-break-from-digit-to-letter": {
          "description": "identifier word break when switching from digits to letters.",
          "type": "boolean",
          "default": true
        }
      }
    },
    "Map": {
      "description": "global & path specific mapping rules.",
      "allOf": [{
          "$ref": "#/definitions/Mappings"
        }, {
          "properties": {
            "paths": {
              "$ref": "#/definitions/Paths"
            }
          }
        }, {
          "properties": {
            "extensions": {
              "$ref": "#/definitions/Extensions"
            }
          }
      }]
    },
    "Mappings": {
      "description": "mapping rules.",
      "type": "object",
      "properties": {
        "result": {
          "$ref": "#/definitions/ResultMapping"
        },
        "result-style": {
          "$ref": "#/definitions/ResultStyleMapping"
        },
        "single": {
          "$ref": "#/definitions/SingleMapping"
        },
        "multi": {
          "$ref": "#/definitions/MultiMapping"
        },
        "null": {
          "$ref": "#/definitions/NullMapping"
        },
        "types": {
          "$ref": "#/definitions/TypeMappings"
        },
        "parameters": {
          "$ref": "#/definitions/ParameterMappings"
        },
        "responses": {
          "$ref": "#/definitions/ResponseMappings"
        }
      }
    },
    "Paths": {
      "description": "path specific mappings.",
      "type": "object",
      "patternProperties": {
        "^/": {
          "description": "a path.",
          "allOf": [{
              "$ref": "#/definitions/Exclude"
            }, {
              "$ref": "#/definitions/Mappings"
            }, {
              "$ref": "#/definitions/Methods"
          }]
        }
      }
    },
    "Extensions": {
      "description": "x-extensions annotation mapping rules.",
      "type": "object",
      "patternProperties": {
        "^x-": {
          "description": "an extension with a single value or a list of values.",
          "anyOf": [{
            "$ref": "#/definitions/AnnotationMappingFormat"
          }, {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/definitions/AnnotationMappingFormat"
            }
          }]
        }
      }
    },
    "Methods": {
      "description": "http method mapping rules.",
      "type": "object",
      "properties": {
        "get": {
          "$ref": "#/definitions/Mappings"
        },
        "put": {
          "$ref": "#/definitions/Mappings"
        },
        "post": {
          "$ref": "#/definitions/Mappings"
        },
        "delete": {
          "$ref": "#/definitions/Mappings"
        },
        "options": {
          "$ref": "#/definitions/Mappings"
        },
        "head": {
          "$ref": "#/definitions/Mappings"
        },
        "patch": {
          "$ref": "#/definitions/Mappings"
        },
        "trace": {
          "$ref": "#/definitions/Mappings"
        }
      }
    },
    "ResultMapping": {
      "description": "wrapper object of a http response.",
      "type": "string",
      "examples": [
        "org.springframework.http.ResponseEntity", "plain"
      ]
    },
    "ResultStyleMapping": {
      "description": "result style of a http response. 'success' uses success (ok) response type, 'all' uses Object/? type.",
      "type": "string",
      "default": "success",
      "examples": [
        "all",
        "success"
      ]
    },
    "SingleMapping": {
      "description": "reactive wrapper of single types.",
      "type": "string",
      "examples": [
        "reactor.core.publisher.Mono"
      ]
    },
    "MultiMapping": {
      "description": "reactive wrapper of array types.",
      "type": "string",
      "examples": [
        "core.publisher.Flux"
      ]
    },
    "NullMapping": {
      "description": "null wrapper of 'nullable' object properties.",
      "type": "string",
      "examples": [
        "org.openapitools.jackson.nullable.JsonNullable",
        "org.openapitools.jackson.nullable.JsonNullable = JsonNullable.undefined()"
      ]
    },
    "TypeMappings": {
      "description": "basic type mappings.",
      "type": "array",
      "minItems": 1,
      "items": [{
        "description": "maps a schema to a a Java type.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "type": {
              "anyOf": [{
                "$ref": "#/definitions/TypeMappingFormat"
              }, {
                "$ref": "#/definitions/AnnotationMappingFormat"
              }]
          },
          "generics": {
            "$ref": "#/definitions/TypeMappingGenerics"
          }
        }
      }]
    },
    "ParameterMappings": {
      "description": "parameter type mappings.",
      "type": "array",
      "minItems": 1,
      "items": [{
        "description": "maps a parameter name to a Java type.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "anyOf": [{
              "$ref": "#/definitions/TypeMappingFormat"
            }, {
              "$ref": "#/definitions/AnnotationMappingFormat"
            }]
          },
          "add": {
            "$ref": "#/definitions/TypeMappingFormat"
          },
          "type": {
            "anyOf": [{
              "$ref": "#/definitions/TypeMappingFormat"
            }, {
              "$ref": "#/definitions/AnnotationMappingFormat"
            }]
          },
          "generics": {
            "$ref": "#/definitions/TypeMappingGenerics"
          }
        }
      }],
      "required": [
        "name"
      ],
      "examples": [
        "foo => io.openapiprocessor.Foo"
      ]
    },
    "ResponseMappings": {
      "description": "response (content) type mappings.",
      "type": "array",
      "minItems": 1,
      "items": {
        "description": "maps a content type to a Java type.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "content": {
            "$ref": "#/definitions/TypeMappingFormat"
          },
          "generics": {
            "$ref": "#/definitions/TypeMappingGenerics"
          }
        },
        "required": [
          "content"
        ],
        "examples": [
          "application/json => io.openapiprocessor.Foo"
        ]
      }
    },
    "Exclude": {
      "description": "generate endpoint to a separate 'Excluded' interface.",
      "type": "object",
      "properties": {
        "exclude": {
          "type": "boolean"
        }
      }
    },
    "TypeMappingFormat": {
      "description": "schema => fully qualified Java type.",
      "type": "string",
      "pattern": "^.+\\s+=>\\s+.+$",
      "examples": [
        "array => java.util.Collection",
        "FooSchema => io.openapiprocessor.Foo"
      ]
    },
    "AnnotationMappingFormat": {
      "description": "target @ fully qualified Java type with optional parameters.",
      "type": "string",
      "pattern": "^.+\\s+@\\s+.+$",
      "examples": [
        "FooSchema @ some.Annotation",
        "FooSchema @ some.Annotation(\"bar\")",
        "FooSchema @ some.Annotation(value = \"bar\", bar = 5)",
        "property name @ some.Annotation"
      ]
    },
    "TypeMappingGenerics": {
      "description": "fully qualified Java types used as generic parameters of the type mapping.",
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy