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

swagger annotations break the protolinter #128

Closed
KowsikaRamachandran opened this issue Apr 16, 2020 · 4 comments
Closed

swagger annotations break the protolinter #128

KowsikaRamachandran opened this issue Apr 16, 2020 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@KowsikaRamachandran
Copy link

KowsikaRamachandran commented Apr 16, 2020

I have tried to run protolinter on the proto files with swagger annotations, but itseems to break the linter with below error:

found ""max_length"(Token=2, Pos=..\protos\test.proto:179:5)" but expected [}] at C:/Users/uname/go/src/github.com/yoheimuta/go-protoparser/parser/field.go:243:found "ma
x_length" but expected at C:/Users/uname/go/src/github.com/yoheimuta/go-protoparser/internal/lexer/emptyStatement.go:16

Below is a sample proto message with annotations:

message UserCredentials {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = {
example: { value: '{ "email_id": "user@domain.com", "password": "password@123"}' }
};
string email_id = 1[(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {
pattern: "^-!#$%&'*+\/0-9=?A-Z^_a-z{|}~@a-zA-Z0-9\.a-zA-Z+$"
max_length: 254
min_length: 1
description: "Enter user email"
}];
string password = 2[(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {
description: "Enter user password"
}];
}

@yoheimuta
Copy link
Owner

@KowsikaRamachandran Thank you for reaching out!
I'm going to investigate it.

@yoheimuta yoheimuta self-assigned this Apr 16, 2020
@yoheimuta yoheimuta added the bug Something isn't working label Apr 16, 2020
@KowsikaRamachandran
Copy link
Author

KowsikaRamachandran commented Apr 17, 2020

Thank you for the response. Kindly investigate this issue using below example proto:
https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/internal/proto/examplepb/a_bit_of_everything.proto

@yoheimuta
Copy link
Owner

@KowsikaRamachandran I fixed it.
Please confirm https://github.com/yoheimuta/protolint/releases/tag/v0.25.1 and close it if it works fine.

@KowsikaRamachandran
Copy link
Author

Thanks! @yoheimuta, Linter works on swagger annotated protos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants