-
Notifications
You must be signed in to change notification settings - Fork 149
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
Partial update with nil value when using PATCH api #266
Comments
Its a bit tricky to represent this in Swift (see a related question here: https://forums.swift.org/t/partial-encoding-for-patch-updates/13428) since OpenAPI has two concepts to consider:
In Swift, we have just Its a frustrating limitation of Swift's Codable implementation and i've not yet come across a great way of handling it. Do you have a suggestion on how you'd see it working in SwagGen? I'm curious because I'm also looking for a solution 😄 |
Hi @yonaskolb, @liamnichols: I have an idea for this and need next step instructions. Please take a look my gist SwagGen NullCodable Proposal · GitHub. In case, client knew when should encode the It work for me and need some discussion on this proposal, I can make a PR for this, but need some check: Add an additional command option for generate different version? Or given a default behavior like before? (I think this is not a breaking change) If some good suggestion, please feel free to tell me. 🙏 |
I created a PR for this situation, please take a look. 🙏 Maybe we shouldn't need to update any core of SwagGen but IMO build in this feature is good for some cases like use example: class SomeGenModel {
@NullCodable
var optionalValue: String?
// ...
}
var myGenModel = SomeGenModel()
myGenModel.$optionalValue.encodingOption = .encodeNull |
Hi everyone:
In example spec Rocket, api
UpdateProfileWithId
usingPATCH
to partial update value.But if in some cases we need to update ProfileUpdateRequest’s
name
be empty value, is it possible to adjust spec file to align the requirement?The text was updated successfully, but these errors were encountered: