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

Swagger schema generation fails for embedded structs #229

Closed
awrichar opened this issue Oct 6, 2021 · 3 comments · Fixed by #230
Closed

Swagger schema generation fails for embedded structs #229

awrichar opened this issue Oct 6, 2021 · 3 comments · Fixed by #230
Assignees

Comments

@awrichar
Copy link
Contributor

awrichar commented Oct 6, 2021

If you specify a route with an input value that includes an embedded struct, such as MessageInOut:

	JSONInputValue:  func() interface{} { return &fftypes.MessageInOut{} },

Then make swagger fails with:

--- FAIL: TestSwaggerYAML (0.01s)
    server_test.go:339: 
        	Error Trace:	server_test.go:339
        	Error:      	Received unexpected error:
        	            	Get "http://127.0.0.1:49340/api/swagger.yaml": EOF
        	Test:       	TestSwaggerYAML
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x46abe1a]

Currently the only workaround appears to be manually defining the schema, ie with:

	JSONInputSchema: func(ctx context.Context) string { return privateSendSchema },
@peterbroadhurst peterbroadhurst self-assigned this Oct 6, 2021
@peterbroadhurst
Copy link
Contributor

@peterbroadhurst
Copy link
Contributor

Have a recreate in the kin-openapi project, will work on a PR there.

@peterbroadhurst
Copy link
Contributor

See getkin/kin-openapi#434

peterbroadhurst added a commit to kaleido-io/firefly that referenced this issue Oct 7, 2021
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
peterbroadhurst added a commit that referenced this issue Oct 7, 2021
Update kin-openapi with fix for #229 and add UT
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 a pull request may close this issue.

2 participants