-
Notifications
You must be signed in to change notification settings - Fork 114
Multiple filter w/ include fix + internal routing fix + more #233
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
Changes from all commits
15873aa
88e92c5
4a4a180
62c00d9
a4b97fb
8bb500f
c68857a
ca1623a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| node_modules | ||
| coverage.html | ||
| coverage | ||
| complexity | ||
| npm-debug.log | ||
| jsonapi-server.cpuprofile |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,10 +13,12 @@ const writeTypes = require('./writeTypes.js') | |
| jsonApiGraphQL.with = app => { | ||
| const config = jsonApi._apiConfig | ||
|
|
||
| app.use(new RegExp(`${config.base}$`), graphqlHTTP({ | ||
| schema: jsonApiGraphQL.generate(jsonApi._resources), | ||
| graphiql: !!config.graphiql | ||
| })) | ||
| if (config.graphiql !== false) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what you mean, is !== false not a strict equivalency?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What we were suggesting was a new configuration property named |
||
| app.use(new RegExp(`${config.base}$`), graphqlHTTP({ | ||
| schema: jsonApiGraphQL.generate(jsonApi._resources), | ||
| graphiql: !!config.graphiql | ||
| })) | ||
| } | ||
| } | ||
|
|
||
| jsonApiGraphQL.generate = allResourceConfig => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ swagger._getSwaggerBase = () => { | |
| let basePath, host, protocol | ||
| if (jsonApi._apiConfig.urlPrefixAlias) { | ||
| const urlObj = url.parse(jsonApi._apiConfig.urlPrefixAlias) | ||
| basePath = urlObj.pathname.replace(/\/$/, '') | ||
| basePath = urlObj.pathname.replace(/(?!^\/)\/$/, '') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we use the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had to use something slightly different as javascript does not have a look behind in it's regex capabilities. The alternative works to the same effect: (?!^/)/$ |
||
| host = urlObj.host | ||
| protocol = urlObj.protocol.replace(/:$/, '') | ||
| } else { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pragmatic solution, but I'm not too thrilled about mutating
request.params.filter[key]. I'm going to have a look at the internal routing and check if we can used the processed filter there also.