|
1 |
| -# README |
| 1 | +# Documentation first API development |
2 | 2 |
|
3 |
| -This README would normally document whatever steps are necessary to get the |
4 |
| -application up and running. |
| 3 | +### What is Documentation-First Approach and its Benefits |
5 | 4 |
|
6 |
| -Things you may want to cover: |
| 5 | +The documentation-first approach, also known as design-first or API-first, emphasizes creating API documentation before writing any code.The documentation itself acts as a specification. |
7 | 6 |
|
8 |
| -* Ruby version |
| 7 | +### Benefits of Documentation-First Approach |
9 | 8 |
|
10 |
| -* System dependencies |
| 9 | +- **Clarity and Communication**: By documenting the API first, all team members, including developers, testers, and business stakeholders, have a clear understanding of the API's purpose and functionality. |
| 10 | +- **Early Feedback**: Documentation can be reviewed and validated by stakeholders before any code is written, allowing for early detection of potential issues or misunderstandings. |
| 11 | +- **Consistency**: Ensures that the implementation adheres strictly to the agreed-upon design, reducing the risk of discrepancies between the documentation and the actual API. |
| 12 | +- **Improved Collaboration**: Facilitates better collaboration between different teams (e.g., frontend and backend) as they can work from a shared, well-defined API specification. |
| 13 | +- **Better Testing**: Test cases can be derived from the documentation, ensuring comprehensive test coverage and validation against the specified API behavior. |
| 14 | +- **Ease of Maintenance**: Having a well-documented API makes it easier to maintain and update, as changes can be tracked and communicated effectively through the documentation. |
11 | 15 |
|
12 |
| -* Configuration |
| 16 | +By adopting a documentation-first approach, teams can create more reliable, understandable, and maintainable APIs, ultimately leading to better software quality and user satisfaction. |
13 | 17 |
|
14 |
| -* Database creation |
| 18 | +### OpenAPI Specification |
15 | 19 |
|
16 |
| -* Database initialization |
| 20 | +The OpenAPI Specification (OAS) is a standard for defining and describing RESTful APIs. It allows both humans and computers to understand the capabilities of a service without accessing its source code or documentation. |
17 | 21 |
|
18 |
| -* How to run the test suite |
| 22 | +OpenAPI uses a different specification: JSON Schema. This can be used to validate JSON even outside OpenAPI, and it’s a great tool; it’s really readable and easy to understand, but it’s a bit verbose. To fix that, we can use references: |
19 | 23 |
|
20 |
| -* Services (job queues, cache servers, search engines, etc.) |
| 24 | +e.g., OpenAPI schema: [Petstore Example](https://petstore3.swagger.io/#/) |
21 | 25 |
|
22 |
| -* Deployment instructions |
| 26 | +### Gem Used: `committee` |
23 | 27 |
|
24 |
| -* ... |
| 28 | +We used the `committee` gem for our API documentation and validation. It helps in ensuring that our API conforms to the OpenAPI specification. |
| 29 | + |
| 30 | +Altenative gem : [Skooma](https://github.com/skryukov/skooma), [Open-api-first](https://github.com/ahx/openapi_first) |
| 31 | + |
| 32 | +### Non Breaking change |
| 33 | + |
| 34 | +- Add headers to requests, only do validation if headers persent |
| 35 | + This is how the request validation added |
| 36 | +- For non-breaking changes, instead of returning errors, we log the errors. This approach helps in maintaining the stability of the API while still capturing any issues that need to be addressed. |
| 37 | + - this is how the response validation added |
| 38 | + |
| 39 | +### Documenation UI |
| 40 | + |
| 41 | +Scalar is add for open api schema UI |
0 commit comments