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

unified stringPointer for *string #548

Conversation

Mashimiao
Copy link

Signed-off-by: Ma Shimiao mashimiao.fnst@cn.fujitsu.com

@@ -204,7 +204,7 @@
"type": "object",
"properties": {
"pageSize": {
"type": "string"
"$ref": "defs.json#/definitions/stringPointer"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit sticky, since the Markdown has pageSize as required but the Go has it as a pointer. I don't see the point of declaring hugepageLimits without setting both (in which case I don't think they should be pointers in either Go or JSON Schema), but I haven't read enough of the history to say for sure.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wking
Well, I'm a little confused about types in specs-go.
As you mentioned, pagesize is required, but it is declared as a pointer in GO.
As Namespace's property Path is optional, but it is declared as string type in GO.
So, is there is unified standard to indicate optional or required in GO?

@vbatts
Copy link
Member

vbatts commented Aug 30, 2016

@Mashimiao do you have a case where the JSON value for the cgrouppath is null?

@wking
Copy link
Contributor

wking commented Aug 30, 2016

On Tue, Aug 30, 2016 at 10:33:23AM -0700, Vincent Batts wrote:

@Mashimiao do you have a case where the JSON value for the
cgrouppath is null?

cgroupsPath is optional 1, and for most (all?) of our optional
settings we treat “unset” and “set to ‘null’” identically. I'm not
sure you can distinguish between those cases in Go without using
interface{}-based JSON parsing. For an example of the Markdown spec
explicitly equating “unset” and “set to ‘null’”, see 2.

@wking
Copy link
Contributor

wking commented Sep 29, 2016

On Thu, Sep 29, 2016 at 01:43:56AM -0700, Ma Shimiao wrote:

                                     "pageSize": {
  •                                        "type": "string"
    
  •                                        "$ref": "defs.json#/definitions/stringPointer"
    

@wking
Well, I'm a little confused about types in specs-go. As you
mentioned, pagesize is required, but it is declared as a pointer
in GO.

If it's required, I think it should not be a pointer in Go, and that
it should stay a string in the JSON Schema here. It should also be
added to a ‘required’ block in the JSON Schema (but it isn't at the
moment).

As Namespace's property Path is optional, but it is declared as
string type in GO.

This is less cut and dried. The current policy is in 1, and for
Namespace.Path I think not having a pointer is fine.

@Mashimiao Mashimiao force-pushed the unified-stringPointer-for-string branch from 2a98953 to 358a56d Compare January 12, 2017 01:46
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
@Mashimiao
Copy link
Author

@wking @opencontainers/runtime-spec-maintainers PTAL

@wking wking mentioned this pull request Jan 12, 2017
@wking
Copy link
Contributor

wking commented Jan 13, 2017

This is obsolete now that #653 has landed. #656 is also removing the cgroupsPath oneOf (among other things), so I think we can close this PR.

@hqhq hqhq closed this Jan 14, 2017
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

Successfully merging this pull request may close these issues.

4 participants