Help Center> ServiceStage> API Reference> CSE API> Schema> Modifying a Microservice Schema

Modifying a Microservice Schema

Function

This API is used to modify a microservice schema based on the schema ID.

Constraints

In the production environment, if versions are earlier than 2.3.33, schema overwriting is not supported. For version 2.3.33 or later, the environment variable SCHEMA_EDITABLE can be used to support schema overwriting.

URI

PUT /v4/{project_id}/registry/microservices/{service_id}/schemas/{schema_id}

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Unique ID of a tenant sub-project. Length: 1–64 characters.

service_id

Yes

String

Microservice ID, which must be unique. Length: 1–64 characters. Regular expression: ^.*$

schema_id

Yes

String

Microservice schema ID, which must be unique. Length: 1–160 characters. Regular expression: ^[a-zA-Z0-9]{1,160}$|^[a-zA-Z0-9][a-zA-Z0-9_-.]{0,158}[a-zA-Z0-9]$

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

x-domain-name

Yes

String

Tenant account name.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

schema

Yes

String

Microservice schema content.

summary

No

String

Schema summary.

Response Parameters

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

errorMessage

String

Error information.

detail

String

Location details.

Status code: 500

Table 5 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

errorMessage

String

Error information.

detail

String

Location details.

Example Requests

PUT https://{endpoint}/v4/{project_id}/registry/microservices/{service_id}/schemas/{schema_id}

{
  "schema" : "---\nswagger: \"2.0\"\ninfo:\n  version: \"1.0.0\"\n  title: \"swagger definition for com.service.comment.controller.SimpleCtrlImpl\"\n  x-java-interface: \"cse.gen.blog.comment_service.Simple.SimpleCtrlImplIntf\"\nbasePath: \"/simple\"\nschemes:\n- \"https\"\nconsumes:\n- \"application/json\"\nproduces:\n- \"application/json\"\npaths:\n  /getname:\n    get:\n      operationId: \"getName\"\n      parameters:\n      - name: \"age\"\n        in: \"query\"\n        required: false\n        type: \"integer\"\n        format: \"int32\"\n      responses:\n        200:\n          description: \"response of 200\"\n          schema:\n            $ref: \"#/definitions/CommonResult\"\ndefinitions:\n  CommonResult:\n    type: \"object\"\n    required:\n    - \"resultCode\"\n    properties:\n      resultCode:\n        type: \"integer\"\n        format: \"int32\"\n      resultDesc:\n        type: \"string\"\n    x-java-class: \"com.service.comment.controller.CommonResult\"\n"
}

Example Responses

None

Status Codes

Status Code

Description

200

OK

400

Bad Request

500

Internal Server Error

Error Codes

See Error Codes.