Skip to content

Commit

Permalink
Implement validation rule builder and parser (#20)
Browse files Browse the repository at this point in the history
* WIP: Implement a documentated validation through builder

Allow the validation to the endpoints to be declared through a validation rule
builder that can then also be used to generate documentation from these defined
rules.

Each rule is stored as an object that has a documentation line associated with
it. This method, while repetitive, ensures that the validation rules remain
compatible with Laravel's validator while still remaining discoverable through
code.

* Add more validation rules

* Start work on recursive validation rules and rendering docs

* WIP: Object rule builder

* Rewrite validation builder structure to allow nesting

Objects and arrays can now be nested arbitrarily deep.

* Add more testing of the validation rules

* Fix incorrect namespace for RulesTest

* Update travis with codecov

* Add code coverage badge to readme

* Show the array types in the documentation

* Fix array validation when element type is defined

* Add typescript interface of the validation rules

* Remove dead code

* Fix many docs and type errors

phpstan level set to the highest level 8

* Add missing import

* Fix remainder of type errors
  • Loading branch information
drtheuns authored Feb 28, 2020
1 parent cd2cbe2 commit 0058b13
Show file tree
Hide file tree
Showing 129 changed files with 4,672 additions and 153 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ install:
- travis_retry composer update --prefer-dist --no-interaction --prefer-stable --no-suggest

script:
- composer test
- composer test -- --coverage-clover=coverage.xml

after_success:
- bash <(curl -s https://codecov.io/bash)
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Apitizer

[![Build Status](https://travis-ci.org/drtheuns/apitizer_php.svg?branch=master)](https://travis-ci.org/drtheuns/apitizer_php)
[![codecov](https://codecov.io/gh/drtheuns/apitizer_php/branch/master/graph/badge.svg)](https://codecov.io/gh/drtheuns/apitizer_php)

Apitizer is a Laravel library that primarily offers a Query Builder that allows
you to easily create documented API endpoints that are capable of filtering,
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"require-dev": {
"phpunit/phpunit": "^8.5",
"orchestra/testbench": "^4.0",
"mockery/mockery": "^1.3"
"mockery/mockery": "^1.3",
"nunomaduro/larastan": "^0.5.2"
},
"autoload": {
"psr-4": {
Expand All @@ -38,6 +39,7 @@
},
"scripts": {
"test": "./vendor/bin/phpunit",
"coverage": "./vendor/bin/phpunit --coverage-html coverage"
"coverage": "./vendor/bin/phpunit --coverage-html coverage",
"analyse": "./vendor/bin/phpstan analyse"
}
}
Loading

0 comments on commit 0058b13

Please sign in to comment.