mulesoft-labs / raml-javascript-generator Goto Github PK
View Code? Open in Web Editor NEWGenerate a JavaScript API client from RAML
License: Other
Generate a JavaScript API client from RAML
License: Other
See mulesoft-labs/raml-client-generator#15 for using Popsicle plugins.
We need to support OAuth 1.0 clients in the JavaScript generator. That means a promise-based reusable OAuth 1.0 library like https://github.com/mulesoft/js-client-oauth2. There also needs to be associated documentation generated in the JavaScript client README.
Migrated from mulesoft-labs/raml-client-generator#5.
Hi there, thanks for your work on this awesome library. I'm successfully instantiating the client in the Chrome, but I've noticed two inconsistencies between the generated client in node and browser environments.
try to make a request (e.g. client.resources.Resource.get()
), I'm getting an error saying client.request is not a function
.
**
I don't get this error in node however.**
It turns out in the browser, the request property on client is an Object and there is a request method on that object (which is the method needed in this instance). My temporary solution is to change line 70 of the generated client's index.js
to:
return client.request.request(reqOpts)
For example, when I call in the browser: client.resources.Resource.post({ foo: bar }, {headers: { 'Content-Type': 'application/x-www-form-urlencoded' }})
, my Content-Type
header doesn't get sent and I get an error from my server. However, using content-type
(lowercase) sends the correct header.
However, both uppercase/lowercase works fine in node.
7.1.2
to 7.2.0
.This version is covered by your current version range and after updating it in your project the build failed.
@commitlint/cli is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
7.1.2
to 7.2.0
.This version is covered by your current version range and after updating it in your project the build failed.
@commitlint/prompt is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
this file has
Client.prototype.request = popsicle
Client.prototype.form = Client.form = popsicle.form
Client.prototype.version = {{{stringify version}}}
Maybe first line should be
Client.prototype.request = popsicle.request
or similar?
I'm using raml-javascript-generator to generate resources on my client side that is written in Typescript.
What is missing is the type safety on raml client resources.
Generate an extra d.ts file the describe client should be enough and probably a trivial task.
2.16.0
to 2.17.0
.This version is covered by your current version range and after updating it in your project the build failed.
eslint-plugin-import is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 61 commits.
0499050
bump to v2.17.0
f479635
[webpack] v0.11.1
8a4226d
Merge pull request #1320 from bradzacher/export-ts-namespaces
988e12b
fix(export): Support typescript namespaces
70c3679
[docs] make rule names consistent
6ab25ea
[Tests] skip a TS test in eslint < 4
405900e
[Tests] fix tests from #1319
2098797
[fix] export
: false positives for typescript type + value export
70a59fe
[fix] Fix overwriting of dynamic import() CallExpression
e4850df
[ExportMap] fix condition for checking if block comment
918567d
[fix] namespace
: add check for null ExportMap
2d21c4c
Merge pull request #1297 from echenley/ech/fix-isBuiltIn-local-aliases
0ff1c83
[dev deps] lock typescript to ~
, since it doesn’t follow semver
40bf40a
[*] [deps] update resolve
28dd614
Merge pull request #1304 from bradennapier/feature/typescript-export-type
There are 61 commits in total.
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Global headers provided on client init do not work.
Reason: Every function call uses something like
{code}
var options = extend({ body: body, headers: {} }, opts)
{code}
i.e. forcefully defines a "headers" attribute. On the used "xtend" version of extend this is therefore overriding any global options set:
{code}
var options = extend({}, client._options, opts)
{code}
Resolution: Use version of "extend" supporting recursive extension.
There is a bug regarding the securitySchemes. If they are not specified the generation fails at support/api.js line 6.
Function call for REST URL like "/foo/{foo}" are documented as "client.foo({foo})" - which I would interpret as String value for the parameter.
Implementation shows a wrapper object is assumed:
client.foo({foo : "value"})
to add the value to URL (via "template" function).
2 Options:
Lets put some more content.. a lot more in the README. I dont have a good idea of what this project does, why you would use it, examples of how to use it, etc. The README is the place for this sort of stuff (or at least links to examples, etc). The current README leaves a lot to be desired as to the purpose and use of this project.
Right now in the request method the cert, key, and ca attribues are not copied.
In general it would be good to have control of the entitre options object, for agent setting proxies, etc. Let me know if u want to take care of it yourself or a via pull request
let reqOpts = {
url: baseUri.replace(//$/, '') + template(path, options.uriParameters),
json: !Buffer.isBuffer(options.body),
method,
headers,
formData: options.formData,
body: options.body,
qs: options.query,
options: options.options,
resolveWithFullResponse: true
};
3.11.0
to 3.11.1
.This version is covered by your current version range and after updating it in your project the build failed.
watchify is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 8 commits.
c3fe218
3.11.1
e90101b
Merge pull request #362 from digipost/upgrade-deps
d163b4f
upgrade dependencies: fix errors from npm audit
1917270
Merge pull request #351 from menzow/feature/update-docs
d232754
Merge pull request #357 from Kamil93/patch-1
d924e9b
Update readme.markdown
9ea8a65
Support for working with transforms
8147bc5
Add troubleshooting information for silenced errors
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
5.13.0
to 5.14.0
.This version is covered by your current version range and after updating it in your project the build failed.
eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
85a04b3
Fix: adds conditional for separateRequires in one-var (fixes #10179) (#10980) (Scott Stern)0c02932
Upgrade: [email protected] (#11401) (Ilya Volodin)104ae88
Docs: Update governance doc with reviewers status (#11399) (Nicholas C. Zakas)ab8ac6a
Fix: Support boundary spread elements in sort-keys (#11158) (Jakub Rożek)a23d197
New: add allowSingleLineBlocks opt. to padded-blocks rule (fixes #7145) (#11243) (richie3366)e25e7aa
Fix: comma-spacing ignore comma before closing paren (fixes #11295) (#11374) (Pig Fang)a1f7c44
Docs: fix space-before-blocks correct code for "classes": "never" (#11391) (PoziWorld)14f58a2
Docs: fix grammar in object-curly-spacing docs (#11389) (PoziWorld)d3e9a27
Docs: fix grammar in “those who says” (#11390) (PoziWorld)ea8e804
Docs: Add note about support for object spread (fixes #11136) (#11395) (Steven Thomas)95aa3fd
Docs: Update README team and sponsors (ESLint Jenkins)51c4972
Update: Behavior of --init (fixes #11105) (#11332) (Nicholas C. Zakas)ad7a380
Docs: Update README team and sponsors (ESLint Jenkins)550de1e
Update: use default
keyword in JSON schema (fixes #9929) (#11288) (Pig Fang)983c520
Update: Use 'readonly' and 'writable' for globals (fixes #11359) (#11384) (Nicholas C. Zakas)f1d3a7e
Upgrade: some deps (fixes #11372) (#11373) (薛定谔的猫)3e0c417
Docs: Fix grammar in “there’s nothing prevent you” (#11385) (PoziWorld)de988bc
Docs: Fix grammar: Spacing improve -> Spacing improves (#11386) (PoziWorld)1309dfd
Revert "Build: fix test failure on Node 11 (#11100)" (#11375) (薛定谔的猫)1e56897
Docs: “the function actually use”: use -> uses (#11380) (PoziWorld)5a71bc9
Docs: Update README team and sponsors (ESLint Jenkins)82a58ce
Docs: Update README team and sponsors (ESLint Jenkins)546d355
Docs: Update README with latest sponsors/team data (#11378) (Nicholas C. Zakas)c0df9fe
Docs: ...
is not an operator (#11232) (Felix Kling)7ecfdef
Docs: update typescript parser (refs #11368) (#11369) (薛定谔的猫)3c90dd7
Update: remove prefer-spread autofix (fixes #11330) (#11365) (薛定谔的猫)5eb3121
Update: add fixer for prefer-destructuring
(fixes #11151) (#11301) (golopot)173eb38
Docs: Clarify ecmaVersion doesn't imply globals (refs #9812) (#11364) (Keith Maxwell)84ce72f
Fix: Remove extraneous linefeeds in one-var
fixer (fixes #10741) (#10955) (st-sloth)389362a
Docs: clarify motivation for no-prototype-builtins (#11356) (Teddy Katz)533d240
Update: no-shadow-restricted-names lets unassigned vars shadow undefined (#11341) (Teddy Katz)d0e823a
Update: Make --init run js config files through linter (fixes #9947) (#11337) (Brian Kurek)92fc2f4
Fix: CircularJSON dependency warning (fixes #11052) (#11314) (Terry)4dd19a3
Docs: mention 'prefer-spread' in docs of 'no-useless-call' (#11348) (Klaus Meinhardt)4fd83d5
Docs: fix a misleading example in one-var (#11350) (薛定谔的猫)9441ce7
Chore: update incorrect tests to fix build failing (#11354) (薛定谔的猫)The new version differs by 38 commits.
af9688b
5.14.0
0ce3ac7
Build: changelog update for 5.14.0
85a04b3
Fix: adds conditional for separateRequires in one-var (fixes #10179) (#10980)
0c02932
Upgrade: [email protected] (#11401)
104ae88
Docs: Update governance doc with reviewers status (#11399)
ab8ac6a
Fix: Support boundary spread elements in sort-keys (#11158)
a23d197
New: add allowSingleLineBlocks opt. to padded-blocks rule (fixes #7145) (#11243)
e25e7aa
Fix: comma-spacing ignore comma before closing paren (fixes #11295) (#11374)
a1f7c44
Docs: fix space-before-blocks correct code for "classes": "never" (#11391)
14f58a2
Docs: fix grammar in object-curly-spacing docs (#11389)
d3e9a27
Docs: fix grammar in “those who says” (#11390)
ea8e804
Docs: Add note about support for object spread (fixes #11136) (#11395)
95aa3fd
Docs: Update README team and sponsors
51c4972
Update: Behavior of --init (fixes #11105) (#11332)
ad7a380
Docs: Update README team and sponsors
There are 38 commits in total.
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Continuing from mulesoft-labs/raml-client-generator#12, we should be able to configure options using the data object:
7.1.2
to 7.3.1
.This version is covered by your current version range and after updating it in your project the build failed.
@commitlint/config-angular is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
If you npm install raml-javascript-generator
and try to use it you get the following traceback:
module.js:338
throw err;
^
Error: Cannot find module 'camel-case'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (c:\Users\wfaust\Desktop\Development_git\specs\node_modules\raml-javascript-generator\lib\helpers\request-snippet.js:1:79)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
This is because the fix for #4 did not add camel-case
to the dependencies in package.json.
Probably is more related to Typescript than Javascript, but what about schema objects generation?
Actually I'm doing this task in java whit jaxrs generator (based on json schema used in raml).
I would like do to the same on client side.
Have you got any idea, how to achieve this extending this generator?
10.9.4
to 10.10.0
.This version is covered by your current version range and after updating it in your project the build failed.
@types/node is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
16.2.2
to 16.2.3
.This version is covered by your current version range and after updating it in your project the build failed.
browserify is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
add empty stub for the inspector
builtin module.
change the "browser" field link to the browser-field-spec repo instead of the old gist.
The new version differs by 5 commits.
cfd3af2
16.2.3
ae01d90
Merge pull request #1854 from mohd-akram/add-inspector-builtin
b1e61aa
Add inspector builtin
4190ed5
Merge pull request #1845 from farzonl/patch-1
32d0a05
fix ReadME link.
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
We have detected a problem with your Greenkeeper config file 🚨
Greenkeeper currently can’t work with your greenkeeper.json
config file because it is invalid. We found the following issue:
src/templates/package.json.ts
in the group default
must end with package.json
.Please correct this and commit the fix to your default branch (usually master). Greenkeeper will pick up your changes and try again. If in doubt, please consult the config documentation.
Here’s an example of a valid greenkeeper.json
:
{
groups: {
frontend: {
packages: [
'webapp/package.json',
'cms/package.json',
'analytics/package.json'
]
},
build: {
packages: [
'package.json'
]
}
},
ignore: [
'standard',
'eslint'
]
}
This files tells Greenkeeper to handle all dependency updates in two groups. All files in the frontend
group will receive updates together, in one issue or PR, and the root-level package.json
in the build
group will be treated separately. In addition, Greenkeeper will never send updates for the standard
and eslint
packages.
🤖 🌴
5.11.0
to 5.11.1
.This version is covered by your current version range and after updating it in your project the build failed.
tslint-config-airbnb is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 4 commits.
93cb605
5.11.1
6ff1e2e
chore: update sample
54e8021
chore: update dependencies
3abd09c
fix: wrong rule configuration
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Hi,
I have done npm install raml-javascript-generator
, however, when I attempt to actually require in the library in a script, it is failing:
This:
jsGen = require('raml-javascript-generator');
var output = jsGen.client("raw.raml");
Fails with this:
C:\devel\raml-generator-test
λ node .\index.js
module.js:341
throw err;
^
Error: Cannot find module 'raml-javascript-generator'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\devel\raml-generator-test\index.js:1:71)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
require('raml-javascript-generator/dist') appears to work (followed by other errors), but it not what the readme says, so seems incorrect.
Any help would be appreciated.
In case the RAML file ONLY has URLs with URL parameters (i.e. "/foo/{foo}") the generator is only spitting out in constructor.
{code}
setprototypeof(client, this)
{code}
but NO specific mappings like
{code}
this.bazz = new Resource5(client, '/bazz')
setprototypeof(client, this)
{code}
However, this causes this._client to be never set as the "client" created here is never injected.
Workaround:
Add setter in constructor:
{code}
this._client=client;
setprototypeof(client, this)
{code}
I have a URL /parse-order in my API. For this URL the following documentation is generated:
resources.parse-order
var resource = client.resources.parse-order;
However the actual code that is generated uses camelCase, so the documentation should instead read:
var resource = client.resources.parseOrder;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.