Package-level declarations

Types

Link copied to clipboard
data class Enum(val name: Identifier, val values: List<EnumValue>, val allowAlias: Boolean = false, val reservedNames: List<Identifier> = emptyList(), val reservedNumbers: List<IntRange> = emptyList()) : Type

Represents an enum declaration.

Link copied to clipboard
data class Field(val name: Identifier, val type: FieldType, val number: FieldNumber, val rule: FieldRule = FieldRule.Singular) : Member

Represents a field declaration inside a Message or a OneOf.

Link copied to clipboard
sealed class FieldType

The declared type of a Field.

Link copied to clipboard
sealed class Member : SchemaElement

Represents a member of a Message, which may be a Field or a OneOf.

Link copied to clipboard
data class Message(val name: Identifier, val members: List<Member> = emptyList(), val nestedTypes: List<Type> = emptyList(), val reservedNames: List<Identifier> = emptyList(), val reservedNumbers: List<IntRange> = emptyList()) : Type

Represents a message declaration.

Link copied to clipboard
data class OneOf(val name: Identifier, val fields: List<Field>) : Member

Represents a oneof declaration.

Link copied to clipboard
data class SchemaDocument(val types: List<Type> = emptyList()) : SchemaElement

Represents a .proto file and describes the declarations therein. Note that only a subset of the .proto syntax is supported.

Link copied to clipboard
class SchemaDocumentReader(tokenizer: SchemaDocumentTokenizer = SchemaDocumentTokenizer())

Reads .proto syntax into SchemaDocuments. Note that only a subset of the .proto syntax is supported, and only the "proto3" syntax.

Link copied to clipboard

Converts .proto syntax into sequences of tokens.

Link copied to clipboard
class SchemaDocumentWriter(out: StringBuilder, indentSpaces: Int = 2)

Converts SchemaDocuments to .proto syntax, in the "proto3" syntax.

Link copied to clipboard
interface SchemaElement

Common interface implemented by all the elements of a SchemaDocument. It serves to facilitate the generation of useful validation error messages.

Link copied to clipboard
sealed class Token

Represents a token in a .proto file.

Link copied to clipboard

For each .proto token type, the regex that matches it and a function that converts the regex match into a Token.

Link copied to clipboard
sealed class Type : SchemaElement

Represents a type declaration, which may be a Message or an Enum.

Properties

Link copied to clipboard

Returns all the fields of this message, including those inside oneof declarations.

Link copied to clipboard