Skip to content
Snippets Groups Projects
Unverified Commit 10c22c42 authored by Matej Hrica's avatar Matej Hrica
Browse files

Add openapi to authorization

parent 0fdf0c72
No related branches found
No related tags found
No related merge requests found
openapi: 3.0.3
info:
title: Airport Manager authorization microservice
description: Airport Manager authorization microservice
version: 1.0.0
servers:
- url: "{scheme}://{server}:{port}"
description: my server
variables:
scheme:
default: http
enum:
- http
- https
server:
default: localhost
port:
default: "8083"
paths:
/api/users/{id}:
get:
tags:
- User
summary: Get user by id.
description: Returns an object representing an user.
operationId: getUserById
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/UserDto'
"404":
description: Not Found
components:
schemas:
DomainEntity:
title: Domain Entity
description: Represents a Domain Entity
type: object
required:
- id
properties:
id:
type: integer
description: unique id
format: int64
example: 1
discriminator:
propertyName: objectType
UserDto:
allOf:
- $ref: '#/components/schemas/DomainEntity'
type: object
title: Steward
description: Represents a steward on a flight.
required:
- id
- firstName
- lastName
properties:
firstName:
type: string
description: first name of a the user
example: John
lastName:
type: string
description: last name of a user
example: Doe
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>cz.muni.fi.pa165</groupId> <groupId>cz.muni.fi.pa165</groupId>
<artifactId>airport-manager</artifactId> <artifactId>airport-manager</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>authorization</artifactId> <artifactId>authorization</artifactId>
<name>authorization</name> <name>authorization</name>
<description>Authorization service for Airport Manager</description> <description>Authorization service for Airport Manager</description>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>com.h2database</groupId>
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.mapstruct</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>mapstruct</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mapstruct</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>mapstruct</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>jakarta.annotation</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>jakarta.annotation-api</artifactId>
<scope>test</scope> </dependency>
</dependency>
</dependencies> <dependency>
<groupId>jakarta.validation</groupId>
<build> <artifactId>jakarta.validation-api</artifactId>
<plugins> </dependency>
<plugin>
<groupId>org.springframework.boot</groupId> <dependency>
<artifactId>spring-boot-maven-plugin</artifactId> <groupId>io.swagger.core.v3</groupId>
</plugin> <artifactId>swagger-models-jakarta</artifactId>
</plugins> </dependency>
</build>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<!-- for pagination from JPA without actually using JPA -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<!-- for testing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/openapi.yaml</inputSpec>
<generatorName>spring</generatorName>
<apiPackage>cz.muni.fi.pa165.authorization.server.api</apiPackage>
<modelPackage>cz.muni.fi.pa165.authorization.server.model</modelPackage>
<!-- https://openapi-generator.tech/docs/generators/spring -->
<configOptions>
<basePackage>cz.muni.fi.pa165.authorization.server</basePackage>
<configPackage>cz.muni.fi.pa165.authorization.server.config</configPackage>
<useSpringBoot3>true</useSpringBoot3>
<useTags>true</useTags>
<delegatePattern>true</delegatePattern>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project> </project>
package cz.muni.fi.pa165.authorization;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class AuthorizationApplication {
public static void main(String[] args) {
SpringApplication.run(AuthorizationApplication.class, args);
}
}
package cz.muni.fi.pa165.authorization; package cz.muni.fi.pa165.authorization.server;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
...@@ -8,6 +8,6 @@ class AuthorizationApplicationTests { ...@@ -8,6 +8,6 @@ class AuthorizationApplicationTests {
@Test @Test
void contextLoads() { void contextLoads() {
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment