Comments (13)
@acabarbaye I created a PR last friday. It just needs to be reviewed and the feature should work.
from openapi-style-validator.
Hi @acabarbaye ,
There will be a new parameter for this, it has been added last week with this issue: #135
We should release a new version with this improvement somewhere next week. In the meantime, you can compile the code of the project in the master.
Let me know if this new feature is ok for your use case.
from openapi-style-validator.
@acabarbaye It has been released in version 1.5. Please let us know if it's working for you and we will close this issue :)
from openapi-style-validator.
@JFCote : has version 1.5 made it to maven central or Jcenter?
> Could not find org.openapitools.openapistylevalidator:openapi-style-validator-cli:1.5.
Searched in the following locations:
- https://jcenter.bintray.com/org/openapitools/openapistylevalidator/openapi-style-validator-cli/1.5/openapi-style-validator-cli-1.5.pom
- https://jcenter.bintray.com/org/openapitools/openapistylevalidator/openapi-style-validator-cli/1.5/openapi-style-validator-cli-1.5-all.jar
- https://repo.maven.apache.org/maven2/org/openapitools/openapistylevalidator/openapi-style-validator-cli/1.5/openapi-style-validator-cli-1.5.pom
- https://repo.maven.apache.org/maven2/org/openapitools/openapistylevalidator/openapi-style-validator-cli/1.5/openapi-style-validator-cli-1.5-all.jar
Just to be sure I understand the new feature, for my case, I should define the following options?
{...
"validateNaming": true,
"ignoreHeaderXNaming": true,
"headerNamingStrategyConvention": HyphenCase,
}
from openapi-style-validator.
@acabarbaye Oh! It seems the release didn't make its way to Maven. I will check with @jmini who did the release. Will update here when it's ready.
As for your problem, I now see that it will not fix your issue because the naming of your header is not the same. At first glance, I thought that it was the same thing as #135
What you need would be an option to completely ignore the naming of headers. I will think about it. Maybe a new "naming strategy convention" that will be Anything
?
from openapi-style-validator.
@acabarbaye There was a problem during the release, the 1.5 was lost. It has been generated again and it's there! https://repo1.maven.org/maven2/org/openapitools/openapistylevalidator/openapi-style-validator-lib/1.5/
from openapi-style-validator.
@acabarbaye There was a problem during the release, the 1.5 was lost. It has been generated again and it's there! https://repo1.maven.org/maven2/org/openapitools/openapistylevalidator/openapi-style-validator-lib/1.5/
Perfect.
I will give it another try but I think your suggestion of having a Anything
option would make a lot of sense
from openapi-style-validator.
I have documented some official headers like Accept-Encoding
and If-None-Match
. However they did not pass any naming convention. I tried AnyCase
but received a NullPointerException.
Anyway, Can't we exclude official headers from the naming convention validation or include a naming convention that match the official "Hyphen-Upper-Case" ? And/or maybe ensure that official headers match the official naming convention ?
Edit; The NullPointerException is gone with v1.6.
from openapi-style-validator.
@gervaisb Just to be sure, is it ok now or do you still have problems with the AnyCase
naming convention?
from openapi-style-validator.
Well the issue with AnyCase
is that it accept anything. I still feel that there is a missing HyphenUpperCase style to validate headers like Accept-Encoding
.
from openapi-style-validator.
Hello. Can we reopen that issue ?
I have tried the version 1.7 but the "Hyphen-Upper-Case" cause a NPE.
Exception in thread "main" java.lang.NullPointerException
at org.openapitools.openapistylevalidator.NamingValidator.isNamingValid(NamingValidator.java:82)
at org.openapitools.openapistylevalidator.OpenApiSpecStyleValidator.validateNaming(OpenApiSpecStyleValidator.java:207)
at org.openapitools.openapistylevalidator.OpenApiSpecStyleValidator.validate(OpenApiSpecStyleValidator.java:35)
at org.openapitools.openapistylevalidator.cli.Main.validate(Main.java:62)
at org.openapitools.openapistylevalidator.cli.Main.validateAndPrint(Main.java:47)
at org.openapitools.openapistylevalidator.cli.Main.main(Main.java:36)
I would like to:
- Patch
OpenApiSpecStyleValidator.validateNaming(..)
so that it accepts the "Hyphen-Upper-Case" naming convention. - Update
README.md
to document that naming convention. - Manage this
NullPointerException
to provide a detailed error message with all supported naming convention.
from openapi-style-validator.
@gervaisb Issue reopened!
from openapi-style-validator.
I have tried the version 1.7 but the "Hyphen-Upper-Case" cause a NPE.
I do not know what happened with 1.7, but I have made another attempt right now (Oct. 5 2021) and it seems that HyphenUpperCase
is a supported naming convention in version 1.7. 🎉
Anyway, I still have to update the README and manage the NullPointer. However, the NullPointerException occurs because Gson ignores unknown values for enums. So we have to either validate that there are no null
naming conventions in ValidatorParameters
(once parsed), but then we do not have the original values to provide a complete error message. Another solution would be to validate them against the enum values before the parsing (this is my favourite solution).
Whatever the choice, the Main
class does not have a validation mechanism for the parameters. A quick solution would be to validate into the Main
class, right after optionManager.getOptionalValidatorParametersOrDefault
(L62) and throws IllegalArgumentException
that will be caught aside of the ParseException
(L42). But this is not ideal and there should be a more complete solution to validate the parameters/options.
Do you have any advice on where and how that validation should be implemented?
from openapi-style-validator.
Related Issues (20)
- Create a github action that release on Maven when we create a tag HOT 2
- Dependency issue with the gradle plugin HOT 3
- Validation for multiple Spec files in the same repository HOT 11
- The build is broken HOT 1
- is any tools with validate the openApi param by the Java annotation of io.swagger.v3.oas.annotations.media.Schema HOT 3
- Update README.md to talk about the Maven and Gradle plugin and how to use it.
- Add custom validation rules HOT 2
- Allow more granularity in paramater naming convention configuration HOT 6
- Remove .idea folder from the project and replace it with .editorconfig
- Use Graalvm for native binary support for CLI
- Required fields are not validated when creating a model inside an allOf HOT 1
- Pascal Case Support HOT 7
- Typo in specs/options.json HOT 2
- '_links' -> property should be in camelCase HOT 2
- 👍 Thanks for opening this issue!
- Schema name validation feature
- Schema name validation in Maven plugin release HOT 5
- Recursive property name validation feature HOT 1
- Enum value validation feature HOT 1
- Tags validation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openapi-style-validator.