Skip to content

Commit dcc87e4

Browse files
authored
doc: Improve README. (#30)
1 parent 7bff052 commit dcc87e4

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OpenAPI Codegen
22

3-
⚠️ This project is in early stage, please check the issues to see what’s is missing! ⚠️
3+
⚠️ This project is in an early stage, please check the issues to see what’s missing! ⚠️
44

55
-> Insert logo and badges here
66

@@ -12,15 +12,15 @@ This will give you full auto-completion and type-safety of your APIs
1212

1313
**For backend:**
1414

15-
This will generate you everything to be able to deliver a perfect API, spec driven.
15+
This will generate everything you need to deliver a perfect API, spec driven.
1616

1717
## Getting started
1818

1919
```bash
2020
$ npx @openapi-codegen/cli init
2121
```
2222

23-
Follow the steps, this will generate you a configuration file (openapi-codegen.config.ts) and update your `package.json`
23+
Follow the steps, this will generate a configuration file for you (openapi-codegen.config.ts) and update your `package.json`
2424

2525
```bash
2626
$ yarn gen # or the defined alias
@@ -30,28 +30,28 @@ You should have a bunch of types / components ready to be used.
3030

3131
## Philosophy
3232

33-
In software development, the harder part is usually communication and more specifically documentation.
33+
In software development, communication between components and documentation around it is often no fun.
3434

35-
GraphQL did resolve this by having documentation part of the tooling (introspection), sadly this is often harder with REST API. OpenAPI can be an amazing tool, if, and if only the documentation and the actual implementation are aligned!
35+
GraphQL did resolve this by making documentation a part of the tooling (introspection), sadly this is often harder with REST APIs. OpenAPI can be an amazing tool, if, and only if the documentation (spec) and the actual implementation are aligned!
3636

3737
### Backend side
3838

39-
For this, we have two viable options from the backend perspective:
39+
There are two different approaches:
4040

41-
1. The OpenAPI is generated from the code (code first)
42-
2. The code is generated from OpenAPI (spec first)
41+
1. The OpenAPI spec is generated from the code (**code first**)
42+
2. The code is generated from the OpenAPI spec (**spec first**)
4343

44-
And this need to be linked to the type system of the language, so everything is connected, and we remove or update something that impact the final response, this is **automatically** reflected!
44+
In either case, there needs to be an integration with the type system of the language, so everything is connected, and as we remove or update something that impacts the final response, this is **automatically** reflected!
4545

46-
This library is to support the second option, spec first. By doing so, your documentation is not your last boring task on the list, but the first exiting one! Indeed, you can’t start coding without generating your types (models & controllers) from the specs.
46+
This library has chosen the second approach, **spec first**. By doing so, your documentation is not your final (boring) task on the list, but the first and exciting one when adding new functionality! Indeed, you can’t start coding without generating your types (models & controllers) from the specs.
4747

48-
This have few benefits:
48+
This has multiple benefits:
4949

5050
- You can take your time to think about your API before writing any code!
51-
- You can discuss the API with your team (and discover API design problem earlier)
51+
- You can discuss the API with your team (and discover API design problems earlier)
5252
- You can generate all your validation rules
5353

54-
As example, if you write this object in your schema:
54+
For example, if you add this object to your schema:
5555

5656
```yaml
5757
SignUpInput:
@@ -79,15 +79,15 @@ SignUpInput:
7979
- lastName
8080
```
8181
82-
OpenAPI Codegen will be able to generate all the relevant validation (or at least give you the choice to do it)
82+
OpenAPI Codegen will be able to generate all the relevant validation (or at least give you the choice to do it).
8383
84-
Note: You can also attach any custom logic with `x-*` tag, the possibilities are endless!
84+
Note: You can also attach any custom logic by using the `x-*` tag, the possibilities are endless!
8585

8686
### Frontend side
8787

88-
Having to reverse engineer a backend response is the least productive/fun task ever! This is why, with some nice OpenAPI specs, we can actually generate some nice types components.
88+
Having to reverse engineer a backend response is the least productive/fun task ever! However, given a nice OpenAPI specs, we can actually generate nicely typed code for you that lets you interact with your API in a safe manner.
8989

90-
Taking React as example, calling an API will be as simple as this:
90+
Taking React as example, calling an API can be as simple as this:
9191

9292
```tsx
9393
import { useListPets } from "./petStore/petStoreComponents"; // <- output from openapi-codegen
@@ -101,12 +101,12 @@ const App = () => {
101101

102102
And since this generated from the specs, everything is safe at build time!
103103

104-
Note: If you can’t trust your backend, some runtime validation can be useful to avoid surprise in production 😅
104+
Note: If you can’t trust your backend, some runtime validation can be useful to avoid surprises in production 😅
105105

106106
## Configuration
107107

108108
The only thing you need to manage is the configuration.
109-
Everything is typed and self documented, but just in case, you can find here an example configuration.
109+
Everything is typed and self-documented, but just in case, you can find here example configuration below:
110110

111111
```ts
112112
// openapi-codegen.config.ts
@@ -151,7 +151,7 @@ export default defineConfig({
151151
});
152152
```
153153

154-
You can import any generator into the `to` section, those can be provided by us or you, you have the full control of what you are generating!
154+
You can import any generator into the `to` section, those can be the ones provided by this project or your own custom ones. You have full control of what you are generating!
155155

156156
Have fun!
157157

0 commit comments

Comments
 (0)