{
  "factory": {
    "id": "openapi-based-rest-service",
    "displayName": "SERVICE :: REST :: OPENAPI :: ABSTRACT",
    "type": "entaxy.runtime.service",
    "description": "",
    "isAbstract": true,
    "parent": "abstract-service-rest",
    "label": "service,rest,openapi",
    "category": ""
  },
  "entaxy.runtime.service": {},
  "fields": {
    "serviceTitle": {
      "displayName": "Title",
      "type": "String",
      "group": "main",
      "required": false,
      "@TYPEINFO": {
        "type": "String",
        "source": {
          "property": "schemaUrl",
          "sourceType": "resource",
          "path": "#metadata#.openapi.info.title",
          "type": "property"
        },
        "dependsOn": [
          "schemaUrl"
        ]
      }
    },
    "enableAuthorization": {
      "displayName": "Enable Authorization",
      "type": "boolean",
      "required": true,
      "group": "main",
      "defaultValue": true
    },
    "operationRouter": {
      "displayName": "Operation Router",
      "type": "xml:route",
      "required": true,
      "group": "main",
      "@RESOURCE": {
        "_provider": "entaxy-file-internal",
        "endType": "String",
        "format": "base64",
        "preprocess": [
          {
            "processor": "xslt",
            "source": "entaxy-file-internal:routes-common/service-commons.xslt",
            "parameters": {
              "serviceId": {
                "@CALCULATED": {
                  "expression": "${#OWNER#.objectId}",
                  "lazy": false
                }
              }
            }
          },
          {
            "processor": "xslt",
            "source": "entaxy-file-internal:routes-common/rest-operation-router.xslt",
            "parameters": {
              "serviceId": {
                "@CALCULATED": {
                  "expression": "${#OWNER#.objectId}",
                  "lazy": false
                }
              }
            }
          },
          {
            "processor": "xslt",
            "source": "entaxy-file-internal:routes-common/common-components.xslt",
            "parameters": {
              "serviceId": {
                "@CALCULATED": {
                  "expression": "${#OWNER#.objectId}",
                  "lazy": false
                }
              }
            }
          }
        ]
      },
      "defaultValue": {
        "@RESOURCE": {
          "provider": "service-resources",
          "location": {
            "@CALCULATED": {
              "lazy": false,
              "expression": "${#OWNER#.properties._serviceMetadata.serviceResourcesRoot}/operationRouter.xml"
            }
          },
          "endType": "String",
          "format": "base64"
        }
      },
      "@TYPEINFO": {
        "type": "resource",
        "location": "${serviceResourcesRoot}/operationRouter.xml",
        "serviceResourcesRoot": {
          "property": "schemaUrl",
          "sourceType": "resource",
          "path": "#metadata#.openapi.serviceResourcesRoot",
          "type": "property"
        },
        "dependsOn": [
          "schemaUrl"
        ]
      },
      "config": {
        "scope": "public"
      }
    },
    "_serviceMetadata": {
      "type": "Map",
      "required": true,
      "isHidden": true,
      "defaultValue": {
        "@RESOURCE_META": {
          "url": {
            "@CALCULATED": {
              "lazy": false,
              "expression": "${properties.schemaUrl}"
            }
          },
          "path": {
            "@CALCULATED": {
              "lazy": false,
              "expression": "openapi"
            }
          }
        }
      }
    },
    "@IMPORT": [
      {
        "sourceFactoryId": "service-components",
        "location": "outputs.schemaResourceBasedService.fields",
        "prefix": ""
      }
    ],
    "_parentRuntimeResources": {
      "type": "Map",
      "required": true,
      "isHidden": true,
      "defaultValue": {
        "@RESOURCE_META": {
          "url": {
            "@CALCULATED": {
              "lazy": false,
              "expression": "${properties.schemaUrl}"
            }
          },
          "path": "resource"
        }
      }
    },
    "_publishRuntimeResources": {
    	"type": "list",
	    "required": true,
	    "isHidden": true,
    	"defaultValue": {
    		"@INHERIT": {
    			"resources": "append"
    		},
    		"resources": {
    				"@CALCULATED": {
    					"lazy": false,
    					"expression": "${properties._parentRuntimeResources.generatedResources}",
    					"resultType": "list_or_single",
    					"targetPath": "$.properties.##publish.resources",
    					"mergeToTarget": true,
    					"removeResolved": true,
    					"process": {
    						"filter": "*;runtime,*;RUNTIME"
    					}
    				} 
    			}
    	}
    }
    
  },
  "outputs": {
    "init": {
      "isDefault": true,
      "generator": "",
      "config": {},
      "fields": {
        "serviceTitle": {},
        "enableAuthorization": {},
        "operationRouter": {},
        "_serviceMetadata": {},
        "_parentRuntimeResources": {},
        "_publishRuntimeResources": {},
        "schemaUrl": {
        	"displayName": "OpenApi schema",
        	"group": "main",
		    "@TYPEINFO": {
		        "filter": ["*.yaml", "*.json"]
		    }
        },
        "displayServiceSchema": {
          "group": "main"
        }
      }
    }
  }
}