diff --git a/.github/workflows/dry-run-release.yml b/.github/workflows/dry-run-release.yml index 0697ddc..ae29eeb 100644 --- a/.github/workflows/dry-run-release.yml +++ b/.github/workflows/dry-run-release.yml @@ -29,7 +29,7 @@ jobs: with: node-version-file: '.nvmrc' - name: Install dependencies - run: npm ci + run: npm install - name: Dry-run release env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 25722c0..3189cfc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,7 +19,7 @@ jobs: with: node-version-file: '.nvmrc' - name: Install dependencies - run: npm ci + run: npm install - name: Release env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} diff --git a/.gitignore b/.gitignore index c085201..e8d25b2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ build /specifications/merged.yaml /version.txt node_modules +/specifications/*.tgz \ No newline at end of file diff --git a/api-server-stubs-ktor/build.gradle.kts b/api-server-stubs-ktor/build.gradle.kts index f14d870..41efb7a 100644 --- a/api-server-stubs-ktor/build.gradle.kts +++ b/api-server-stubs-ktor/build.gradle.kts @@ -36,7 +36,11 @@ fabrikt { } generate("mavenConnector") { apiFile = rootProject.layout.projectDirectory.file("redocly/bundled/maven-connector-v1.yaml") - basePackage = "org.modelix.services.maven_connector.stubs" + basePackage = "org.modelix.services.mavenconnector.stubs" + } + generate("gitConnector") { + apiFile = rootProject.layout.projectDirectory.file("redocly/bundled/git-connector-v1.yaml") + basePackage = "org.modelix.services.gitconnector.stubs" } generate("repository") { apiFile = rootProject.layout.projectDirectory.file("redocly/bundled/repository-v3.yaml") diff --git a/build.gradle.kts b/build.gradle.kts index 2d75f88..1bd35b6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,6 +17,7 @@ fun computeVersion(): String { } else { val gitVersion: groovy.lang.Closure by extra gitVersion() + .replace("""\.dirty$""".toRegex(), "-dirty") .let { // Normalize the version so that is always a valid NPM version. if (it.matches("""\d+\.\d+.\d+-.*""".toRegex())) it else "0.0.1-$it" diff --git a/redocly/redocly.yaml b/redocly/redocly.yaml index 32ae77a..6bbb9ed 100644 --- a/redocly/redocly.yaml +++ b/redocly/redocly.yaml @@ -12,6 +12,11 @@ apis: output: ./bundled/maven-connector-v1.yaml decorators: plugin/use-server-path: {} + git-connector@v1: + root: ../specifications/git-connector/v1/git.yaml + output: ./bundled/git-connector-v1.yaml + decorators: + plugin/use-server-path: {} workspaces@v1: root: ../specifications/workspaces/v1/workspaces.yaml output: ./bundled/workspaces-v1.yaml diff --git a/specifications/git-connector/v1/git.yaml b/specifications/git-connector/v1/git.yaml new file mode 100644 index 0000000..9861935 --- /dev/null +++ b/specifications/git-connector/v1/git.yaml @@ -0,0 +1,328 @@ +openapi: "3.1.0" +info: + title: "Modelix Git Connector" + version: "1.0.0" +servers: + - url: '/modelix/git-connector' + description: Import MPS project from Git repositories +tags: + - name: GitConnector + - name: GitRepositories + - name: GitBranches + - name: Drafts +paths: + /repositories/: + get: + operationId: listGitRepositories + tags: [GitRepositories] + parameters: + - name: includeStatus + in: query + required: false + schema: + type: boolean + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GitRepositoryConfigList' + post: + operationId: createGitRepository + tags: [GitRepositories] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GitRepositoryConfig' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GitRepositoryConfig' + + /repositories/{repositoryId}: + get: + operationId: getGitRepository + tags: [GitRepositories] + parameters: + - name: repositoryId + in: path + required: true + schema: + type: string + - name: includeStatus + in: query + required: false + schema: + type: boolean + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GitRepositoryConfig' + put: + operationId: updateGitRepository + tags: [GitRepositories] + parameters: + - name: repositoryId + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GitRepositoryConfig' + responses: + "200": + description: OK + delete: + operationId: deleteGitRepository + tags: [GitRepositories] + parameters: + - name: repositoryId + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + + /repositories/{repositoryId}/status: + get: + operationId: getGitRepositoryStatus + tags: [GitRepositories, GitBranches] + parameters: + - name: repositoryId + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GitRepositoryStatusData' + + /repositories/{repositoryId}/branches/: + get: + operationId: listBranches + tags: [GitBranches] + parameters: + - name: repositoryId + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GitBranchList' + + /repositories/{repositoryId}/branches/update: + post: + operationId: updateBranches + tags: [GitBranches] + parameters: + - name: repositoryId + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GitBranchList' + + /repositories/{repositoryId}/drafts/: + get: + operationId: listDraftsInRepository + tags: [Drafts] + parameters: + - name: repositoryId + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DraftConfigList' + post: + operationId: createDraftInRepository + tags: [Drafts] + parameters: + - name: repositoryId + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DraftConfig' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DraftConfig' + + /drafts/{draftId}: + get: + operationId: getDraft + tags: [Drafts] + parameters: + - name: draftId + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DraftConfig' + delete: + operationId: deleteDraft + tags: [Drafts] + parameters: + - name: draftId + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + +components: + schemas: + GitRepositoryConfigList: + type: object + required: [repositories] + properties: + repositories: + type: array + items: + $ref: '#/components/schemas/GitRepositoryConfig' + + GitRepositoryConfig: + type: object + required: [id, url] + properties: + id: + type: string + format: uuid + name: + type: string + remotes: + type: array + items: + $ref: '#/components/schemas/GitRemoteConfig' + modelixRepository: + type: string + status: + $ref: '#/components/schemas/GitRepositoryStatusData' + + GitRemoteConfig: + type: object + required: [name, url, hasCredentials] + properties: + name: + type: string + url: + type: string + hasCredentials: + type: boolean + credentials: + $ref: '#/components/schemas/GitCredentials' + + GitCredentials: + type: object + properties: + username: + type: string + password: + type: string + + GitRepositoryStatusData: + type: object + properties: + branches: + type: array + items: + $ref: '#/components/schemas/GitBranchStatusData' + + GitBranchList: + type: object + required: [branches] + properties: + branches: + type: array + items: + $ref: '#/components/schemas/GitBranchStatusData' + + GitBranchStatusData: + type: object + required: [remoteRepositoryName, name] + properties: + remoteRepositoryName: { type: string } + name: { type: string } + gitCommitHash: { type: string } + modelixBranchName: { type: string } + modelixCommitHash: { type: string } + lastImportedGitCommitHash: { type: string } + + DraftConfigList: + type: object + required: [drafts] + properties: + drafts: + type: array + items: + $ref: '#/components/schemas/DraftConfig' + + DraftConfig: + type: object + required: [id, gitRepositoryId, modelixBranchName, gitBranchName, baseGitCommit] + properties: + id: { type: string } + name: { type: string } + gitRepositoryId: { type: string } + gitBranchName: { type: string } + baseGitCommit: { type: string } + modelixBranchName: { type: string } + defaultWorkspace: { type: string } + + securitySchemes: + modelixJwtAuth: + type: http + scheme: bearer + bearerFormat: JWT + +security: + - modelixJwtAuth: [] diff --git a/specifications/workspaces/v1/workspaces.yaml b/specifications/workspaces/v1/workspaces.yaml index 1ca773a..734f612 100644 --- a/specifications/workspaces/v1/workspaces.yaml +++ b/specifications/workspaces/v1/workspaces.yaml @@ -21,6 +21,20 @@ paths: content: application/json: schema: { $ref: '#/components/schemas/WorkspaceList' } + post: + operationId: createWorkspace + tags: [Workspaces] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WorkspaceConfig' + responses: + '200': + description: OK + content: + application/json: + schema: { $ref: '#/components/schemas/WorkspaceConfig' } /workspaces/{workspaceId}: get: @@ -104,35 +118,6 @@ paths: type: string format: binary - /drafts/: - get: - operationId: listDrafts - tags: [GitChangeDrafts] - responses: - '200': - description: OK - content: - application/json: - schema: { $ref: '#/components/schemas/GitChangeDraftList' } - - /drafts/{draftId}/: - get: - operationId: getDraft - tags: [GitChangeDrafts] - parameters: - - name: draftId - in: path - required: true - schema: - type: string - format: uuid - responses: - '200': - description: OK - content: - application/json: - schema: { $ref: '#/components/schemas/GitChangeDraft' } - /instances/: get: operationId: listInstances @@ -256,32 +241,6 @@ paths: components: schemas: - - GitChangeDraftList: - type: object - required: [drafts] - properties: - drafts: { type: array, items: { $ref: '#/components/schemas/GitChangeDraft' } } - - GitChangeDraft: - type: object - required: [id, description, owner, gitRepository, baseGitBranch, baseGitCommit, modelixBranch] - properties: - id: { type: string, format: uuid } - description: { type: string } - owner: { type: string } - gitRepository: { type: string } - baseGitBranch: { type: string } - baseGitCommit: { type: string } - modelixBranch: { $ref: '#/components/schemas/ModelixBranchRef' } - - ModelixBranchRef: - type: object - required: [repositoryId, branchName] - properties: - repositoryId: { type: string } - branchName: { type: string } - WorkspaceList: type: object required: [workspaces] @@ -290,15 +249,13 @@ components: WorkspaceConfig: type: object - required: [id, name, mpsVersion, memoryLimit, gitRepositories] + required: [id, name, mpsVersion] properties: id: { type: string } name: { type: string } mpsVersion: { type: string } memoryLimit: { type: string } - gitRepositories: - type: array - items: { $ref: '#/components/schemas/GitRepository' } + gitRepositoryIds: { type: array, items: { type: string } } mavenRepositories: type: array items: { $ref: '#/components/schemas/MavenRepository' }