{
    "openapi": "3.0.0",
    "info": {
        "title": "rAPP Catalogue API",
        "description": "The Non RT-RIC Service Catalogue provides a way for services to register themselves for other services to discover.",
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "/"
        }
    ],
    "paths": {
        "/services": {
            "get": {
                "summary": "Services",
                "deprecated": false,
                "operationId": "getServices",
                "responses": {
                    "200": {
                        "description": "Services",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/service"
                                    }
                                }
                            }
                        }
                    }
                },
                "tags": [
                    "rAPP Catalogue API"
                ]
            }
        },
        "/services/{serviceName}": {
            "get": {
                "summary": "Individual Service",
                "deprecated": false,
                "operationId": "getIndividualService",
                "responses": {
                    "200": {
                        "description": "Service",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/service"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Service is not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/error_information"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "in": "path",
                        "name": "serviceName",
                        "description": "serviceName",
                        "schema": {
                            "type": "string"
                        },
                        "required": true,
                        "example": "DroneIdentifier"
                    }
                ],
                "tags": [
                    "rAPP Catalogue API"
                ]
            },
            "put": {
                "summary": "Create or update a Service",
                "deprecated": false,
                "operationId": "putIndividualService",
                "responses": {
                    "200": {
                        "description": "Service updated"
                    },
                    "201": {
                        "description": "Service created",
                        "headers": {
                            "Location": {
                                "schema": {
                                    "type": "string"
                                },
                                "description": "URL to the created Service"
                            }
                        }
                    },
                    "400": {
                        "description": "Provided service is not correct",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/error_information"
                                },
                                "example": {
                                    "detail": "Service is missing required property: version",
                                    "status": 400
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "serviceName",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "DroneIdentifier"
                    }
                ],
                "requestBody": {
                    "description": "Service to create/update",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputService"
                            }
                        }
                    }
                },
                "tags": [
                    "rAPP Catalogue API"
                ]
            },
            "delete": {
                "summary": "Remove a Service from the catalogue",
                "deprecated": false,
                "operationId": "deleteIndividualService",
                "responses": {
                    "204": {
                        "description": "Service deleted"
                    }
                },
                "parameters": [
                    {
                        "name": "serviceName",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "DroneIdentifier"
                    }
                ],
                "tags": [
                    "rAPP Catalogue API"
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "inputService": {
                "description": "A Service to register",
                "type": "object",
                "title": "inputService",
                "required": [
                    "version"
                ],
                "properties": {
                    "version": {
                        "description": "Version of the Service",
                        "type": "string",
                        "example": "1.0.0"
                    },
                    "display_name": {
                        "description": "Display name for the Service",
                        "type": "string",
                        "example": "Drone Identifier"
                    },
                    "description": {
                        "description": "Description of the Service",
                        "type": "string",
                        "example": "Detects if a UE is a drone"
                    }
                }
            },
            "service": {
                "description": "A Service",
                "type": "object",
                "title": "service",
                "required": [
                    "name",
                    "version",
                    "registrationDate"
                ],
                "properties": {
                    "name": {
                        "description": "Unique identifier of the Service",
                        "type": "string",
                        "example": "DroneIdentifier"
                    },
                    "version": {
                        "description": "Version of the Service",
                        "type": "string",
                        "example": "1.0.0"
                    },
                    "display_name": {
                        "description": "Display name for the Service",
                        "type": "string",
                        "example": "Drone Identifier"
                    },
                    "description": {
                        "description": "Description of the Service",
                        "type": "string",
                        "example": "Detects if a UE is a drone"
                    },
                    "registrationDate": {
                        "description": "Date when the Service was registered in the catalogue",
                        "type": "string",
                        "example": "2020-11-03"
                    }
                }
            },
            "error_information": {
                "description": "Problem as defined in https://tools.ietf.org/html/rfc7807",
                "type": "object",
                "title": "error_information",
                "properties": {
                    "detail": {
                        "description": "A human-readable explanation specific to this occurrence of the problem.",
                        "type": "string",
                        "example": "Service not found"
                    },
                    "status": {
                        "format": "int32",
                        "description": "The HTTP status code for this occurrence of the problem.",
                        "type": "integer",
                        "example": 404
                    }
                }
            }
        }
    }
}
