Skip to content

Better document/warn requirement for unsetting doc.Servers #882

@jamietanna

Description

@jamietanna

In https://github.com/deepmap/oapi-codegen/blob/5a337911b060aad7130b05ad1819cfd3b73884f4/examples/petstore-expanded/gin/petstore.go#L26-L28, and other cases we're getting the Middleware

	// Clear out the servers array in the swagger spec, that skips validating
	// that server names match. We don't know how this thing will be run.
	swagger.Servers = nil

I recommend we log a warning if we see that Servers != nil.

This won't break anyone's builds or expectations if they're needing it, but will make it clear that this could be a problem.

It's a problem I've hit several times and so have others I've worked with, so we should try and preemptively alert folks!

Metadata

Metadata

Assignees

No one assigned

    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