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

How to define this restful api using pb? #452

Closed
jinleileiking opened this issue Sep 5, 2017 · 6 comments
Closed

How to define this restful api using pb? #452

jinleileiking opened this issue Sep 5, 2017 · 6 comments

Comments

@jinleileiking
Copy link

I have a customize response:

{
    "code":0,
    "msg":"",
    "data":{
        "response":[
            {
                "key1":1474596715
            },
            {
                "key2":-1
            },
           {
                "........":-1
            }
 
        ]
    }
}

The key1, key2, .... are collected in the runtime. I do not know the keys.

@achew22
Copy link
Collaborator

achew22 commented Sep 5, 2017

What have you tried already?

@vaporz
Copy link
Contributor

vaporz commented Sep 5, 2017

"code", "msg", "data", so familiar to me, lol....
In your case, I think "json schema" may be helpful.
You can define "data" as a "string" in pb, but validate the format to its value with "json schema".

@jinleileiking
Copy link
Author

After 3 hour google , I use struct.proto to solve this f**king problem.

@vaporz
Copy link
Contributor

vaporz commented Sep 5, 2017

What is " struct.proto"? Any reference? Thanks.

@vaporz
Copy link
Contributor

vaporz commented Sep 6, 2017

Thanks!

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

3 participants