Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #362 from h2oai/update-swagger-v2-support-openapi3
Browse files Browse the repository at this point in the history
Update swagger API v1 using OPENAPI spec 3.0
  • Loading branch information
jackjii79 authored Jun 14, 2023
2 parents 724e22b + 9c01c0f commit 3fe42f9
Show file tree
Hide file tree
Showing 19 changed files with 657 additions and 175 deletions.
4 changes: 0 additions & 4 deletions aws-lambda-scorer/lambda-template/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ dependencies {
implementation project(':common:transform')
implementation group: 'ai.h2o', name: 'mojo2-runtime-api'
implementation group: 'ai.h2o', name: 'mojo2-runtime-impl'
constraints {
// because https://app.snyk.io/vuln/SNYK-JAVA-COMMONSBEANUTILS-460111
compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
}
implementation group: 'com.amazonaws', name: 'aws-lambda-java-core'
implementation group: 'com.amazonaws', name: 'aws-lambda-java-events'
implementation group: 'com.amazonaws', name: 'aws-java-sdk-s3'
Expand Down
4 changes: 0 additions & 4 deletions aws-sagemaker-hosted-scorer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ dependencies {
implementation project(':common:transform')
implementation group: 'ai.h2o', name: 'mojo2-runtime-api'
implementation group: 'ai.h2o', name: 'mojo2-runtime-impl'
constraints {
// because https://app.snyk.io/vuln/SNYK-JAVA-COMMONSBEANUTILS-460111
compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
}
implementation group: 'io.springfox', name: 'springfox-boot-starter', version: springFoxVersion
implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
Expand Down
4 changes: 0 additions & 4 deletions common/jdbc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ dependencies {
implementation project(':common:rest-jdbc-spring-api')
implementation group: 'ai.h2o', name: 'mojo2-runtime-api'
implementation group: 'ai.h2o', name: 'mojo2-runtime-impl'
constraints {
// because https://app.snyk.io/vuln/SNYK-JAVA-COMMONSBEANUTILS-460111
compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
}
implementation group: 'ai.h2o', name: 'sparkling-water-scoring_2.12'
implementation group: 'org.scala-lang', name: 'scala-library'
implementation group: 'org.apache.spark', name: 'spark-core_2.12'
Expand Down
13 changes: 11 additions & 2 deletions common/rest-java-model/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ swaggerSources {
dependsOn validation
}
}
modelV1Exp {
inputFile = file('../swagger/v1exp/swagger.yaml')
code {
language = 'java'
configFile = file('../swagger/v1exp/swagger_codegen.json')
components = [models: true]
dependsOn validation
}
}
}

compileJava.dependsOn swaggerSources.model.code
sourceSets.main.java.srcDir "${swaggerSources.model.code.outputDir}/src/main/java"
compileJava.dependsOn swaggerSources.model.code, swaggerSources.modelV1Exp.code
sourceSets.main.java.srcDirs "${swaggerSources.model.code.outputDir}/src/main/java", "${swaggerSources.modelV1Exp.code.outputDir}/src/main/java"
2 changes: 1 addition & 1 deletion common/rest-jdbc-spring-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
apply from: project(":").file('gradle/java.gradle')

dependencies {
implementation group: 'io.swagger', name: 'swagger-annotations'
implementation group: 'io.swagger.core.v3', name: 'swagger-annotations'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
swaggerCodegen group: 'io.swagger.codegen.v3', name: 'swagger-codegen-cli'
Expand Down
15 changes: 12 additions & 3 deletions common/rest-spring-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
apply from: project(":").file('gradle/java.gradle')

dependencies {
implementation group: 'io.swagger', name: 'swagger-annotations'
implementation group: 'io.swagger.core.v3', name: 'swagger-annotations'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
swaggerCodegen group: 'io.swagger.codegen.v3', name: 'swagger-codegen-cli'
Expand All @@ -21,6 +21,15 @@ swaggerSources {
dependsOn validation
}
}
apiV1Exp {
inputFile = file('../swagger/v1exp/swagger.yaml')
code {
language = 'spring'
configFile = file('../swagger/v1exp/swagger_codegen.json')
components = [models: true, apis: true]
dependsOn validation
}
}
}

jar {
Expand All @@ -32,5 +41,5 @@ bootJar {
enabled=false
}

compileJava.dependsOn swaggerSources.api.code
sourceSets.main.java.srcDir "${swaggerSources.api.code.outputDir}/src/main/java"
compileJava.dependsOn swaggerSources.api.code, swaggerSources.apiV1Exp.code
sourceSets.main.java.srcDirs "${swaggerSources.api.code.outputDir}/src/main/java", "${swaggerSources.apiV1Exp.code.outputDir}/src/main/java"
2 changes: 1 addition & 1 deletion common/rest-vertex-ai-spring-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
apply from: project(":").file('gradle/java.gradle')

dependencies {
implementation group: 'io.swagger', name: 'swagger-annotations'
implementation group: 'io.swagger.core.v3', name: 'swagger-annotations'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
swaggerCodegen group: 'io.swagger.codegen.v3', name: 'swagger-codegen-cli'
Expand Down
8 changes: 4 additions & 4 deletions common/swagger/v1exp/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ paths:
schema:
type: object
properties:
mediaScoreRequest:
$ref: '#/components/schemas/MediaScoreRequest'
scoreMediaRequest:
$ref: '#/components/schemas/scoreMediaRequest'
files:
type: array
items:
type: string
format: binary
required:
- mediaScoreRequest
- scoreMediaRequest
- files
responses:
'200':
Expand All @@ -49,7 +49,7 @@ paths:
description: Invalid payload
components:
schemas:
MediaScoreRequest:
scoreMediaRequest:
allOf:
- $ref: '../v1/swagger.yaml#/definitions/ScoreRequest'
- properties:
Expand Down
Loading

0 comments on commit 3fe42f9

Please sign in to comment.