Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(3scale): merge api docs for the same service #1249

Merged
5 changes: 5 additions & 0 deletions workspaces/3scale/.changeset/tricky-dogs-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage-community/plugin-3scale-backend': major
---

Merge API docs for the same service.
11 changes: 8 additions & 3 deletions workspaces/3scale/plugins/3scale-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,27 @@
"postversion": "yarn run export-dynamic",
"prepack": "backstage-cli package prepack",
"start": "backstage-cli package start",
"test": "backstage-cli package test --passWithNoTests --coverage",
"tsc": "tsc"
AndrienkoAleksandr marked this conversation as resolved.
Show resolved Hide resolved
"test": "backstage-cli package test --passWithNoTests --coverage"
},
"dependencies": {
"@backstage/backend-plugin-api": "^1.0.0",
"@backstage/catalog-model": "^1.7.0",
"@backstage/errors": "^1.2.4",
"@backstage/plugin-catalog-node": "^1.13.0"
"@backstage/plugin-catalog-node": "^1.13.0",
"atlassian-openapi": "^1.0.19",
"openapi-merge": "^1.3.3",
"swagger-converter": "2.1.0",
"swagger2openapi": "^7.0.4"
},
"devDependencies": {
"@backstage/backend-defaults": "^0.5.0",
"@backstage/backend-test-utils": "0.4.4",
"@backstage/cli": "^0.27.1",
"@backstage/config": "^1.2.0",
"@backstage/plugin-catalog-backend": "^1.26.0",
"@janus-idp/cli": "1.13.1",
"@types/supertest": "6.0.2",
"@types/swagger2openapi": "^7.0.4",
"msw": "1.3.3",
"supertest": "7.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Echo API.",
"description": "A sample echo API."
},
"paths": {
"/": {
"get": {
"description": "Echo API with no parameters",
"operationId": "echo_no_params",
"parameters": [
{
"name": "user_key",
"in": "query",
"description": "Your API access key",
"required": true,
"x-data-threescale-name": "user_keys",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ResponseModel"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/ResponseModel"
}
},
"text/xml": {
"schema": {
"$ref": "#/components/schemas/ResponseModel"
}
},
"text/html": {
"schema": {
"$ref": "#/components/schemas/ResponseModel"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorModel"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/ErrorModel"
}
},
"text/xml": {
"schema": {
"$ref": "#/components/schemas/ErrorModel"
}
},
"text/html": {
"schema": {
"$ref": "#/components/schemas/ErrorModel"
}
}
}
}
}
}
},
"/{echo}": {
"get": {
"description": "Echo API with parameters",
"operationId": "echo_with_params",
"parameters": [
{
"name": "echo",
"in": "path",
"description": "The string to be echoed",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "user_key",
"in": "query",
"description": "Your API access key",
"required": true,
"x-data-threescale-name": "user_keys",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ResponseModel"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/ResponseModel"
}
},
"text/xml": {
"schema": {
"$ref": "#/components/schemas/ResponseModel"
}
},
"text/html": {
"schema": {
"$ref": "#/components/schemas/ResponseModel"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorModel"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/ErrorModel"
}
},
"text/xml": {
"schema": {
"$ref": "#/components/schemas/ErrorModel"
}
},
"text/html": {
"schema": {
"$ref": "#/components/schemas/ErrorModel"
}
}
}
}
}
}
}
},
"servers": [
{
"url": "http://echo-api.3scale.net/"
}
],
"components": {
"schemas": {
"ResponseModel": {
"type": "object",
"required": ["method", "path", "args", "headers"],
"properties": {
"method": {
"type": "string"
},
"path": {
"type": "string"
},
"args": {
"type": "string"
},
"headers": {
"type": "object"
}
}
},
"ErrorModel": {
"type": "object",
"required": ["code", "message"],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"openapi": "3.0.0",
"info": {
"title": "Ping Service.",
"description": "A simple API that responds with the input message.",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.example.com/v1",
"description": "Production Server"
},
{
"url": "https://api.staging.example.com/v1",
"description": "Staging Server"
}
],
"paths": {
"/ping": {
"post": {
"summary": "Ping message",
"description": "Returns the same message that was sent in the request body.",
"operationId": "pingMessage",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Hello, world!"
}
},
"required": ["message"]
}
}
}
},
"responses": {
"200": {
"description": "The echoed message",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Hello, world!"
}
}
}
}
}
},
"400": {
"description": "Invalid input, missing 'message' field"
}
}
}
}
},
"components": {
"schemas": {
"PingRequest": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Hello, world!"
}
},
"required": ["message"]
},
"PingResponse": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Hello, world!"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"apiVersion": "1.2",
"swaggerVersion": "1.2",
"basePath": "https://api.example.com/v1",
"resourcePath": "/profile",
"apis": [
{
"path": "/profile/{userId}",
"description": "User profile operations",
"operations": [
{
"method": "GET",
"summary": "Get user profile by user ID",
"notes": "Returns a user's profile details by their ID.",
"type": "User",
"nickname": "getUserProfile",
"parameters": [
{
"name": "userId",
"description": "ID of the user to fetch",
"required": true,
"type": "string",
"paramType": "path"
}
],
"responseMessages": [
{
"code": 200,
"message": "Successful response",
"responseModel": "User"
},
{
"code": 404,
"message": "User not found"
},
{
"code": 500,
"message": "Server error"
}
]
}
]
}
],
"models": {
"User": {
"id": "User",
"properties": {
"id": {
"type": "string",
"description": "User ID",
"example": "1001"
},
"name": {
"type": "string",
"description": "User name",
"example": "John Doe"
},
"email": {
"type": "string",
"description": "User email address",
"example": "test@example.com"
}
}
}
}
}
Loading
Loading