-
Notifications
You must be signed in to change notification settings - Fork 31
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
Store options metadata in datamodel (v3) #1611
Conversation
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.
🚀
src/codegen/Common.ts
Outdated
@@ -144,6 +144,13 @@ const common = { | |||
'Describes the location in the data model where the component should store its value(s). A simple ' + | |||
'binding is used for components that only store a single value, usually a string.', | |||
), | |||
IDataModelBindingsOptionsSimple: () => | |||
new CG.obj(new CG.prop('simpleBinding', new CG.str()), new CG.prop('metadata', new CG.str().optional())) |
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.
There should probably also be a description for the metadata
prop here as well, although I'm not sure if it's easily visible from vscode that way. I know people will wonder what it's for without any docs! 😊
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.
I'll add some description! 😁
src/utils/network/networking.ts
Outdated
export async function httpGetWithHeaders(url: string, options?: AxiosRequestConfig): Promise<any> { | ||
const headers = options?.headers as RawAxiosRequestHeaders | undefined; | ||
const response: AxiosResponse = await axios.get(url, { | ||
...options, | ||
headers: { ...headers, Pragma: 'no-cache' }, | ||
}); | ||
return response.data ? response : null; | ||
} |
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.
Not sure I like the name all that much.. It's not 'with headers', it's with the whole response object. Frankly I don't like the way we usually pluck out the data from the responses, so if I'm not sure if just renaming it to httpGetRaw()
would be better, or if we should just stop wrapping axios entirely. Anyway, it's all fine for v3, no need to be picky there.
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.
I agree the name is not that satisfying. I like httpGetRaw
better atleast 👍. Another option is to rename this one to httpGet
and the one that is httpGet
today to httpGetResponseData
.
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.
Yeah, but if you're renaming all usages you might as well just use httpGet(...)?.data
and just have one function to rule them all. The same then goes for all the http*
functions, so I'd prefer to clean it all up or leave it be.. 😊
SonarCloud Quality Gate failed.
|
Description
Allow for storing the metadata from retrieved code-lists in a specific field in the datamodel by introducing the
metadata
keyword to be used indataModelBindings
for components that use options.The metada can then be displayed by referencing the datamodel field where the metadata is stored after the options have been retrieved.
Related Issue(s)
Verification/QA
Add docs for options-metadata altinn-studio-docs#1264
kind/*
label to this PR for proper release notes grouping