Skip to content

Commit dacbe36

Browse files
[ODM-12785] odm as a singlefile, build part
1 parent edab9fe commit dacbe36

File tree

5 files changed

+20
-22
lines changed

5 files changed

+20
-22
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ node_modules
2525
**/gen/**
2626

2727
# Ignore merged file and one downloaded for processor-controller
28-
/openapi/v1/odmApi.yaml
28+
/openapi/v1/openapi.yaml
2929
/openapi/v1/processorsController.yaml

Earthfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ swagger:
151151
COPY +build/v1 /usr/share/nginx/html/yaml/
152152
COPY openapi/swagger/fs /
153153

154-
RUN rm -f /usr/share/nginx/html/yaml/odmApi.yaml
154+
RUN rm -f /usr/share/nginx/html/yaml/odm.yaml && \
155+
rm -f /usr/share/nginx/html/yaml/processorsController.yaml
155156
RUN apk add bash --no-cache && \
156157
rewrite_entrypoint.sh && \
157158
apk del bash
158159

159-
# Remove merged api spec
160160
# IDK why it's required
161161
RUN ln -s /usr/share/nginx/html/yaml /usr/share/nginx/html/helper/yaml
162162

@@ -170,8 +170,7 @@ swagger:
170170
stoplight:
171171
FROM nginxinc/nginx-unprivileged:1.29.1-alpine
172172

173-
COPY +build/v1/schemas /usr/share/nginx/html/schemas/
174-
COPY +build/v1/odmApi.yaml /usr/share/nginx/html/
173+
COPY +build/v1/openapi.yaml /usr/share/nginx/html/
175174
COPY openapi/stoplight/fs /
176175

177176
ARG --required OPENAPI_VERSION

build.gradle.kts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ val processorsControllerVersion: String = System.getenv("PROCESSORS_CONTROLLER_V
2323
val processorsControllerFileName = "processorsController.yaml"
2424
val processorsControllerFilePath = "${sourceDirectory}/${processorsControllerFileName}"
2525

26-
val openApiVersion: String = System.getenv("OPENAPI_VERSION")
27-
val mergedFileName = "odmApi.yaml"
28-
val mergedFilePath = "${sourceDirectory}/${mergedFileName}"
26+
val odmFileName = "odm.yaml"
27+
val odmFilePath = "${sourceDirectory}/${odmFileName}"
2928

30-
val sourceFileList = KotlinPath(sourceDirectory)
31-
.listDirectoryEntries("*.yaml")
32-
.sorted()
33-
.map { layout.projectDirectory.file("${sourceDirectory}/${it.name}") }
29+
val openapiVersion: String = System.getenv("OPENAPI_VERSION")
30+
val openapiFileName = "openapi.yaml"
31+
val openapiFilePath = "${sourceDirectory}/${openapiFileName}"
3432

3533
tasks {
3634
val downloadSpec by registering(DownloadSpecification::class) {
@@ -43,20 +41,21 @@ tasks {
4341
}
4442
val mergeSpecifications by registering(MergeSpecifications::class) {
4543
dependsOn(downloadSpec)
46-
inputFiles = sourceFileList
47-
outputFile = layout.projectDirectory.file(mergedFilePath)
44+
inputFiles = listOf(odmFilePath, processorsControllerFilePath)
45+
.sorted().map { layout.projectDirectory.file(it) }
46+
outputFile = layout.projectDirectory.file(openapiFilePath)
4847
}
4948
val generateOdmApiPython by registering(GenerateTask::class) {
5049
dependsOn(mergeSpecifications)
5150
generatorName.set("python")
52-
inputSpec.set(mergedFilePath)
51+
inputSpec.set(openapiFilePath)
5352
outputDir.set("$rootDir/generated/python")
5453
packageName.set("odm_api")
5554
gitUserId.set("genestack")
5655
gitRepoId.set("openapi")
5756
nameMappings.set(mapOf("genestack:accession" to "genestackaccession"))
5857
configOptions = mapOf(
59-
"packageVersion" to openApiVersion,
58+
"packageVersion" to openapiVersion,
6059
// Workaround for https://github.com/OpenAPITools/openapi-generator/issues/21619
6160
// The second version asks for license, which we can't provide due to unavailability of
6261
// "licenseName" and "licenseUrl" fields in the specification for python generator.
@@ -67,28 +66,28 @@ tasks {
6766
val generateOdmApiR by registering(GenerateTask::class) {
6867
dependsOn(mergeSpecifications)
6968
generatorName.set("r")
70-
inputSpec.set(mergedFilePath)
69+
inputSpec.set(openapiFilePath)
7170
outputDir.set("$rootDir/generated/r")
7271
packageName.set("odmApi")
7372
gitUserId.set("genestack")
7473
gitRepoId.set("openapi")
7574
nameMappings.set(mapOf("genestack:accession" to "genestackaccession"))
7675
configOptions = mapOf(
77-
"packageVersion" to openApiVersion
76+
"packageVersion" to openapiVersion
7877
// "disallowAdditionalPropertiesIfNotPresent" to "true"
7978
)
8079
}
8180
val generateOdmApiPostmanCollection by registering(GenerateTask::class) {
8281
dependsOn(mergeSpecifications)
8382
generatorName.set("postman-collection")
84-
inputSpec.set(mergedFilePath)
83+
inputSpec.set(openapiFilePath)
8584
outputDir.set("$rootDir/generated/postman-collection")
8685
packageName.set("odm-api")
8786
gitUserId.set("genestack")
8887
gitRepoId.set("openapi")
8988
nameMappings.set(mapOf("genestack:accession" to "genestackaccession"))
9089
configOptions = mapOf(
91-
"packageVersion" to openApiVersion
90+
"packageVersion" to openapiVersion
9291
// "disallowAdditionalPropertiesIfNotPresent" to "true"
9392
)
9493
}

openapi/stoplight/fs/usr/share/nginx/html/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<body>
1212

1313
<elements-api
14-
apiDescriptionUrl="/stoplight/odmApi.yaml"
14+
apiDescriptionUrl="/stoplight/openapi.yaml"
1515
router="hash"
1616
layout="sidebar"
1717
/>

openapi/v1/odm.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24229,7 +24229,7 @@ components:
2422924229
type: string
2423024230
result:
2423124231
items:
24232-
$ref: "XrefSetSearchResultEntry.yaml"
24232+
$ref: "#/components/schemas/XrefSetSearchResultEntry"
2423324233
type: array
2423424234
type: object
2423524235
XrefSetSearchResultEntry:

0 commit comments

Comments
 (0)