Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Use Input Filter keys as query whitelist #115

Merged
merged 5 commits into from
Jul 31, 2018

Conversation

e-belair
Copy link
Contributor

@e-belair e-belair commented Jul 26, 2018

Provide a narrative description of what you are trying to accomplish:

  • Are you creating a new feature?
    This feature make possible to use the input filter keys as query whitelist
    So we don't need to manually type each field in the admin page field
    I did not write unit tests because I want to know if it's a good idea or not
    So tell me.

How to use it?
Create an Input Filter for zf-content-validation like this:

    'zf-content-validation' => [
        'Album\\V1\\Rest\\Album\\Controller' => [
            'GET' => \My\InputFilter\AlbumListInputFilter::class,
        ],
    ],

And try a Rest GET query with of these keys and a value as query param

@coveralls
Copy link

coveralls commented Jul 26, 2018

Coverage Status

Coverage increased (+0.1%) to 83.535% when pulling fbc0036 on manuscle:master into 2603a61 on zfcampus:master.

Copy link
Member

@weierophinney weierophinney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will make a nice addition. I've made a comment below, and, otherwise, we need tests and updated docs (README.md) for this feature.

Thanks!

@@ -237,6 +237,12 @@ protected function setControllerOptions(array $config, RestController $controlle

$query = $request->getQuery();
$params = new Parameters([]);

// If a query Input Filter exists, use its keys as query whitelist
// instead of admin query whitelist field
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd argue we should merge those from configuration with those from the input filter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with that, I'll update the code

@weierophinney weierophinney merged commit fbc0036 into zfcampus:master Jul 31, 2018
weierophinney added a commit that referenced this pull request Jul 31, 2018
Use Input Filter keys as query whitelist
weierophinney added a commit that referenced this pull request Jul 31, 2018
Notes what release the new functionality was added in, and clarifies
that it applies to a `GET`-specific input filter.
weierophinney added a commit that referenced this pull request Jul 31, 2018
- Adds entry for #115
- Removes empty stub for 1.4.1
- Sets date for 1.5.0
weierophinney added a commit that referenced this pull request Jul 31, 2018
@weierophinney
Copy link
Member

Thanks, @manuscle!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants