IBM / openapi-validator

Configurable and extensible validator/linter for OpenAPI documents
Apache License 2.0
481 stars 88 forks source link

support for RPC style HTTP calls #647

Closed michelecurioni closed 6 months ago

michelecurioni commented 6 months ago

Hi, we'd like to introduce an RPC style to our API that follows this structure: https://service.name/v1/some/resource/name:customVerb

Up to now we mandated that all path segments be snake case, so the above endpoint would fail rule ibm-path-segment-casing-convention.

Can you suggest a way to incorporate the ":/customVerb" in the above rule? Or a way to ignore the ":customVerb" part?

"customVerb" should be camel case, but we can probably be lenient and accept any case for that part.

Thanks, Michele

dpopp07 commented 6 months ago

Hi @michelecurioni

RPC is not supported in OpenAPI v3 (it looks like it won't be supported until v4, so I don't know how you would configure the validator to support those patterns. I don't think it's within our scope to make a provision for.

michelecurioni commented 6 months ago

@dpopp07 thanks for that link, interesting discussion, but I don't want to focus on the RPC semantics. I simply wondered if there is an easy way to customize the rule to ignore a part of the url.

dpopp07 commented 6 months ago

I see. There is a way, but I wouldn't necessarily call it easy 🙂

There's not a simple option for controlling this but you can provide your own implementation for the rule that replaces or augments ours. There is some documentation for this style of customization here.

michelecurioni commented 6 months ago

Thanks, I've implemented a custom rule for this