You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then, we have a struct involving these two packages
package server
typeAllConfigstruct {
TCP tcp.Config`json:"tcp" jsonschema:"omitempty"`HTTP http.Config`json:"http" jsonschema:"omitempty"`
}
then we will have the same $ref = #/$defs/Config for http and tcp in JSON Schema, but actually, the http.Config is quite different with tcp.Config, this causes the incorrect the JSON schema file.
I'm honestly not sure there is a good solution here with the current implementation. It'd require support for namespaces, and determining those namespaces from package names could be complex (it's not something I've looked at, so not entirely sure.)
I'll leave this one open in case anyone would like to propose a solution in a PR. I good approach could be to add a AddPackageNamespaces boolean parameter that will attempt to add the package name in IDs.
Assuming we have two different packages
HTTP
andTCP
, and they all have aConfig
structure.then, we have a struct involving these two packages
then we will have the same
$ref = #/$defs/Config
forhttp
andtcp
in JSON Schema, but actually, thehttp.Config
is quite different withtcp.Config
, this causes the incorrect the JSON schema file.So, is there a way we can define the
$ref
name to make sure they are using different$defs
.The text was updated successfully, but these errors were encountered: