Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transformations for doc capture #221

Closed
tsiq-karold opened this issue Dec 7, 2018 · 4 comments
Closed

Transformations for doc capture #221

tsiq-karold opened this issue Dec 7, 2018 · 4 comments
Assignees

Comments

@tsiq-karold
Copy link
Collaborator

This should be used sparingly but for list responses for example, it's likely that in docs you'll only want one or two items. Supporting transformations at capture time will allow one to use somewhat sophisticated logic for selecting what to show in docs.

@tsiq-karold
Copy link
Collaborator Author

Discussed this with @MykolaGolubyev, we propose the syntax listed below. This is based on an example response:

{
   "ints": [1,2,3,4,5],
    "strings": ["a", "b", "ab", "abc", "ba"]
}

Simple response filter:

http.doc.filterResponse('ints', anInt -> anInt > 3)

Would generate:

{
   "ints": [4,5],
    "strings": ["a", "b", "ab", "abc", "ba"]
}

Multiple filters:

http.doc
    .filterResponse('ints', anInt -> anInt > 3)
    .filterResponse('strings', str -> str.startsWith('a')
    .capture()

Would generate:

{
    "ints": [4,5],
    "strings": ["a", "ab", "abc"]
}

The reason for the fluid API with filterResponse methods is to allow us to later add filtration of requests, headers, etc.

Such capture calls should capture the unfiltered body in the existing path/filename and the filtered body in a file with a filtered infix (i.e. response.filtered.json).

@MykolaGolubyev
Copy link
Member

Is this still relevant?

@MykolaGolubyev
Copy link
Member

@tsiq-karold ^

@tsiq-karold
Copy link
Collaborator Author

It's relevant in that we still don't have support for it but I don't have a need for it any more.

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

No branches or pull requests

2 participants