feat: configured gradle file to generate code for api interface from swagger specification
All checks were successful
CI / build (push) Successful in 11s

This commit is contained in:
MAILLAL Anas 2025-02-19 01:36:52 +01:00
parent ef8c8e896d
commit 79e949bdd4
2 changed files with 75 additions and 90 deletions

View File

@ -2,6 +2,7 @@ plugins {
id 'java' id 'java'
id 'org.springframework.boot' version '3.4.2' id 'org.springframework.boot' version '3.4.2'
id 'io.spring.dependency-management' version '1.1.7' id 'io.spring.dependency-management' version '1.1.7'
id 'org.openapi.generator' version '7.11.0'
} }
group = 'enseirb' group = 'enseirb'
@ -20,8 +21,39 @@ repositories {
dependencies { dependencies {
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
// swagger Codegen
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0'
implementation 'jakarta.validation:jakarta.validation-api:3.0.2'
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
sourceSets {
main {
java {
srcDir "$buildDir/generated/src/main/java"
}
}
}
sourceSets {
main {
java.srcDir("$buildDir/generated/src/main/java")
}
}
openApiGenerate {
generatorName.set("spring")
inputSpec.set("$rootDir/src/main/resources/openapi.yaml")
outputDir.set("$buildDir/generated")
apiPackage.set("enseirb.myinpulse.api")
modelPackage.set("enseirb.myinpulse.model")
configOptions.put("dateLibrary", "java8")
configOptions.put("useSpringBoot3", "true")
//configOptions.put("interfaceOnly", "true")
configOptions.put("library", "spring-boot")
} }
tasks.named('test') { tasks.named('test') {

View File

@ -15,22 +15,24 @@ tags:
components: components:
schemas: schemas:
founder: user:
type: object
properties:
nom:
type: string
prenom:
type: string
email:
type: string
scondaryEmail:
type: string
tel:
type: string
user-entrepreneur:
type: object type: object
properties: properties:
user: user:
type: object $ref: "#/components/schemas/user"
properties:
nom:
type: string
prenom:
type: string
email:
type: string
scondaryEmail:
type: string
tel:
type: string
entrepreneur: entrepreneur:
type: object type: object
properties: properties:
@ -40,6 +42,11 @@ components:
type: string type: string
status: status:
type: string type: string
user-admin:
type: object
properties:
admin:
$ref: "#/components/schemas/user"
securitySchemes: securitySchemes:
MyINPulse: MyINPulse:
@ -139,13 +146,13 @@ paths:
name: name:
type: string type: string
founder: founder:
$ref: "#/components/schemas/founder" $ref: "#/components/schemas/user-entrepreneur"
"400": "400":
description: Bad request description: Bad request
"401": "401":
description: Authorization information is missing or invalid description: Authorization information is missing or invalid
/projects/lcsection/{projectId}/{title}/{date}: /shared/projects/lcsection/{projectId}/{title}/{date}:
get: get:
summary: Retourne la liste de sections de LC avec un titre donné summary: Retourne la liste de sections de LC avec un titre donné
tags: tags:
@ -173,7 +180,7 @@ paths:
description: the name of lc section description: the name of lc section
- in: path - in: path
name: date name: date
required: true required: false
schema: schema:
type: string type: string
description: the date corresponding to the wanted version of lc section description: the date corresponding to the wanted version of lc section
@ -198,7 +205,7 @@ paths:
"401": "401":
description: Authorization information is missing or invalid description: Authorization information is missing or invalid
/projects/entrepreneurs/{projectId}: /shared/projects/entrepreneurs/{projectId}:
get: get:
summary: Retourne la liste d'entrepreneurs associée à un projet donné summary: Retourne la liste d'entrepreneurs associée à un projet donné
tags: tags:
@ -224,14 +231,15 @@ paths:
schema: schema:
type: array type: array
items: items:
type: string $ref: "#/components/schemas/user-entrepreneur"
"400": "400":
description: Bad request description: Bad request
"401": "401":
description: Authorization information is missing or invalid description: Authorization information is missing or invalid
/projects/contacts/entrepreneurs/{projectId}:
/shared/projects/admin/{projectId}:
get: get:
summary: Retourne la liste des contactes d'entrepreneurs associée à un projet donné summary: Retourne les inforùations de l'admin qui accompagne le projet
tags: tags:
- Shared API - Shared API
security: security:
@ -239,9 +247,8 @@ paths:
- MyINPulse-admin - MyINPulse-admin
- MyINPulse-entrepreneur - MyINPulse-entrepreneur
description: description:
JSON array of contacts for JSON object containing information (name, gmail, tel, etc..)
each participant in the project with id the admin supervising the project with id projectID.
projectID.
parameters: parameters:
- in: path - in: path
name: projectId name: projectId
@ -254,64 +261,16 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: array $ref: "#/components/schemas/user-admin"
items:
type: object
properties:
name:
type: string
email:
type: string
tel:
type: string
"400": "400":
description: Bad request description: Bad request
"401": "401":
description: Authorization information is description: Authorization information is
missing or invalid missing or invalid
/projects/contacts/admin/{projectId}: /shared/projects/appointments/{projectId}:
get: get:
summary: Retourne les contacts de l'admin que accompagne le projet summary: Retourne les rendez-vous du projet
tags:
- Shared API
security:
- MyINPulse:
- MyINPulse-admin
- MyINPulse-entrepreneur
description:
JSON object containing contact information (name, gmail, tel, etc..)
the admin supervising the project with id
projectID.
parameters:
- in: path
name: projectId
schema:
type: integer
required: true
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
name:
type: string
email:
type: string
tel:
type: string
"400":
description: Bad request
"401":
description: Authorization information is
missing or invalid
/projects/appointments/{projectId}:
get:
summary: Retourne les rendez-vous du project
tags: tags:
- Shared API - Shared API
security: security:
@ -350,7 +309,7 @@ paths:
"401": "401":
description: Authorization information is description: Authorization information is
missing or invalid missing or invalid
/projects/appointments/report/{apointementId}: /shared/projects/appointments/report/{apointementId}:
get: get:
summary: Retourne le rapport pdf du rendez-vous summary: Retourne le rapport pdf du rendez-vous
tags: tags:
@ -382,7 +341,7 @@ paths:
description: Authorization information is description: Authorization information is
missing or invalid missing or invalid
/projects/request: /entrepreneur/projects/request:
post: post:
summary: demander la création et validation d'un projet summary: demander la création et validation d'un projet
tags: tags:
@ -404,7 +363,7 @@ paths:
name: name:
type: string type: string
founder: founder:
$ref: "#/components/schemas/founder" $ref: "#/components/schemas/user-entrepreneur"
responses: responses:
"200": "200":
description: OK description: OK
@ -470,12 +429,8 @@ paths:
properties: properties:
name: name:
type: string type: string
founderName: founder:
type: string $ref: "#/components/schemas/user-entrepreneur"
founderEmail:
type: string
school:
type: string
responses: responses:
"200": "200":
@ -513,7 +468,7 @@ paths:
description: Authorization information is description: Authorization information is
missing or invalid missing or invalid
/lcsection/add/{projectId}: /entrepreneur/lcsection/add/{projectId}:
post: post:
summary: ajouter une sections au LC summary: ajouter une sections au LC
description: description:
@ -549,7 +504,7 @@ paths:
"401": "401":
description: Authorization information is description: Authorization information is
missing or invalid missing or invalid
/lcsection/modify/{sectionId}: /entrepreneur/lcsection/modify/{sectionId}:
put: put:
summary: modifier les données d'une section LC summary: modifier les données d'une section LC
description: description:
@ -587,7 +542,7 @@ paths:
description: Authorization information is description: Authorization information is
missing or invalid missing or invalid
/lcsection/remove/{sectionId}: /entrepreneur/lcsection/remove/{sectionId}:
delete: delete:
summary: supprimer une section LC. summary: supprimer une section LC.
description: description:
@ -612,7 +567,7 @@ paths:
description: Authorization information is description: Authorization information is
missing or invalid missing or invalid
/appointments/request: /shared/appointments/request:
post: post:
summary: demander une rendez-vous summary: demander une rendez-vous
description: description:
@ -696,6 +651,4 @@ paths:
"401": "401":
description: Authorization information is description: Authorization information is
missing or invalid missing or invalid