8000 Globally specify operation serializer options · Issue #94 · wvteijlingen/Spine · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jan 25, 2019. It is now read-only.

Globally specify operation serializer options #94

Open
markst opened this issue Aug 12, 2016 · 4 comments
Open

Globally specify operation serializer options #94

markst opened this issue Aug 12, 2016 · 4 comments

Comments

@markst
Copy link
markst commented Aug 12, 2016

We'd like to globally specify OmitNullValues as a default option when serializing, or perhaps even be able 8000 to specify endpoint specific options...

@wvteijlingen
Copy link
Owner
wvteijlingen commented Aug 21, 2016

What is your use case for this? Perhaps there is a way we can solve it without adding any more configuration options.

@markst
Copy link
Author
markst commented Aug 23, 2016

Current use case is as I mentioned, here's my Spine branch changes:

if isNewResource {
    URL = router.URLForResourceType(resource.resourceType)
    method = "POST"
    options = [.IncludeToOne, .IncludeToMany, .OmitNullValues]
} else {
    URL = router.URLForQuery(Query(resource: resource))
    method = "PATCH"
    options = [.IncludeID, .OmitNullValues]
}

@wvteijlingen
Copy link
Owner

Why do you want to omit null values? If it's because of overwriting attributes that weren't fetched, I recommend trying the dirty-checking branch.

@markst
Copy link
Author
markst commented Nov 28, 2016

thanks @wvteijlingen yeah dirty checking also achieves what I wish for. However this still requires me to create an instance of SerializeOperation to be able to assign options.

I'd like to be able to globally specify all SerializeOperations always dirty check.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0