diff --git a/docs/docs/guides/1_quickstart.md b/docs/docs/guides/1_quickstart.md index 90a1f517..c370eae1 100644 --- a/docs/docs/guides/1_quickstart.md +++ b/docs/docs/guides/1_quickstart.md @@ -170,6 +170,10 @@ $ curl -X GET http://localhost:8000/v1beta1/namespaces/quickstart/schemas/exampl # Download latest version of particular schema $ curl -X GET http://localhost:8000/v1beta1/namespaces/quickstart/schemas/example; + +# Detect Schema Change +$ curl -X GET http://localhost:8080/v1beta1/schema/detect-change/quickstart/example?from=1&to=2; + ``` diff --git a/docs/docs/guides/3_manage_schemas.md b/docs/docs/guides/3_manage_schemas.md index 2babb81c..0dcc35d4 100644 --- a/docs/docs/guides/3_manage_schemas.md +++ b/docs/docs/guides/3_manage_schemas.md @@ -65,3 +65,7 @@ curl -X GET http://localhost:8000/v1beta1/namespaces/quickstart/schemas/example/ # upload schema can be called multiple times. Stencil server will retain old version if it's already uploaded. This call won't create new version again. You can verify by using versions API again. curl -H "X-SourceURL:www.github.com/some-repo" -H "X-CommitSHA:some-commit-sha" -X POST http://localhost:8000/v1/namespaces/quickstart/schemas --data-binary "@file.desc" ``` +## Detect Schema Change +```bash +$ curl -X GET http://localhost:8080/v1beta1/schema/detect-change/quickstart/example?from=1&to=2; +``` diff --git a/docs/docs/guides/5_schema_change.md b/docs/docs/guides/5_schema_change.md index 45bf980d..52cf1a81 100644 --- a/docs/docs/guides/5_schema_change.md +++ b/docs/docs/guides/5_schema_change.md @@ -101,3 +101,8 @@ E.g. If depth is `2` then the `impacted_schemas` for `Address` in below sample w ## Showing MR information While calculating the impacted schemas, the `SchemaChangedEvent` will also include information about the source URL and commit SHA. The `source_url` represents the repository URL, and the `commit_sha` corresponds to the commit SHA associated with that version. + +## Detect Schema Change +```bash +$ curl -X GET http://localhost:8080/v1beta1/schema/detect-change/quickstart/example?from=1&to=2; +``` \ No newline at end of file diff --git a/docs/docs/reference/api.md b/docs/docs/reference/api.md index 24048ea9..1bd8baa3 100644 --- a/docs/docs/reference/api.md +++ b/docs/docs/reference/api.md @@ -1,6 +1,6 @@ # API -## Version: 0.8.5 +## Version: 0.8.7 ### /v1beta1/namespaces @@ -334,6 +334,55 @@ Global Search API | 200 | A successful response. | [v1beta1SearchResponse](#v1beta1searchresponse) | | default | An unexpected error response. | [rpcStatus](#rpcstatus) | +### /v1beta1/schema/detect-change/{namespaceId}/{schemaName}?from=1&to=2 + +#### GET + +##### Summary + +Detect Schema Change for the given version i.e v1 and v2. + +#### Parameters + +| Name | Located in | Description | Required | Schema | +|-------------|------------|------------------------------------------------|----------|---------| +| namespaceId | path | | Yes | string | +| schemaName | path | | Yes | string | +| from | queryParam | version from which change has to be calculated | No | integer | +| to | queryParam | version to which change has to be calculated | No | integer | + +#### Parameters + +| Name | Located in | Description | Required | Schema | +|-------------|------------|------------------------------------------------|----------|---------| +| namespaceId | path | | Yes | string | +| schemaName | path | | Yes | string | +| from | queryParam | version from which change has to be calculated | No | integer | +| to | queryParam | version to which change has to be calculated | No | integer | + +#### +| S. No | From | +|------- +Different values and validation of `from` and `to` version + +| S. No. | From | To | From (In Code) | To (In Code) | Error | +|--------|------|--------|----------------|--------------|------------------------------------------| +| 1. | “” | “” | latest-1 | latest | N/A | +| 2. | “” | latest | latest-1 | latest | N/A | +| 3. | “” | 42 | 41 | 42 | N/A | +| 4. | 41 | “” | 41 | latest | N/A | +| 5. | 41 | 42 | 41 | 42 | N/A | +| 6. | 41 | 45 | 41 | 45 | N/A | +| 7. | 41 | 40 | - | - | Bad Request: From should be less than To | +| 8. | 41 | 41 | - | - | Bad Request: From should be less than To | + +##### Responses + +| Code | Description | Schema | +|---------|-------------------------------|---------------------------------------------------------| +| 200 | A successful response. | [v1beta1SchemaChangedEvent](#v1beta1SchemaChangedEvent) | +| default | An unexpected error response. | [rpcStatus](#rpcstatus) | + ### Models #### SchemaCompatibility @@ -505,17 +554,17 @@ Global Search API #### v1beta1SchemaChangedEvent -| Name | Type | Description | Required | -|------------------|------------------------------------------------------------------------|----------------------------------------------------------------------|----------| -| event_id | string | event id of the message | No | -| event_timestamp | google.protobuf.Timestamp | timestamp for the message | No | -| namespace_name | string | name of namespace | No | -| schema_name | string | name of schema | No | -| updated_schemas | repeated string | directly updated schemas | No | -| updated_fields | [ImpactedFields](#v1beta1ImpactedFields)(map | impacted fields corresponding to schema | No | -| impacted_schemas | [ImpactedSchemas](#v1beta1ImpactedSchemas)map | indirectly impacted schema corresponding to directly impacted schema | No | -| version | int32 | version | No | -| metadata | [Metadata](v1beta1Metadata) | Metdata like commit_sha , source_url | No | +| Name | Type | Description | Required | +|------------------|-------------------------------------------------------------------------|----------------------------------------------------------------------|----------| +| event_id | string | event id of the message | No | +| event_timestamp | google.protobuf.Timestamp | timestamp for the message | No | +| namespace_name | string | name of namespace | No | +| schema_name | string | name of schema | No | +| updated_schemas | repeated string | directly updated schemas | No | +| updated_fields | [ImpactedFields](#v1beta1ImpactedFields) map | impacted fields corresponding to schema | No | +| impacted_schemas | [ImpactedSchemas](#v1beta1ImpactedSchemas) map | indirectly impacted schema corresponding to directly impacted schema | No | +| version | int32 | version | No | +| metadata | [Metadata](v1beta1Metadata) | Metdata like commit_sha , source_url | No | #### v1beta1ImpactedFields