Return $metadata resource as odata + openapi spec#528
Draft
fisehara wants to merge 4 commits into
Draft
Conversation
3ce2bb1 to
efc396d
Compare
d178dd7 to
1593dfb
Compare
08ed3e9 to
79a815c
Compare
7e03cea to
45841e6
Compare
45841e6 to
dcc6fcc
Compare
54bcbfc to
b39bec1
Compare
Contributor
Author
|
FYI @vipulgupta2048 |
ffadb18 to
6e86ce9
Compare
dbd8d4b to
f70416c
Compare
f70416c to
8476d71
Compare
8476d71 to
95ecd2c
Compare
JSReds
reviewed
Aug 26, 2022
| }; | ||
|
|
||
| type PermissionLookup = Dictionary<true | string[]>; | ||
| export type PermissionLookup = _.Dictionary<true | string[]>; |
There was a problem hiding this comment.
out of curiosity, what is the difference between lodash Dictionary and pinejs-client-core Dictionary ?
Contributor
Author
There was a problem hiding this comment.
@JSReds good catch. thx! This is a mistake. I only needed to export the PermissionLookup and not change the type.
Fixed to not use lodash dictionary.
da239da to
9b62b0e
Compare
e2841ca to
83b4198
Compare
|
@fisehara - would love to see this merged. I just set out to build a golang API wrapper for Balena and ran into the lack of |
Page-
reviewed
Nov 3, 2023
| } | ||
| }; | ||
|
|
||
| // paths./any/.get.responses.200.content.application/json.schema.d |
| * Used oasis translator generates openapi according to v4 spec (`value: `) | ||
| */ | ||
|
|
||
| Object.keys(openAPIJson.paths).forEach((i) => { |
Contributor
There was a problem hiding this comment.
I prefer a for-of in general:
Suggested change
| Object.keys(openAPIJson.paths).forEach((i) => { | |
| for (const i of Object.keys(openAPIJson.paths)) { |
Comment on lines
+42
to
+65
| if ( | ||
| openAPIJson?.paths[i]?.get?.responses?.['200']?.content?.[ | ||
| 'application/json' | ||
| ]?.schema?.properties?.value | ||
| ) { | ||
| openAPIJson.paths[i].get.responses['200'].content[ | ||
| 'application/json' | ||
| ].schema.properties['d'] = | ||
| openAPIJson.paths[i].get.responses['200'].content[ | ||
| 'application/json' | ||
| ].schema.properties.value; | ||
| delete openAPIJson.paths[i].get.responses['200'].content[ | ||
| 'application/json' | ||
| ].schema.properties.value; | ||
| } |
Contributor
There was a problem hiding this comment.
I prefer the pattern of:
Suggested change
| if ( | |
| openAPIJson?.paths[i]?.get?.responses?.['200']?.content?.[ | |
| 'application/json' | |
| ]?.schema?.properties?.value | |
| ) { | |
| openAPIJson.paths[i].get.responses['200'].content[ | |
| 'application/json' | |
| ].schema.properties['d'] = | |
| openAPIJson.paths[i].get.responses['200'].content[ | |
| 'application/json' | |
| ].schema.properties.value; | |
| delete openAPIJson.paths[i].get.responses['200'].content[ | |
| 'application/json' | |
| ].schema.properties.value; | |
| } | |
| const properties = openAPIJson?.paths[i]?.get?.responses?.['200']?.content?.[ | |
| 'application/json' | |
| ]?.schema?.properties | |
| if (properties?.value) { | |
| properties['d'] = properties.value; | |
| delete properties.value; | |
| } |
78f5a7e to
78b8394
Compare
78b8394 to
505f79b
Compare
584853e to
25d92ed
Compare
25d92ed to
f3705bb
Compare
f3705bb to
b2aabe7
Compare
b2aabe7 to
e4d0c5c
Compare
f4ee366 to
c589975
Compare
Returning odata and openapi specs in json format. Specs are scoped to the request permissions. Different users (roles) will receive different metadata endpoints and resources. Change-type: minor Signed-off-by: Harald Fischer <harald@balena.io>
Signed-off-by: Harald Fischer <harald@balena.io>
c589975 to
f29d400
Compare
Signed-off-by: fisehara <harald@balena.io>
Signed-off-by: fisehara <harald@balena.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Returning odata and openapi specs in json format.
Specs are scoped to the request permissions.
Different users (roles) will receive different metadata endpoints
and resources.
Change-type: minor
See: https://jel.ly.fish/thread-93132f4a-1885-43c4-ac8d-1c190052e7d9
See: https://jel.ly.fish/thread-4245cd32-8b76-4c1a-a195-c8615c41b321
Signed-off-by: Harald Fischer harald@balena.io