Giter VIP home page Giter VIP logo

Comments (8)

johanbrandhorst avatar johanbrandhorst commented on September 28, 2024

Hm, that's odd, in our example protobuf file you can see that the example and pattern both make it into the generated file:

message ErrorResponse {
string correlationId = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
pattern: "^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$",
title: "x-correlation-id",
description: "Unique event identifier for server requests",
format: "uuid",
example: "\"2438ac3c-37eb-4902-adef-ed16b4431030\""
}];
ErrorObject error = 2;
}

"examplepbErrorResponse": {
"type": "object",
"properties": {
"correlationId": {
"type": "string",
"format": "uuid",
"example": "2438ac3c-37eb-4902-adef-ed16b4431030",
"description": "Unique event identifier for server requests",
"title": "x-correlation-id",
"pattern": "^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$"
},
"error": {
"$ref": "#/definitions/examplepbErrorObject"
}
}

Could you provide a test repo that reproduces the issue? Or better yet, make a contribution to our repo that exhibits the issue.

from grpc-gateway.

pafrench avatar pafrench commented on September 28, 2024

Please find attached a zip of a sample repo. that reproduces the issue.
imagery-warehouse-api-public-lite.zip

from grpc-gateway.

johanbrandhorst avatar johanbrandhorst commented on September 28, 2024

Thank you, with all due respect, I'm not going to download a zip file from a stranger on the internet. Could you please provide a github repository or gist or something where I can view the contents? Thanks.

from grpc-gateway.

pafrench avatar pafrench commented on September 28, 2024

I've created a private repo here, and have sent you an invite.

from grpc-gateway.

johanbrandhorst avatar johanbrandhorst commented on September 28, 2024

Sorry, that invitation expired, my bad, could you send it again please?

from grpc-gateway.

johanbrandhorst avatar johanbrandhorst commented on September 28, 2024

OK I can reproduce the issue. Seems like we only render the example when the field in question is used in the request body, not when it's part of the path or the query. I think we should be able to support including the example and other fields for non-body fields too.

from grpc-gateway.

johanbrandhorst avatar johanbrandhorst commented on September 28, 2024

Would you be interested in contributing a fix for this?

from grpc-gateway.

paul-french-ev avatar paul-french-ev commented on September 28, 2024

Would you be interested in contributing a fix for this?

I'd like to but honestly I don't have the spare time outside of work. However, we do have time set aside to work on innovation (exploration tasks). I could potentially work on this then (but we've just finished this iteration's task, so the next will be in a month or so).

from grpc-gateway.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.