NewRef should return an empty Ref if refURI is empty
nikhita opened this issue · comments
We are using go-openapi for validation of Custom Resources in Kubernetes (kubernetes/kubernetes#47263).
While using the spec.NewRef
function, an empty string i.e spec.NewRef("")
results in a Ref with a #
- not an empty Ref value. Due to this, we incorporated an additional check.
Looking at the code in https://github.com/go-openapi/jsonreference, it looks like an empty Ref should be produced but I couldn't really figure out why that does not occur.
cc @sttts
It's because of this this line: https://github.com/go-openapi/spec/blob/master/ref.go#L141
would it be ok if it returned:
{"$ref":""}
@casualjim That would be perfect, thanks.
i fixed this now so please close when you've confirmed :)