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

Including other files #657

Closed
stefan-endouble opened this issue Nov 3, 2016 · 3 comments
Closed

Including other files #657

stefan-endouble opened this issue Nov 3, 2016 · 3 comments

Comments

@stefan-endouble
Copy link

stefan-endouble commented Nov 3, 2016

Is there a way to configure dredd to include files?

Tried to use the comments used by aglio but of course don't work :).

Some more info about working with multiple files: https://gist.github.com/zdne/5f8295642af18aff27ec.

What command line options do you use?

$ dredd

What is in your dredd.yml?

dry-run: null
hookfiles: null
language: nodejs
sandbox: false
server: null
server-wait: 3
init: false
custom: {}
names: false
only: []
reporter: [markdown]
output: [dredd.out.md]
header: []
sorted: false
user: null
inline-errors: false
details: false
method: []
color: true
level: info
timestamp: false
silent: false
path: []
hooks-worker-timeout: 5000
hooks-worker-connect-timeout: 1500
hooks-worker-connect-retry: 500
hooks-worker-after-connect-wait: 100
hooks-worker-term-timeout: 5000
hooks-worker-term-retry: 500
hooks-worker-handler-host: localhost
hooks-worker-handler-port: 61321
config: ./dredd.yml
blueprint: docs.apib
endpoint: 'http://some.stage.domain.tld:8080'

What's your dredd --version output?

dredd v2.2.3 (Darwin 15.6.0; x64)

Does dredd --level=debug uncover something?

// docs.apib:4 <!-- include(common_data_structures.apib) -->
warn: Parser warning in file 'docs.apib': (warning code 5) ignoring unrecognized block on line 4

Can you send us failing test in a Pull Request?

yes, just create a file with

<!-- include(some_doc.apib) -->
@stefan-endouble stefan-endouble changed the title 🐛 Include of common *.apib documets gets ignore, e.g. <!-- include(file.apib) --> Include of common *.apib documets gets ignore, e.g. <!-- include(file.apib) --> Nov 3, 2016
@stefan-endouble stefan-endouble changed the title Include of common *.apib documets gets ignore, e.g. <!-- include(file.apib) --> Include of docs is ignored, e.g. <!-- include(file.apib) --> Nov 3, 2016
@stefan-endouble stefan-endouble changed the title Include of docs is ignored, e.g. <!-- include(file.apib) --> Including other files Nov 3, 2016
@honzajavorek
Copy link
Contributor

@stefan-endouble Thanks for filing this! Currently, the API Blueprint format doesn't support multiple files out of the box. It's not in the spec, but it's on API Blueprint's public roadmap (apiaryio/api-blueprint#8).

Aglio or other tools often overcome this limitation by their own solutions, such us the comment notation you mentioned. However, Dredd does not respect any of those notations as of now.

What we usually recommend is to use Hercule for composing the API Blueprint document from multiple files, since it's closest to our ideas how it should work (apiaryio/api-blueprint#8). You can employ it as part of your build step and then run Dredd on top of the final, compiled blueprint.

There's no plan to introduce custom support in Dredd for composing API Blueprint from multiple files (unless the team behind the format's spec will introduce the official, standard way), so I'll close this.

Still, thanks for bringing this up here as others may find this and get pointed at the right places 👍

@stefan-endouble
Copy link
Author

stefan-endouble commented Nov 3, 2016

Thanks @honzajavorek for the fast reply.

Would be nice to have a way to add required files in the configuration of dredd.yml like

blueprints: [../common.apib, docs.apib]

or

required: [../common.apib]
blueprint: docs.apib

And this would just concatenate the files and run on the end-result.

As my particular use case doesn't need the whole API tested, as testing each individual part has more value when debugging.

@honzajavorek
Copy link
Contributor

@stefan-endouble I think you can still achieve this having Hercule and testing either individual blueprints or the compiled blueprint.

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

No branches or pull requests

2 participants