google / google/gnostic

Is there a way to set up openapi examples from protobuf?

Open
#364 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
279
PR merge metrics
No merged PRs in 30d

Description

I am using [gnostic](https://github.com/google/gnostic) to output openapiv3 yaml files from protobuf. Furthermore, I am setting up a Mock server from openapiv3 using [Prism](https://meta.stoplight.io/), but I want to use the response from the examples specified. Is there a way to set up examples in protobuf and output them to openapiv3 in a format that can be used with prism's mock?

I want to output openapi yaml like this from protobuf.
```
responses:
'200':
description: OK
content:
application/json:
schema:
'$ref': '#/components/schemas/Pet'
examples:
cat:
summary: An example of a cat
value:
id: 2
name: Fluffy
dog:
summary: An example of a dog
value:
id: 1
name: Spot
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.