Comments (23)
That worked! Thanks :)
from widdershins.
Are you able to test with the beta of widdershins v3.0.0 ? It's in the v3.0
branch on github only at the moment. If it's easier I can see about releasing a beta on npm.
You (temporarily) need to add the -x
switch to use the new templates etc.
In v3 the output completes, though some of the examples are very large due to deeply nested models. You can mitigate this by using the --maxDepth
option.
$ node widdershins.js -x test/issue65.json -o out/issue65b.md
Compiling all doT templates...
Loaded def authentication.def
Loaded def authentication_none.def
Loaded def callbacks.def
Loaded def debug.def
Loaded def discovery.def
Loaded def footer.def
Loaded def links.def
Loaded def parameters.def
Loaded def responses.def
Loaded def security.def
Compiling code_http.dot to function
Compiling code_java.dot to function
Compiling code_javascript.dot to function
Compiling code_nodejs.dot to function
Compiling code_python.dot to function
Compiling code_ruby.dot to function
Compiling code_shell.dot to function
Compiling main.dot to function
Compiling operation.dot to function
Compiling translations.dot to function
# sampler Maximum call stack size exceeded
............................................
from widdershins.
You reply so fast! :)
Are there instructions on how I can build v3 locally somewhere? I'm afraid I'm not that familiar with the Javascript stack.
from widdershins.
As to any problems with your definition, I can see a number of paths with {project}
templated parameters, but no parameter array entry for them.
from widdershins.
Sorry about that, I meant to replace {project}
before posting the file.
from widdershins.
You should be able to clone the repo, check out the v3.0
branch and do npm i
and things should just work. But the offer to release a beta on npm is still there. As to fast, I was looking at another issue on github at the time, so I saw the notification... And I'm actively looking out for test cases for v3. 😄
from widdershins.
Sorry about the dumb question, but I ran npm i
and it went fine (output was: added 100 packages in 3.642s
). How do I use the version that I built? widdershins --version
stil says 2.2.4.
from widdershins.
If you have widdershins installed globally, it may be picking up that version, but the other reason is I'd forgotten to update the version in package.json
. 😨
If you node widdershins.js
in the checked-out directory it should use the local copy.
The output of node widdershins --help
should have the following entries:
--expandBody Expand requestBody properties in parameters [boolean]
--headings Levels of headings to expand in TOC[number] [default: 2]
--resolve Resolve external $refs [boolean]
--summary Use summary instead of operationId for TOC [boolean]
-e, --environment Load config/override options from file [string]
-m, --maxDepth Maximum depth for schema examples [default: 10]
-x, --experimental Use experimental template mode [boolean]
from widdershins.
I tried this, but got 2.2.9:
➜ widdershins git:(v3.0) npm i -g
/usr/local/bin/widdershins -> /usr/local/lib/node_modules/widdershins/widdershins.js
+ [email protected]
removed 4 packages and updated 5 packages in 1.165s
➜ widdershins git:(v3.0) ✗ widdershins --version
2.2.9
That seems to be right though (as you say), because:
➜ api git:(swagger2) ✗ widdershins -x openapi.0.3.json --maxDepth 2
Compiling all doT templates...
Loaded def authentication.def
Loaded def authentication_none.def
Loaded def callbacks.def
Loaded def debug.def
Loaded def discovery.def
Loaded def footer.def
Loaded def links.def
Loaded def parameters.def
Loaded def responses.def
Loaded def security.def
Compiling code_http.dot to function
Compiling code_java.dot to function
Compiling code_javascript.dot to function
Compiling code_nodejs.dot to function
Compiling code_python.dot to function
Compiling code_ruby.dot to function
Compiling code_shell.dot to function
Compiling main.dot to function
Compiling operation.dot to function
Compiling translations.dot to function
# sampler Maximum call stack size exceeded
........................
and then it works :) Should I be concerned about that # sampler Maximum call stack size exceeded
?
from widdershins.
Yes, if you're seeing Loaded def
and lines of ...
instead of repeated sampler errors you're definitely running v3.0! I'll fix the version string in a mo. Don't forget to play about with --maxDepth
to get a reasonably-sized output file.
And thanks for testing it!
from widdershins.
Should I be concerned about that # sampler Maximum call stack size exceeded
That just means you have one or more circular references in your schema models. Widdershins now tries a number of back-off strategies to try and get an example generated. One of which is to replace circular references with [Circular]
(which slightly unfortunately comes out as null
in the generated example).
Probably the best option is to add a real-life example
property to the OpenAPI 3.0 definition which will override the generated one(s).
from widdershins.
Thank you for the great help as always!:)
from widdershins.
It would actually be nice with a beta version on npm because then I could use that in our CI pipeline without having to add a git clone && npm i
step. :) Or do you have an approximate idea of when v3 will be released?
from widdershins.
No problem, will just check on marking a release as a beta, then ping you when it's there.
from widdershins.
Looks like that worked, you'll need to ensure you install [email protected]
for this specific version or widdershins@beta
to track this and any future betas.
from widdershins.
I tried installing that but got this:
➜ ~ npm install -g [email protected]
/usr/local/bin/widdershins -> /usr/local/lib/node_modules/widdershins/widdershins.js
+ [email protected]
updated 2 packages in 4.64s
➜ ~ widdershins --version
module.js:529
throw err;
^
Error: Cannot find module 'js-yaml'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/widdershins/widdershins.js:8:14)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
Is there something wrong with my system?
from widdershins.
Possibly... what version of Node.js and npm are you running?
from widdershins.
➜ api git:(swagger2) node --version
v8.6.0
➜ api git:(swagger2) npm --version
5.5.1
from widdershins.
Hmm, I'd hope they'd be ok. I'll try installing it on another machine.
from widdershins.
Should I try to upgrade node?
from widdershins.
No, I'm only on v8.7.0 and we test on v4.x and v6.x as well. I suspect something is wrong in the package-lock.json
(or it's an npm
bug) but I need to investigate which.
from widdershins.
Thanks! Let me know if there's anything I can do.
from widdershins.
Ok, I've tried installing on another machine and widdershins --version
works ok. Can you try blowing away the node_modules
folder (probably /usr/local/lib/node_modules/widdershins/node_modules/
) and reinstalling?
from widdershins.
Related Issues (20)
- Support custom media type HOT 6
- Add option "--header-offset"
- Add support for OpenRPC
- Support for AsyncAPI version 2.2
- headingLevel is getting overriden to default value i.e 2.
- Vulnerability for package [email protected] in widdershins
- Upgrade to [email protected] to fix yargs-parser vulnerability
- CODE SAMPLES ERROR WIDDERSHINS + SLATE
- node can't find widdershins module after npm install is run HOT 2
- Any programmable API? HOT 1
- shins dependency is including vulnerable jquery version 3.2.1
- Missing body parameter code for API languages other than JavaScript HOT 2
- User defined data fields to be used in templates
- user_template is not well defined HOT 1
- Could not get ToC to generate
- Generate Markdown with no html headers
- Bump version of httpsnippet
- Error picking up user templates HOT 1
- Multiline markdown in response examples breaks table in Markdown
- Resolving external refs and showing as links
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from widdershins.