Skip to content

Using allOf for embedded structs #105

Closed Answered by vearutop
arvidfm asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you for an idea, now, with latest version, it is possible to make a reference to embedded struct with a field tag refer:"true", or y implementing jsonschema.EmbedReferencer on an embedded struct.

Please check an example of structure.

	type A struct {
		FieldA int `json:"field_a"`
	}

	type C struct {
		jsonschema.EmbedReferencer
		FieldC int `json:"field_c"`
	}

	type B struct {
		A      `refer:"true"`
		FieldB int `json:"field_b"`
		C
	}

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by vearutop
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants