summaryrefslogtreecommitdiffstats
path: root/openapi
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-04-14 11:39:12 +0000
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-04-14 11:39:12 +0000
commita29488d0f476eae0a7821026ded3cf538256757b (patch)
tree4ad1d38150cea6cea0659fed0c15d5bf05ad42fd /openapi
parenteeb1ede1a2ae8c55a4d432db80394e02506696fe (diff)
Upload preferences
Issue-ID: PORTAL-1082 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de> Change-Id: I265e0c8be481a279347aa653acc483c5017c996d
Diffstat (limited to 'openapi')
-rw-r--r--openapi/build.gradle53
-rw-r--r--openapi/src/main/resources/api/api.yml240
2 files changed, 293 insertions, 0 deletions
diff --git a/openapi/build.gradle b/openapi/build.gradle
new file mode 100644
index 0000000..01664eb
--- /dev/null
+++ b/openapi/build.gradle
@@ -0,0 +1,53 @@
+plugins {
+ id 'java'
+ id 'idea'
+ id 'org.openapi.generator' version '5.3.0'
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation 'org.openapitools:openapi-generator:5.3.0'
+ implementation 'org.springframework.boot:spring-boot-starter-webflux:2.5.5'
+ // NOTE(KE) needed to add these dependencies, check in next version whether its removable...
+ // https://github.com/OpenAPITools/openapi-generator/issues/8360
+ compileOnly "io.springfox:springfox-swagger2:3.0.0"
+}
+
+// https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/README.adoc
+openApiGenerate {
+ generatorName = "spring"
+ library = "spring-boot"
+ inputSpec = "$projectDir/src/main/resources/api/api.yml"
+ outputDir = "$buildDir/openapi"
+ configOptions = [
+ openApiNullable: "false",
+ skipDefaultInterface: "true",
+ dateLibrary: "java8",
+ interfaceOnly: "true",
+ useTags: "true",
+ useOptional: "true",
+ reactive: "true"
+ ]
+ generateApiTests = false
+ generateApiDocumentation = false
+ generateModelTests = false
+ generateModelDocumentation = false
+ invokerPackage = "org.onap.portal.prefs.openapi"
+ apiPackage = "org.onap.portal.prefs.openapi.api"
+ modelPackage = "org.onap.portal.prefs.openapi.model"
+}
+
+compileJava {
+ dependsOn tasks.openApiGenerate
+}
+
+sourceSets {
+ main {
+ java {
+ srcDirs += file("$buildDir/openapi/src/main/java")
+ }
+ }
+}
diff --git a/openapi/src/main/resources/api/api.yml b/openapi/src/main/resources/api/api.yml
new file mode 100644
index 0000000..e578911
--- /dev/null
+++ b/openapi/src/main/resources/api/api.yml
@@ -0,0 +1,240 @@
+openapi: 3.0.2
+info:
+ title: Config API
+ version: '1.0'
+servers:
+ - url: 'http://localhost:9001/{base}'
+ variables:
+ base:
+ default: 'portal-prefs'
+ description: Basepath
+paths:
+ /v1/preferences:
+ get:
+ description: Returns user preferences
+ summary: Get user preferences
+ operationId: getPreferences
+ parameters:
+ - $ref: '#/components/parameters/XRequestIdHeader'
+ tags:
+ - preferences
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Preferences'
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ '401':
+ $ref: '#/components/responses/Unauthorized'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '500':
+ $ref: '#/components/responses/InternalServerError'
+ '502':
+ $ref: '#/components/responses/BadGateway'
+ put:
+ description: Updates user preferences
+ summary: Update user preferences
+ operationId: updatePreferences
+ parameters:
+ - $ref: '#/components/parameters/XRequestIdHeader'
+ tags:
+ - preferences
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Preferences'
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Preferences'
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ '401':
+ $ref: '#/components/responses/Unauthorized'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '500':
+ $ref: '#/components/responses/InternalServerError'
+ '502':
+ $ref: '#/components/responses/BadGateway'
+ post:
+ description: Save user preferences
+ summary: Save user preferences
+ operationId: savePreferences
+ parameters:
+ - $ref: '#/components/parameters/XRequestIdHeader'
+ tags:
+ - preferences
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Preferences'
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Preferences'
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ '401':
+ $ref: '#/components/responses/Unauthorized'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '500':
+ $ref: '#/components/responses/InternalServerError'
+ '502':
+ $ref: '#/components/responses/BadGateway'
+components:
+ parameters:
+ XRequestIdHeader:
+ name: X-Request-Id
+ in: header
+ description: The unique identifier of the request
+ required: true
+ schema:
+ type: string
+ schemas:
+ Preferences:
+ type: object
+ properties:
+ properties:
+ type: object
+ required:
+ - properties
+ Problem:
+ type: object
+ properties:
+ type:
+ type: string
+ format: uri-reference
+ description: |
+ A URI reference that uniquely identifies the problem type only in the context of the provided API. Opposed to the specification in RFC-7807, it is neither recommended to be dereferencable and point to a human-readable documentation nor globally unique for the problem type.
+ default: 'about:blank'
+ example: /problem/connection-error
+ title:
+ type: string
+ description: |
+ A short summary of the problem type. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized.
+ example: Service Unavailable
+ status:
+ type: integer
+ format: int32
+ description: |
+ The HTTP status code generated by the origin server for this occurrence of the problem.
+ minimum: 100
+ maximum: 600
+ exclusiveMaximum: true
+ example: 503
+ detail:
+ type: string
+ description: |
+ A human readable explanation specific to this occurrence of the problem that is helpful to locate the problem and give advice on how to proceed. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized.
+ example: Connection to database timed out
+ instance:
+ type: string
+ format: uri-reference
+ description: |
+ A URI reference that identifies the specific occurrence of the problem, e.g. by adding a fragment identifier or sub-path to the problem type. May be used to locate the root of this problem in the source code.
+ example: /problem/connection-error#token-info-read-timed-out
+ responses:
+ BadRequest:
+ description: '400: Bad Request'
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ headers:
+ X-Request-Id:
+ schema:
+ type: string
+ description: A <uuid4> in each response
+ Unauthorized:
+ description: '401: Unauthorized'
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ headers:
+ X-Request-Id:
+ schema:
+ type: string
+ description: A <uuid4> in each response
+ Forbidden:
+ description: '403: Forbidden'
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ headers:
+ X-Request-Id:
+ schema:
+ type: string
+ description: A <uuid4> in each response
+ NotFound:
+ description: '404: Not Found'
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ headers:
+ X-Request-Id:
+ schema:
+ type: string
+ description: A <uuid4> in each response
+ NotAllowed:
+ description: '405: Method Not Allowed'
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ headers:
+ X-Request-Id:
+ schema:
+ type: string
+ description: A <uuid4> in each response
+ Conflict:
+ description: '409: Conflict'
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ headers:
+ X-Request-Id:
+ schema:
+ type: string
+ description: A <uuid4> in each response
+ InternalServerError:
+ description: Internal Server Error
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ headers:
+ X-Request-Id:
+ schema:
+ type: string
+ description: A <uuid4> in each response
+ BadGateway:
+ description: Bad Gateway
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ headers:
+ X-Request-Id:
+ schema:
+ type: string
+ description: A <uuid4> in each response