entur/schema2proto

Proto file name should not contains package name or should be located in root directory

Closed this issue · 1 comments

When i tried to generate proto files for MIP 4.2 schemas I receive strange result:

  1. All proto files was located in the same folders hierarchy as corresponding XSD files
  2. But additionally all proto files have package name in their file names.

This cause some strange imports like "vision/combat/xsds/_2015/_07/_05/base/vision_combat_xsds__2015__07__05_base.proto"
As the result it generates Java file with name VisionCombatXsds20150705Base.java instead of simply Base.java.

Why not to put all proto files with the package as a part of file name in the root directory?
Or another way - why proto file name simply not equals to original XSD name without package?

You can try to generate following schema to understand what I mean.
https://combat.vision/xsds/2019/04/11/MIP-IES.xsd

seime commented

You should take a look at the style guide https://developers.google.com/protocol-buffers/docs/style, it answers some of your questions.

  • Directory structure follows package structure
  • You cannot have more than one proto file providing messages for a given package. So 1 package = 1 file. This is not true for xsds. So 2 xsd files with different filenames must be merged into 1 proto file. Currently this means that we are generating a filename based on the package