Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ node_modules
**/gen/**

# Ignore merged file and one downloaded for processor-controller
/openapi/v1/odmApi.yaml
/openapi/v1/openapi.yaml
/openapi/v1/processorsController.yaml
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,19 @@ repos:
- id: check-toml
- id: check-merge-conflict
- id: end-of-file-fixer
- repo: local
hooks:
- id: spectral-lint
name: spectral-lint
entry: npx @stoplight/spectral-cli lint
language: node
files: openapi/v1/odm.yaml
additional_dependencies: ['@stoplight/spectral-cli@6.15.0']
- repo: local
hooks:
- id: redocly-lint
name: redocly-lint
entry: npx @redocly/cli lint
language: node
files: openapi/v1/odm.yaml
additional_dependencies: ['@redocly/cli@2.0.7']
1 change: 1 addition & 0 deletions .spectral.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: ["spectral:oas"]
9 changes: 4 additions & 5 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ swagger:
COPY +build/v1 /usr/share/nginx/html/yaml/
COPY openapi/swagger/fs /

RUN rm -f /usr/share/nginx/html/yaml/odmApi.yaml
RUN rm -f /usr/share/nginx/html/yaml/odm.yaml && \
rm -f /usr/share/nginx/html/yaml/processorsController.yaml
RUN apk add bash --no-cache && \
rewrite_entrypoint.sh && \
apk del bash

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

Expand All @@ -170,8 +170,7 @@ swagger:
stoplight:
FROM nginxinc/nginx-unprivileged:1.29.1-alpine

COPY +build/v1/schemas /usr/share/nginx/html/schemas/
COPY +build/v1/odmApi.yaml /usr/share/nginx/html/
COPY +build/v1/openapi.yaml /usr/share/nginx/html/
COPY openapi/stoplight/fs /

ARG --required OPENAPI_VERSION
Expand All @@ -182,5 +181,5 @@ main:
BUILD +swagger
BUILD +stoplight
BUILD +docs
BUILD +r-api-client
#BUILD +r-api-client
BUILD +python-api-client
29 changes: 14 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ val processorsControllerVersion: String = System.getenv("PROCESSORS_CONTROLLER_V
val processorsControllerFileName = "processorsController.yaml"
val processorsControllerFilePath = "${sourceDirectory}/${processorsControllerFileName}"

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

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

tasks {
val downloadSpec by registering(DownloadSpecification::class) {
Expand All @@ -43,20 +41,21 @@ tasks {
}
val mergeSpecifications by registering(MergeSpecifications::class) {
dependsOn(downloadSpec)
inputFiles = sourceFileList
outputFile = layout.projectDirectory.file(mergedFilePath)
inputFiles = listOf(odmFilePath, processorsControllerFilePath)
.sorted().map { layout.projectDirectory.file(it) }
outputFile = layout.projectDirectory.file(openapiFilePath)
}
val generateOdmApiPython by registering(GenerateTask::class) {
dependsOn(mergeSpecifications)
generatorName.set("python")
inputSpec.set(mergedFilePath)
inputSpec.set(openapiFilePath)
outputDir.set("$rootDir/generated/python")
packageName.set("odm_api")
gitUserId.set("genestack")
gitRepoId.set("openapi")
nameMappings.set(mapOf("genestack:accession" to "genestackaccession"))
configOptions = mapOf(
"packageVersion" to openApiVersion,
"packageVersion" to openapiVersion,
// Workaround for https://github.com/OpenAPITools/openapi-generator/issues/21619
// The second version asks for license, which we can't provide due to unavailability of
// "licenseName" and "licenseUrl" fields in the specification for python generator.
Expand All @@ -67,28 +66,28 @@ tasks {
val generateOdmApiR by registering(GenerateTask::class) {
dependsOn(mergeSpecifications)
generatorName.set("r")
inputSpec.set(mergedFilePath)
inputSpec.set(openapiFilePath)
outputDir.set("$rootDir/generated/r")
packageName.set("odmApi")
gitUserId.set("genestack")
gitRepoId.set("openapi")
nameMappings.set(mapOf("genestack:accession" to "genestackaccession"))
configOptions = mapOf(
"packageVersion" to openApiVersion
"packageVersion" to openapiVersion
// "disallowAdditionalPropertiesIfNotPresent" to "true"
)
}
val generateOdmApiPostmanCollection by registering(GenerateTask::class) {
dependsOn(mergeSpecifications)
generatorName.set("postman-collection")
inputSpec.set(mergedFilePath)
inputSpec.set(openapiFilePath)
outputDir.set("$rootDir/generated/postman-collection")
packageName.set("odm-api")
gitUserId.set("genestack")
gitRepoId.set("openapi")
nameMappings.set(mapOf("genestack:accession" to "genestackaccession"))
configOptions = mapOf(
"packageVersion" to openApiVersion
"packageVersion" to openapiVersion
// "disallowAdditionalPropertiesIfNotPresent" to "true"
)
}
Expand Down
2 changes: 1 addition & 1 deletion openapi/stoplight/fs/usr/share/nginx/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<body>

<elements-api
apiDescriptionUrl="/stoplight/odmApi.yaml"
apiDescriptionUrl="/stoplight/openapi.yaml"
router="hash"
layout="sidebar"
/>
Expand Down
120 changes: 0 additions & 120 deletions openapi/v1/cellCurator.yaml

This file was deleted.

120 changes: 0 additions & 120 deletions openapi/v1/cellUser.yaml

This file was deleted.

Loading
Loading