curl-runnings-0.17.0: A framework for declaratively writing curl based API tests
Safe HaskellNone
LanguageHaskell2010

Testing.CurlRunnings.Internal.Parser

Description

Internal module for parsing string based directives inside of curl runnings suites. Use this module at your own risk, it may change. Currently, string interpolation can be performed, where interpolated values are json quries into responses from past test cases.

"$<RESPONSES[0].key[0].another_key>"

here the RESPONSES keyword references the results of previous test cases. Here, the whole string is a query, so if the value referenced by this query is itself a json value, the entire value will replace this string in a json matcher. Additionally, interpolation of the form:

"some text to interpolate with $<RESPONSES[0].key.key>"

will substitute a string found at the specified query and subsitute the string.

Rules for the language are similar to JQ or regular JSON indexing rules. All queries must start with a RESPONSES[integer] index, and be written between a

 $< ... >

to signify an interpolation. You can have mutliple queries inside a single string, but if interpolation is occuring, then the query specified must resolve to a string value. Otheriwse, a type error will be thrown.

Synopsis

Documentation

parseQuery :: FullQueryText -> Either QueryError [InterpolatedQuery] Source #

Given some query text, attempt to parse it to a list of interplated query objects. This data representation may change.