6.0 |
---|
sensorario / resources Goto Github PK
View Code? Open in Web Editor NEWA library to validate requests for web api
License: MIT License
A library to validate requests for web api
License: MIT License
I can define only Object types and not scalar ones. I need to define that a property should be an array or an integer (or other scalar types)
Remove all references at native RuntimeException
add CircleCI configuration
In case of API, a Request could have some allowed parameters. But the presence of a specific value, could remove to allowed others. Example:
type=[category|categoryGroup]
name
[categoryGroup]
categoryGroup is allowed only when type is categoryGroup.
For example, a parameter could allow others.
ValueObject::allow()
{
return [
'type' => 'category',
'allow' => 'categoryGroup',
];
}
As Developer,
I want to run bash commands,
so then I can reach GitHub web site pages directly from bash
improve contributing file
current composer version is too old
Suppose to have an api to search some value. And suppose you can d search for Peoples or Balls. When you search for People, you must define the name. When you search for Balls, you must define the color.
Search::box([
'what' => 'People'
]);
should through an exception, because name is missing. Correct search request values are:
Search::box([
'what' => 'People',
'name' => 'Simone',
]);
Otherwise, id you search for balls, will get an exception because name is not mandatory nor allowed.
Search::box([
'what' => 'Balls',
'name' => 'Simone',
]);
This is the right call
Search::box([
'what' => 'Balls',
'color' => 'red',
]);
Generate a script to check the coverage entire library
Implement, for example, toJson, toXml, toYaml methods. By default, could work with allowed.mandatory attributes.
The exception should explain class name of this object
. This error occurs when you define that a property must have a type with ValueObjec::types(), but this message does not explain which type.
In this example, a developer needs to define an allowed attribute for all resources:
return new Container([
'resources' => [
'p' => [
'constraints' => [
'allowed' => [
'resource_name',
],
'mandatory' => [
'uno',
'due',
'tre',
],
'defaults' => [
'uno' => 'bar',
'due' => 33333,
'tre' => 'mello',
],
]
],
'foo' => [
'constraints' => [
'allowed' => [
'resource_name',
],
'mandatory' => [
'foo',
'ciao',
'friend',
],
'defaults' => [
'foo' => 'bar',
'ciao' => 33333,
'friend' => 'mello',
],
'allowedValues' => [
'foo' => [
42,
'bar'
],
],
]
]
]
]);
There should be a global 'constratints' configuration, to allow all responses to inherit some attributes.
$obj = Foo::bar([
'foo' => '2015-16-17'
]);
echo get_class($obj->foo()); // DateTime()
When an update is made, CHANGELOG should be updated and the added content should be the same of the commit message.
When communication happens between SOAP web service that expects latin1 charset instead of utf-8, provide a way to force conversion of all request fields!
Remove all 2.X metadata information like UPGRADE files and CHANGELOG
If a property is an object and is not defined in the rules method, throw a new exception
All the classes created just for test purpose can be removed. Actually is not necessary a real class: instead of a real class, right configuration is enough. All classes inside tests/Resources folder could be replaced with Resource::box(). Starting from version 4.0 is not necessary a real instanced object. Resource::box accept a second parameter that accept the resource configuration.
Read configuration from a yaml file
This message is unclear: improve indicating the real kind of object
Instead of throw an exception, create a collection of errors, and return an unique error message with all errors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.