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

Commit

Permalink
compile v1exp, leave v1 - openapi3 as reference in openapi 3 spec
Browse files Browse the repository at this point in the history
  • Loading branch information
jih147 committed Jun 13, 2023
1 parent dca546a commit 9c01c0f
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 23 deletions.
10 changes: 5 additions & 5 deletions common/rest-java-model/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ swaggerSources {
dependsOn validation
}
}
modelV2 {
inputFile = file('../swagger/v2/swagger.yaml')
modelV1Exp {
inputFile = file('../swagger/v1exp/swagger.yaml')
code {
language = 'java'
configFile = file('../swagger/v2/swagger_codegen.json')
configFile = file('../swagger/v1exp/swagger_codegen.json')
components = [models: true]
dependsOn validation
}
}
}

compileJava.dependsOn swaggerSources.model.code, swaggerSources.modelV2.code
sourceSets.main.java.srcDirs "${swaggerSources.model.code.outputDir}/src/main/java", "${swaggerSources.modelV2.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"
10 changes: 5 additions & 5 deletions common/rest-spring-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ swaggerSources {
dependsOn validation
}
}
apiV2 {
inputFile = file('../swagger/v2/swagger.yaml')
apiV1Exp {
inputFile = file('../swagger/v1exp/swagger.yaml')
code {
language = 'spring'
configFile = file('../swagger/v2/swagger_codegen.json')
configFile = file('../swagger/v1exp/swagger_codegen.json')
components = [models: true, apis: true]
dependsOn validation
}
Expand All @@ -41,5 +41,5 @@ bootJar {
enabled=false
}

compileJava.dependsOn swaggerSources.api.code, swaggerSources.apiV2.code
sourceSets.main.java.srcDirs "${swaggerSources.api.code.outputDir}/src/main/java", "${swaggerSources.apiV2.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"
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
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
openapi: '3.0.0'
info:
title: Scoring API - v2
title: Scoring API - v1.2.0-openapi3
description: >-
This is a definition of the REST API for scoring from H2O.
This API is intended to be used within DAI and eventually across all H2O scoring systems.
This API combines both v1 and v1Exp in OPENAPI 3.0 spec.
contact:
email: [email protected]
license:
name: License
url: 'http://www.h2o.ai'
version: 1.3.0
version: 1.2.0-openapi3
servers:
- url: /
paths:
Expand Down Expand Up @@ -160,6 +161,40 @@ paths:
description: Implementation not supported
content: {}
x-codegen-request-body-name: payload
/model/media-score:
post:
tags:
- scoring
summary: Score model with provided media files
description: Computes score of provided data making use of provided media files.
operationId: getMediaScore
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
scoreMediaRequest:
$ref: '#/components/schemas/scoreMediaRequest'
files:
type: array
items:
type: string
format: binary
required:
- scoreMediaRequest
- files
responses:
'200':
description: Successful scoring operation
content:
application/json:
schema:
$ref: '#/components/schemas/ScoreResponse'
'501':
description: Implementation not supported
'400':
description: Invalid payload
components:
schemas:
Model:
Expand Down Expand Up @@ -365,6 +400,18 @@ components:
type: array
items:
$ref: '#/components/schemas/Row'
scoreMediaRequest:
allOf:
- $ref: '#/components/schemas/ScoreRequest'
- properties:
mediaFields:
description: >
An array holding the names of all fields which are expected to contain media files.
Contents of these fields will be replaced by corresponding uploaded files where the
expected values in the column must be the file names of the uploaded files.
type: array
items:
type: string
securitySchemes:
api_key:
type: apiKey
Expand Down
7 changes: 7 additions & 0 deletions common/swagger/v1openapi3/swagger_codegen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"basePackage":"ai.h2o.mojos.deploy.common.rest.v1openapi3",
"configPackage":"ai.h2o.mojos.deploy.common.rest.v1openapi3.config",
"modelPackage": "ai.h2o.mojos.deploy.common.rest.v1openapi3.model",
"apiPackage" : "ai.h2o.mojos.deploy.common.rest.v1openapi3.api",
"interfaceOnly" : true
}
7 changes: 0 additions & 7 deletions common/swagger/v2/swagger_codegen.json

This file was deleted.

0 comments on commit 9c01c0f

Please sign in to comment.