Skip to content

Commit

Permalink
update replaceint
Browse files Browse the repository at this point in the history
  • Loading branch information
Oreoxmt committed Aug 7, 2022
1 parent e7cd6b7 commit b8effa2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,40 @@ Use [@apidevtools/json-schema-ref-parser](https://github.com/APIDevTools/json-sc

Use [openapi-snippet](https://github.com/ErikWittern/openapi-snippet) to generate code samples automatically.

### Convert string to int for int32 type in `.proto`

ToDo

### Import markown files
### Convert the example and default values of integer type to int

A `int32` type `port` defined in the `.proto` file is:

```proto
int32 port = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
format: "int32",
default: "8080",
example: "8080"
```

The default JSON generated by `bufbuild/buf` is:

```json
"port": {
"type": "integer",
"format": "int32",
"example": 8080,
"default": "8080"
}
```

`replaceint.js` replaces all integer values and the processed JSON file is:

```json
"port": {
"type": "integer",
"format": "int32",
"example": 8080,
"default": 8080
}
```

### Import markdown files

Embed external Markdown file contents to the `info.description` auto-generated JSON file. See [Redoc documentation](https://redocly.com/docs/api-reference-docs/guides/embedded-markdown/) for more information.

Expand Down
2 changes: 1 addition & 1 deletion src/replaceint.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ async function replaceInteger(readf, writef) {

}

module.exports = replaceInteger;
module.exports = replaceInteger;

0 comments on commit b8effa2

Please sign in to comment.