MCPcopy Index your code
hub / github.com/entur/schema2proto

github.com/entur/schema2proto @release-1.124.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release release-1.124.0 ↗ · + Follow
3,137 symbols 10,902 edges 282 files 527 documented · 17%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Maven Central

schema2proto

This tool does 2 things:

  • Converts XML Schema files (.xsd) to Protocol Buffers (.proto).
  • Modifies existing proto files by adding, modifying and removing fields, messages etc. Also support for merging proto files using the same package

Usage

Standalone (Only for converting XSD to PROTO)

See standalone tool

Maven (Both converting XSD to PROTO and for modifying PROTO files

See maven plugin

Maintaining backwards compatibility

If your use case is to maintain a proto descriptor based on a "living" xsd, you will need to detect and possibly resolve any backwards incompatibility issues that may arise from modifying the xsd.

You can use the tool protolock to verify that i.e. fields have not changed name or id.

If you are using the Maven there is a plugin as well: https://github.com/salesforce/proto-backwards-compat-maven-plugin

Only automatic resolving of field name/id conflicts have been implemented so far.

Contribution

See code style CODESTYLE.md

Licensing

EUPL, see LICENSE and https://en.wikipedia.org/wiki/European_Union_Public_Licence

The schema2proto-wire module is a modified copy from https://github.com/square/wire/tree/master/wire-schema that seems to have become https://github.com/square/wire/tree/master/wire-library/wire-schema now.

The schema2proto-xsom module is a modified copy from https://github.com/eclipse-ee4j/jaxb-ri/tree/master/jaxb-ri/xsom, see original LICENSE

The codebase was once based on https://github.com/tranchis/xsd2thrift but has been completely rewritten.

Extension points exported contracts — how you extend this code

XMLParser (Interface)
Interface that hides the detail of parsing mechanism. @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) [7 implementers]
schema2proto-xsom/src/main/java/com/sun/xml/xsom/parser/XMLParser.java
TypeElement (Interface)
A message type or enum type declaration. */
schema2proto-wire/src/main/java/com/squareup/wire/schema/internal/parser/TypeElement.kt
NGCCEventReceiver (Interface)
@author Kohsuke Kawaguchi (kk@kohsuke.org) [32 implementers]
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/parser/state/NGCCEventReceiver.java
XSVisitor (Interface)
Visitor for com.sun.xml.xsom.XSComponent [9 implementers]
schema2proto-xsom/src/main/java/com/sun/xml/xsom/visitor/XSVisitor.java
XSFunction (Interface)
Function object that works on the entire XML Schema components. @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.co [7 …
schema2proto-xsom/src/main/java/com/sun/xml/xsom/visitor/XSFunction.java
XSTermFunction (Interface)
Function object that works on XSTerm. @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) [7 implementers]
schema2proto-xsom/src/main/java/com/sun/xml/xsom/visitor/XSTermFunction.java

Core symbols most depended-on inside this repo

equals
called by 1718
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/parser/SchemaDocumentImpl.java
getAttributeIndex
called by 360
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/parser/state/NGCCRuntime.java
add
called by 242
schema2proto-wire/src/main/java/com/squareup/wire/schema/Options.java
get
called by 204
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/Ref.java
consumeAttribute
called by 186
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/parser/state/NGCCRuntime.java
getType
called by 175
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/Ref.java
at
called by 164
schema2proto-wire/src/main/java/com/squareup/wire/schema/Location.kt
sendEnterElement
called by 155
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/parser/state/NGCCEventSource.java

Shape

Method 2,786
Class 285
Interface 62
Enum 4

Languages

Java87%
Kotlin13%

Modules by API surface

schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/SchemaSetImpl.java100 symbols
schema2proto-wire/src/test/java/com/squareup/wire/schema/internal/parser/ProtoParserTest.kt65 symbols
schema2proto-wire/src/test/java/com/squareup/wire/schema/SchemaTest.kt57 symbols
schema2proto-lib/src/main/java/no/entur/schema2proto/generateproto/ProtoSerializer.java51 symbols
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/parser/DelayedRef.java50 symbols
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/SchemaImpl.java50 symbols
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/util/SchemaTreeTraverser.java45 symbols
schema2proto-wire/src/main/java/com/squareup/wire/schema/Field.java40 symbols
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/scd/Axis.java39 symbols
schema2proto-lib/src/main/java/no/entur/schema2proto/generateproto/SchemaParser.java39 symbols
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/scd/SCDParserTokenManager.java38 symbols
schema2proto-xsom/src/main/java/com/sun/xml/xsom/impl/parser/state/complexType.java38 symbols

For agents

$ claude mcp add schema2proto \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact