Skip to content

Commit

Permalink
chore: update api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gdgagangeek committed Jul 25, 2024
1 parent f7f745b commit b5741b4
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 12 deletions.
4 changes: 4 additions & 0 deletions docs/docs/guides/1_quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;

```

</TabItem>
Expand Down
4 changes: 4 additions & 0 deletions docs/docs/guides/3_manage_schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
```
5 changes: 5 additions & 0 deletions docs/docs/guides/5_schema_change.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
```
73 changes: 61 additions & 12 deletions docs/docs/reference/api.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# API

## Version: 0.8.5
## Version: 0.8.7

### /v1beta1/namespaces

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<string, ImpactedFields> | impacted fields corresponding to schema | No |
| impacted_schemas | [ImpactedSchemas](#v1beta1ImpactedSchemas)map<string, ImpactedSchemas> | 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<string, ImpactedFields> | impacted fields corresponding to schema | No |
| impacted_schemas | [ImpactedSchemas](#v1beta1ImpactedSchemas) map<string, ImpactedSchemas> | indirectly impacted schema corresponding to directly impacted schema | No |
| version | int32 | version | No |
| metadata | [Metadata](v1beta1Metadata) | Metdata like commit_sha , source_url | No |

#### v1beta1ImpactedFields

Expand Down

0 comments on commit b5741b4

Please sign in to comment.