Skip to content

Swagger schema generation fails for embedded structs #229

@awrichar

Description

@awrichar

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 },

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions