schemars icon indicating copy to clipboard operation
schemars copied to clipboard

Make schemars_derive add the Rust namespace to the schema_names.

Open daym opened this issue 3 years ago • 1 comments

Right now, #[derive(JsonSchema)] does not include any namespace, even when deriving from Rust source files in different modules.

This can cause naming conflicts that are hard to debug (because one of the structs is made to stand in for the other same-named completely different struct in another module) and generally seem like a bad idea.

This PR is the easiest fix: It just prefixes the schema_name with the module_path. That way, the schema names are unique.

daym avatar Jun 13 '22 14:06 daym

See also https://github.com/GREsau/schemars/issues/62

daym avatar Jun 15 '22 18:06 daym