fix(image): json type of struct property #1469
No reviewers
Labels
No Label
dependencies
duplicate
help wanted
invalid
kind/bug
kind/feature
needs reproduction
question
security
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/vikunja#1469
Loading…
Reference in New Issue
No description provided.
Delete Branch "dpschen/api:fix-thumb-property-json-type"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I think this fixes some errors when validating the json (e.g. https://try.vikunja.io/api/v1/docs.json) via https://editor.swagger.io/.
Preparation for possibly using generators like https://github.com/astahmer/openapi-zod-client.
But also doesn't hurt in general. Will also help if we intend to switch so OpenApi 3 somehow.
@ -27,3 +27,3 @@
ID string `json:"id"`
URL string `json:"url"`
Thumb string `json:"thumb,omitempty"`
Thumb string `json:"image,omitempty"`
This will change the name of the property in json. So with this change, the output will be
Wheras right now it's this:
Removed
I'm not sure if this property is even used. It looks like it isn't.
The Image type is used for the search results when searching for unsplash images to set them as background.
This is why I thought that this is the right thing to do:
That needs to be changed here: https://kolaente.dev/vikunja/api/src/branch/main/pkg/modules/background/unsplash/proxy.go#L52
That makes sense! Thx
acc572cb8e
to9cb3ecfd7d
I pushed an updated version. Still very unsure
The swagger editor seems to not complain about the file type anymore, looks like that was the problem.
I was mostly unsure about the second type. That's the golang type correct? Because e.g. for the unsplash proxy it was 'string' and I changed it to 'blob'.
They describe here
That seems to be the correct way to do it? Should we change that? I could do it, but don't know where it should be defined.
I think swaggo does not support that. The changes we did here in this PR are already a step forward and seem to work, so I'd say it's fine as it is now?
I think it does via mime-type. Not really important and I'm also unsure if these would apply because ours are delivered as blob? Curious here, do you know?
Might be that the mentioned example is from OpenAPI 3 so it's not relevant.
Agree!
There might be different mime types returned because the api does not impose any restrictions on the format of uploaded backgrounds and will only return them as is. Not sure how that would be properly documented with openapi.
Yes, that's what I meant. All good :)