Skip to content

Commit 4d17e29

Browse files
committed
Add motivation to readme
1 parent a1436c1 commit 4d17e29

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
# php-json-schema-model-generator
88
Creates (immutable) PHP model classes from JSON-Schema files.
99

10+
## Motivation ##
11+
12+
Simple example from a PHP application: you define and document an API with swagger annotations and JSON-Schema models. Now you want to use models in your controller actions instead of manually accessing the request data (eg. array stuff). Additionally your schema already defines the validation rules for the models. Why duplicate this rules into your manually written code? Instead you can set up a middleware which instantiates models generated with this library and feed the model with the request data. Now you have a validated model which you can use in your controller action. With full auto completion when working with nested objects. Yay!
13+
1014
## Requirements ##
1115

1216
- Requires at least PHP 7.2

tests/AbstractPHPModelGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ protected function getPropertyType(object $object, string $property): string
254254
* Get the annotated return type for an object method
255255
*
256256
* @param object $object
257-
* @param string $property
257+
* @param string $method
258258
*
259259
* @return string
260260
*/

0 commit comments

Comments
 (0)