Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to parse YAML config as Json #16

Open
WizMe-M opened this issue Nov 12, 2024 · 3 comments
Open

Unable to parse YAML config as Json #16

WizMe-M opened this issue Nov 12, 2024 · 3 comments

Comments

@WizMe-M
Copy link

WizMe-M commented Nov 12, 2024

Context

I use local plugin from last release and buf.gen.yaml my config is:

inputs:
- directory: .
  paths:
  - module\api\service\ 

plugins:
  - local: ../../third_party/protoc-gen-openapiv3.exe # current dir is proto root
    out: gen/swagger/v3
    opt:
      - openapi_config=my_api_config.yaml

Actual behavior

When I call buf generate --template my_buf.gen.yaml (from proto root dir) openapi plugin responds with error:

protoc-gen-openapiv3.exe: failed to load global OpenAPI config file: failed to JSON marshal content: json: unsupported type: map[interface {}]interface {}

Expected behavior

No error and merged swagger for all services in module/api/service was generated

@peymanmortazavi
Copy link
Contributor

@WizMe-M could I possibly see your my_api_config.yaml.

I think this is something we need to resolve but I want to first ensure the problem is what I think it is. I bet when we load the YAML file, we get any as the key but JSON does NOT allow any or interface{} as the JSON keys, thus the issue.

@WizMe-M
Copy link
Author

WizMe-M commented Nov 12, 2024

Ah... I'm so sorry, I can't reproduce this issue.
I fixed it by accident and don't know what was the problem.
Pretty sure that it was located somewhere

services:
  selector: '.v1.FooService'
    methods:
      FooBar:
        responses: # there

I was trying to add docs for default (200) response.
iirc, it was either ref option, or name of response code (I named it without quotes at first).

I guess the root of the problem was in quotes for response code

@peymanmortazavi
Copy link
Contributor

@WizMe-M Ah yeah that makes sense. I'd like to, at some point, improve that. I'll keep this issue open so we can track it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants