@@ -12,7 +12,7 @@ You need to configure the generator to:
12
12
- Define OpenAPI schemas for custom ` io-ts ` codecs that can't be automatically derived
13
13
from the Abstract Syntax Tree (AST).
14
14
15
- ## Preparing external types packages
15
+ ## Preparing External Types Packages
16
16
17
17
To process ` io-ts ` types imported from other npm packages, ensure the following in the
18
18
external package's ` package.json ` :
@@ -39,21 +39,21 @@ external package's `package.json`:
39
39
2 . Specify the source entry point using the ` source ` field (for example,
40
40
` "source": "src/index.ts" ` )
41
41
42
- ## Defining custom codec schemas
42
+ ## Defining Custom Codec Schemas
43
43
44
44
For custom ` io-ts ` codecs (such as those using ` new t.Type(...) ` or complex types not
45
45
directly supported), you must define schemas manually using one of these methods:
46
46
47
- ### Method 1: Via openapi-gen.config.js (recommended for type authors )
47
+ ### Method 1: Via ` openapi-gen.config.js ` (Recommended For Type Authors )
48
48
49
49
You can define schemas directly within the package that declares the custom codecs:
50
50
51
51
1 . Create a file named ` openapi-gen.config.js ` in the root of the types package
52
52
53
53
2 . Update the package's ` package.json ` to include:
54
54
55
- - The ` customCodecFile ` field pointing to this file
56
- - The config file in the ` files ` array
55
+ - The ` customCodecFile ` field pointing to this file.
56
+ - The config file in the ` files ` array.
57
57
58
58
``` json
59
59
// package.json of the types package defining custom codecs
@@ -98,10 +98,10 @@ You can define schemas directly within the package that declares the custom code
98
98
The exported function receives the ` fp-ts/Either ` namespace (` E ` ) as an argument. You
99
99
should return an object where:
100
100
101
- - Keys are the exported names of your custom codecs
102
- - Values are functions that return ` E.right() ` with an OpenAPI schema object
101
+ - Keys are the exported names of your custom codecs.
102
+ - Values are functions that return ` E.right() ` with an OpenAPI schema object.
103
103
104
- ### Method 2: Via --codec-file option (for consumers )
104
+ ### Method 2: Via ` --codec-file ` Option (For Consumers )
105
105
106
106
You can define schemas in a configuration file within your project and pass the file
107
107
path via the ` --codec-file ` option:
@@ -132,8 +132,8 @@ path via the `--codec-file` option:
132
132
133
133
In this structure:
134
134
135
- - Keys of the top-level object are package names
136
- - Values are objects that map codec names to their schema definitions
135
+ - Keys of the top-level object are package names.
136
+ - Values are objects that map codec names to their schema definitions.
137
137
138
138
3 . Run the generator with the ` --codec-file ` option:
139
139
0 commit comments