---
# System prepended metadata

title: OpenApi spec to proto grpc

---

# OpenApi spec to proto grpc

### Attempt #1 openapi2proto

- https://github.com/nytimes/openapi2proto
- doesn't support most of open api schema v3
- wouldn't recommend since it skips types and endpoints silently
- Result: https://gist.github.com/mpetrunic/49fa7e6b9e945a18d7762edb21fdf200
- Commands:
```bash
yarn global add swagger-cli
swagger-cli bundle -r -o bn-openapi-bundle.yaml -t yaml beacon-node-oapi.yaml 
go get -u github.com/NYTimes/openapi2proto/cmd/openapi2proto
openapi2proto -spec bn-openapi-bundle.yaml -annotate
```

## Attempt #2 gnostic-grpc

- https://github.com/googleapis/gnostic-grpc
- seems like it does better job then openapi2proto
- still has some unsupported stuff (see warnings secontion)
- Result: https://gist.github.com/mpetrunic/193ca6111cb232b5b7a30be8e3241c9e
- Warnings: https://gist.github.com/mpetrunic/2a9437e642bba2129e9e4afa93f2eea6
    - some warnings will be resolved with https://github.com/ethereum/eth2.0-APIs/pull/43
    - Main issue is not supported polymorhphism (errors with allOf) but it says [here](https://github.com/googleapis/gnostic/pull/169) it's solved 6 days ago so maybe it's not yet released
- - Commands:
```bash
yarn global add swagger-cli
swagger-cli bundle -r -o bn-openapi-bundle.yaml -t yaml beacon-node-oapi.yaml
go get -u github.com/googleapis/gnostic
go get -u github.com/googleapis/gnostic-grpc
gnostic --grpc-out=examples/bn bn-openapi-bundle.yaml
```