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

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

There is a newer version: 2024.6.1
Show newest version
{
  "$id": "https://openapiprocessor.io/schemas/mapping/mapping-v2.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "JSON Schema for openapi-processor mapping.yaml v2",
  "description": "openapi-processor configuration and type mappings",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "openapi-processor-mapping": {
      "description": "version of the mapping format.",
      "type": "string",
      "enum": ["v2"]
    },
    "options": {
      "$ref": "#/definitions/Options"
    },
    "map": {
      "$ref": "#/definitions/Map"
    }
  },
  "required": [
    "openapi-processor-mapping",
    "options"
  ],
  "definitions": {
    "Options": {
      "description": "general processor configuration options.",
      "type": "object",
      "additionalProperties": false,
      "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.",
          "type": "boolean",
          "default": false
        },
        "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"
          ]
        },
        "one-of-interface": {
          "description": "generate common interface for an `oneOf` object list.",
          "type": "boolean",
          "default": false
        },
        "format-code": {
          "description": "enable/disable code formatting.",
          "type": "boolean",
          "default": true
        }
      }
    },
    "Map": {
      "description": "global & path specific mapping rules.",
      "anyOf": [{
          "$ref": "#/definitions/Mappings"
        }, {
          "additionalProperties": false,
          "properties": {
            "paths": {
              "$ref": "#/definitions/Paths"
            }
          }
        }
      ]
    },
    "Paths": {
      "description": "path specific mappings.",
      "type": "object",
      "patternProperties": {
        "^/": {
          "description": "a path.",
          "anyOf": [{
              "$ref": "#/definitions/Exclude"
            }, {
              "$ref": "#/definitions/Mappings"
            }, {
              "$ref": "#/definitions/Methods"
          }]
        }
      }
    },
    "Mappings": {
      "description": "mapping rules.",
      "type": "object",
      "additionalProperties": false,
      "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": {
          "$ref": "#/definitions/Paths"
        }
      }
    },
    "Methods": {
      "description": "http method mapping rules.",
      "type": "object",
      "additionalProperties": false,
      "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"
      ]
    },
    "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": {
            "$ref": "#/definitions/TypeMappingFormat"
          },
          "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": {
            "$ref": "#/definitions/TypeMappingFormat"
          },
          "add": {
            "$ref": "#/definitions/TypeMappingFormat"
          },
          "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",
      "additionalProperties": false,
      "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"
      ]
    },
    "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