Comments (7)
Also some questions @lezhnev74
This line should some kind of schema validation step, not data validation. It's rather strange to decline data here if schema is invalid. Probably this should go to cebe/php-openapi
instead
counting data befor validating its type is unsafe (especially for php 7.2). why we expecting items in data at all?
from openapi-psr7-validator.
Also schema validation is duplicated here
and here
I hope we can leave second only, it's more obvious
from openapi-psr7-validator.
Great points!
$this->parentSchema->items
.
Agree, this is too defensive. This should be delegated to the underlying package.count($data) && ! (is_array($data) && ArrayHelper::isAssoc($data))
This must make sure that the data is an array, and it has no string keys (which makes it a dictionary in terms of JSON). What would be a better check here? Ah, I jsut saw the PR. This code solves the problem:if (! is_array($data) || ArrayHelper::isAssoc($data)) {...
Also schema validation is duplicated here
.
Agreed. Let's leave justswitch
statement here. Again, sometimes my code is over defensive.
from openapi-psr7-validator.
- everything but counting is ok. counting is unsafe and really not needed. to check vector against array
is_array($data) && !ArrayHelper::isAssoc($data)
is enough. Counting on non countable would fail in 7.2+
from openapi-psr7-validator.
For 1 and 3 I can update #21 removing these additional checks
from openapi-psr7-validator.
Please, go ahead, sounds good!
from openapi-psr7-validator.
Done. Raised one more question in PR
from openapi-psr7-validator.
Related Issues (20)
- Relative paths in servers objects HOT 9
- Validating non string query parameters HOT 9
- Query string parameter validation of Arrays with `style: form` and `explode: false` HOT 5
- header names are supposed to be case insensitive HOT 1
- Add body validation for "multipart/form-data" requests HOT 3
- Content-Type:application/json with charset HOT 2
- Add parameters serialisation support HOT 1
- multipart with fields without content type won't pass validation HOT 1
- Get the name of the invalid property HOT 11
- Validation of callbacks HOT 6
- Improve urlencoded body parsing
- Add support for PSR-7 `Request` HOT 1
- Bug with oneOf and catch HOT 4
- Bug with numeric strings HOT 3
- Missing inner exception message/detail when using AnyOf/OneOf HOT 4
- Automatically casts numeric strings to integer even if spec says it's a string HOT 6
- Collaboration HOT 15
- Needless dependency on symfony/yaml HOT 4
- Implement complete support for Security schemas
- Strings passes validation against type: number, type: boolean etc.
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-psr7-validator.