docs(other): respect usage article#149
Conversation
c28f30f to
12e7702
Compare
12e7702 to
9f2c0e4
Compare
| <b>IMPORTANT: the API description intentionally contains discrepancies for demonstration purposes.</b> | ||
|
|
||
| ```yaml | ||
| openapi: 3.1.0 |
There was a problem hiding this comment.
Using the 3.1.0 example, as VSCE currently doesn’t support rendering 3.2.0 and we would like to allow users to have valid preview.
| - page: ./linting-arazzo-workflows.md | ||
| - page: ./testing-arazzo-workflows.md | ||
| - page: ./documenting-multiple-apis-using-arazzo.md | ||
| - group: Respect practical example series |
There was a problem hiding this comment.
Is it ok to keep it as learn/arazzo articles or should we transform them into blog posts?
|
|
||
| Arazzo provides a standard way to describe API workflows declaratively. Respect uses those workflows to run API contract tests against real API behavior. | ||
|
|
||
| With this approach, teams can maintain API test coverage, detect documentation drift earlier, and share executable API workflows across engineering, QA, and documentation teams. No newline at end of file |
There was a problem hiding this comment.
Do we want to put a link to the next part of this tutorial somewhere here?
There was a problem hiding this comment.
cc: @Redocly/technical-writers
| - The status code and content type checks pass because the response matches the documented response metadata. | ||
| - The schema check fails because the response body shape does not match the documented schema. | ||
|
|
||
| <details> |
There was a problem hiding this comment.
@Redocly/technical-writers is it better to use terminal output screenshot here?
|
|
||
| To follow the examples in this article, you need: | ||
|
|
||
| - Basic familiarity with [Arazzo](../what-is-arazzo.md). |
There was a problem hiding this comment.
Let's add a link to this article from '../what-is-arazzo.md'?
| You will learn how to define reusable workflows in separate files, pass values between workflows, and use those values to authorize API requests. | ||
|
|
||
| You will cover the following topics: | ||
|
|
||
| Practical applications of Arazzo: |
There was a problem hiding this comment.
| You will learn how to define reusable workflows in separate files, pass values between workflows, and use those values to authorize API requests. | |
| You will cover the following topics: | |
| Practical applications of Arazzo: | |
| You will cover the following topics: | |
| This article shows how to use Respect, powered by Arazzo workflows, for API contract testing. | ||
| You will learn how to describe an API workflow, execute it with Redocly CLI, and use the results to find mismatches between an OpenAPI description and the real API behavior. | ||
|
|
||
| You will cover the following topics: | ||
|
|
||
| Practical applications of Arazzo: | ||
|
|
||
| - Automating repetitive API workflows. | ||
| - Adding API contract tests to CI/CD routines. | ||
| - Keeping API documentation synchronized with actual API behavior. | ||
| - Sharing described workflows across teams. | ||
| - Using the open-source [@redocly/cli](https://www.npmjs.com/package/@redocly/cli) `respect` command to execute Arazzo workflows, inspect contract test results, and fix mismatches between the OpenAPI description and the actual API response. |
There was a problem hiding this comment.
| This article shows how to use Respect, powered by Arazzo workflows, for API contract testing. | |
| You will learn how to describe an API workflow, execute it with Redocly CLI, and use the results to find mismatches between an OpenAPI description and the real API behavior. | |
| You will cover the following topics: | |
| Practical applications of Arazzo: | |
| - Automating repetitive API workflows. | |
| - Adding API contract tests to CI/CD routines. | |
| - Keeping API documentation synchronized with actual API behavior. | |
| - Sharing described workflows across teams. | |
| - Using the open-source [@redocly/cli](https://www.npmjs.com/package/@redocly/cli) `respect` command to execute Arazzo workflows, inspect contract test results, and fix mismatches between the OpenAPI description and the actual API response. | |
| This article shows how to use Respect, powered by Arazzo workflows, for API contract testing. | |
| You will cover the following topics: | |
| - Automating repetitive API workflows. | |
| - Adding API contract tests to CI/CD routines. | |
| - Keeping API documentation synchronized with actual API behavior. | |
| - Sharing described workflows across teams. | |
| - Using the open-source Redocly CLI to execute Arazzo workflows, inspect contract test results, and fix mismatches between the OpenAPI description and the actual API response. |
BTW, This is a lot of topics. Maybe split them into two articles?
| Whichever approach you choose, validate the Arazzo file with Redocly CLI: | ||
|
|
||
| ```bash | ||
| npx @redocly/cli@latest lint redocly-cafe-api.arazzo.yaml |
There was a problem hiding this comment.
| npx @redocly/cli@latest lint redocly-cafe-api.arazzo.yaml | |
| npx @redocly/cli lint redocly-cafe-api.arazzo.yaml |
Let's save some space...
| npx @redocly/cli@latest lint redocly-cafe-api.arazzo.yaml | ||
| ``` | ||
|
|
||
| ```bash |
There was a problem hiding this comment.
I'd not put several bash sections one after another. Either add a screenshot or just say something like this:
The tool will let you know that the description is valid.
| Every Arazzo file begins with a version declaration. | ||
| The latest stable version is `1.0.1`. |
There was a problem hiding this comment.
This is definitely redundant if you have basic familiarity with Arazzo. Either remove this or do add a separate guide on creating the Arazzo description itself.
|
|
||
| </details> | ||
|
|
||
| In addition to the success criterion declared in the Arazzo file, Respect performed three additional checks automatically: |
There was a problem hiding this comment.
You've already said this here: https://github.com/Redocly/website/pull/149/changes#diff-90b9281218ab219b15a4758675d34ce45fe04dfde843f556a82dd8ade246a351R140. Please avoid repeating yourself.
|
|
||
| ## Fix the schema | ||
|
|
||
| In `redocly-cafe-api.yaml`, change `MenuItemList` from an `array` to an `object` with `object`, `page`, and `items` properties so the schema matches the response the API actually returns: |
There was a problem hiding this comment.
Let's link this as a step to redocly-cafe-api.yaml's MenuItemList so we can see the difference between the schemas.
| npm install @redocly/cli@latest -g | ||
| redocly respect products.arazzo.yaml --verbose |
There was a problem hiding this comment.
Let's not confuse readers with different running options. Let's use the npx ... way everywhere.
There was a problem hiding this comment.
And that could be put into the Summary section anyway.
| After the schema is updated, the response body matches the documented contract. | ||
| This demonstrates the core value of contract testing with Respect: when the API and its OpenAPI description drift apart, the workflow highlights the mismatch immediately. | ||
|
|
||
| ## Practical applications |
There was a problem hiding this comment.
I'm not even sure we have to explain practical cases in this article. I'd restrict that to saying that from now on it could be used in a CI/CD pipeline to check if there's no divergency between the docs and the server.
What/Why/How?
Added two first articles related to practical usage of the Respect command.
The idea is to provide a set of ready-to-use articles/templates connected to the Redocly Cafe API, allowing users to easily explore how it works and adopt them for similar use cases.
Alternative Code Walkthrough Version => #300
Reference
Testing
Screenshots (optional)
Check yourself
Security