Skip to content
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

REST: Serializing the entire body into one parameter #1422

Closed
wilzbach opened this issue Feb 12, 2016 · 2 comments
Closed

REST: Serializing the entire body into one parameter #1422

wilzbach opened this issue Feb 12, 2016 · 2 comments

Comments

@wilzbach
Copy link
Member

Hey I am just getting started with vibe.d, however I am struggling with this issue.

Let's say I have a more complex FooObject that my API expects. Is there an easy way to teach the REST API to accept a request body that is the entire object like {"a": "foo", "b": "bar"} for the example below?
In other words I would like to serialize the body into one attribute.

I know that best practices, but this is possible in most REST frameworks I have worked with and the still the default setting for most JS REST libs.

struct FooObject{
    string  a;
    string  b;
}
interface Example4API
{
    int createFoo(FooObject whole_body);
}
class Example4 : Example4API
{
    override:
            int createFoo(FooObject whole_body){
                    return 1;
            }

}
@IrenejMarc
Copy link
Contributor

Workaround (not my work, obviously):
https://gist.github.com/yannick/ffa037b2338f95f65e4e

@wilzbach
Copy link
Member Author

wilzbach commented Feb 6, 2017

duplicate of #1549

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

No branches or pull requests

2 participants