Documentation
¶
Overview ¶
Package java emits Java 25 source. Generation is pure: callers choose where to write the returned files, and no generated predicate receives I/O access.
Index ¶
- Constants
- func JSONNativeValidatorName(program *language.Program, contractName, moduleName string) (string, error)
- func OpenAPIContextOccurrenceReplayTarget(operationID, status string, paths []string, offset int) string
- func OpenAPIContextReplayTarget(operationID, status string) string
- func OpenAPIRequestOccurrenceReplayTarget(operationID string, paths []string, offset int) string
- func OpenAPIRequestReplayTarget(operationID string) string
- func OpenAPIResponseOccurrenceReplayTarget(operationID, status string, paths []string, offset int) string
- func OpenAPIResponseReplayTarget(operationID, status string) string
- type File
- func GenerateJSONSerde(program *language.Program, namespace, contractName, moduleName string, ...) (files []File, failure error)
- func GenerateModels(program *language.Program, namespace, contractName string) (files []File, failure error)
- func GenerateOpenAPIContext(program *language.Program, namespace, contractName, className string, ...) (files []File, failure error)
- func GenerateProjectAvroSerde(project *native.Project, contractName, serdeName string) (files []File, failure error)
- func GenerateProjectJSONSerde(project *native.Project, contractName, moduleName string) ([]File, error)
- func GenerateProjectNativeJSONValidator(project *native.Project, className string) (files []File, failure error)
- func GenerateProjectOpenAPIContext(project *native.Project, contractName, className string) (files []File, failure error)
- func GenerateProjectOpenAPIPropertyTests(project *native.Project, namespace, contractName, facadeName string, ...) ([]File, error)
- func GenerateProjectPropertyTests(project *native.Project, namespace, contractName string, ...) ([]File, error)
- func GeneratePropertyTests(program *language.Program, namespace, contractName string, ...) ([]File, error)
- func GenerateRuntime(namespace string) ([]File, error)
- func GenerateValidator(program *language.Program, namespace, className string) (files []File, failure error)
- func GenerateValidatorWithTypes(program *language.Program, namespace, className string, ...) (files []File, failure error)
- type GenerationError
- type JSONCodecLimits
- type JSONDiscriminator
- type JSONIntegerEncoding
- type JSONRealEncoding
- type JSONSerdeOptions
- type JSONTimestampEncoding
- type PropertyExample
- type PropertyNativeOutcome
- type PropertyOutcome
- type PropertyReplay
- type PropertyTarget
- type PropertyTestOptions
- type ReplayKind
- type Resource
Constants ¶
const OpenAPIPropertyElementPathSegment = "~2"
OpenAPIPropertyElementPathSegment is the reserved affected-path segment for one runtime list element or map key in an occurrence replay selector. It is not a JSON Pointer escape and cannot collide with an authored field name.
Variables ¶
This section is empty.
Functions ¶
func JSONNativeValidatorName ¶
func JSONNativeValidatorName(program *language.Program, contractName, moduleName string) (string, error)
JSONNativeValidatorName shares the collision-safe sidecar class name with project/property generation. It does not execute or weaken validation.
func OpenAPIContextOccurrenceReplayTarget ¶
func OpenAPIContextOccurrenceReplayTarget(operationID, status string, paths []string, offset int) string
OpenAPIContextOccurrenceReplayTarget selects one repeated additional context clause by its checked affected paths and source offset.
func OpenAPIContextReplayTarget ¶
OpenAPIContextReplayTarget returns the opaque replay selector for a response pair validated through an additional checked context type.
func OpenAPIRequestOccurrenceReplayTarget ¶
OpenAPIRequestOccurrenceReplayTarget selects one repeated request clause by its checked affected paths and source offset. Prefer the shorter request selector when a diagnostic code occurs only once in the request.
func OpenAPIRequestReplayTarget ¶
OpenAPIRequestReplayTarget returns the opaque replay selector for one operation's request property. The generator still verifies that the selector names exactly one authoritative catalog property.
func OpenAPIResponseOccurrenceReplayTarget ¶
func OpenAPIResponseOccurrenceReplayTarget(operationID, status string, paths []string, offset int) string
OpenAPIResponseOccurrenceReplayTarget selects one repeated response-origin clause, including a response clause evaluated through a context binding.
func OpenAPIResponseReplayTarget ¶
OpenAPIResponseReplayTarget selects response-origin invalid predicates, including those evaluated within a context. It also selects valid response pairs when the binding has no additional context type.
Types ¶
type File ¶
func GenerateJSONSerde ¶
func GenerateJSONSerde(program *language.Program, namespace, contractName, moduleName string, options JSONSerdeOptions) (files []File, failure error)
GenerateJSONSerde emits semantic models plus a Jackson 3 module for one closed, non-generic record or scalar root. Wire choices that could lose exact values are explicit; unsupported shapes fail the whole generation.
func GenerateModels ¶
func GenerateModels(program *language.Program, namespace, contractName string) (files []File, failure error)
GenerateModels emits semantic Java models and the checked validator they use. No filesystem or deployment operations occur. All emitted constructors validate by default; named bypass factories retain structural checks. Unsupported model forms reject the complete output, never degrade fields to Object or raw Data.
func GenerateOpenAPIContext ¶
func GenerateOpenAPIContext(program *language.Program, namespace, contractName, className string, schema refineopenapi.Schema) (files []File, failure error)
GenerateOpenAPIContext emits a pure Java 25 request/response validation facade over the same checked operation metadata used by Go. It generates no transport, routing, network, or filesystem behavior.
func GenerateProjectAvroSerde ¶
func GenerateProjectAvroSerde(project *native.Project, contractName, serdeName string) (files []File, failure error)
GenerateProjectAvroSerde emits the shared semantic models and an Apache Avro 1.12 adapter for the checked project's selected root. Decode traversal and collection allocation are bounded before values enter the semantic model.
func GenerateProjectJSONSerde ¶
func GenerateProjectJSONSerde(project *native.Project, contractName, moduleName string) ([]File, error)
GenerateProjectJSONSerde composes the immutable native sidecar with semantic Jackson decoding. Reads validate native bytes before constructing a model; writes stage and validate bytes before touching the caller's generator.
func GenerateProjectNativeJSONValidator ¶
func GenerateProjectNativeJSONValidator(project *native.Project, className string) (files []File, failure error)
GenerateProjectNativeJSONValidator emits an offline native-schema validator for a JSON Schema Draft 2020-12 or OpenAPI 3.x project. OAS 3.0 resources are first adapted by native.Project to equivalent Draft 2020-12 assertions. The public helper validates bytes only; callers compose it with their semantic serde so that both the immutable native sidecar and editable refinements are enforced. Pattern-bearing schemas conditionally receive the bounded shared QuickJS-NG WebAssembly ECMA-262 adapter. Helpers without native patterns have no Chicory runtime linkage and require no companion guest resources.
func GenerateProjectOpenAPIContext ¶
func GenerateProjectOpenAPIContext(project *native.Project, contractName, className string) (files []File, failure error)
GenerateProjectOpenAPIContext composes checked native operation-part Schema Objects with structural JSON decoding and the complete Refine request, response, and context predicates. Inputs are semantic JSON values, never HTTP syntax. Schema locations come only from Project.OpenAPIOperationIndex.
func GenerateProjectOpenAPIPropertyTests ¶
func GenerateProjectOpenAPIPropertyTests(project *native.Project, namespace, contractName, facadeName string, options PropertyTestOptions) ([]File, error)
GenerateProjectOpenAPIPropertyTests emits one executable JetCheck launcher which exercises every checked request and response binding through the real native-first OpenAPI facade. Targets cannot narrow the authoritative catalog. Examples cover valid, invalid, indeterminate, and native-invalid outcomes. Replay selectors bind request values or request/response pairs to one exact catalog property. Standalone wire-adapter overrides reject the complete generation request instead of being skipped.
func GenerateProjectPropertyTests ¶
func GenerateProjectPropertyTests(project *native.Project, namespace, contractName string, options PropertyTestOptions) ([]File, error)
GenerateProjectPropertyTests retains the ordinary property suite and only specializes its raw root generator when the authoritative native Schema Object proves a small ASCII language. Every emitted candidate still passes through the generated native adapter and Refine validator.
func GeneratePropertyTests ¶
func GeneratePropertyTests(program *language.Program, namespace, contractName string, options PropertyTestOptions) ([]File, error)
GeneratePropertyTests emits an executable Java property suite using JetCheck 0.3.0. Unsupported strategies reject the complete output.
func GenerateRuntime ¶
GenerateRuntime emits shared runtime sources, not schema-specific models or serde adapters. An empty package selects Java's unnamed package. Paths are package-relative; a flat-layout caller can retain only their base names. These development sources are intended to live in the user's single artifact; no separately deployed Maven runtime artifact is required.
func GenerateValidator ¶
func GenerateValidator(program *language.Program, namespace, className string) (files []File, failure error)
GenerateValidator emits a checked contract and its Java 25 runtime. It does not yet emit semantic model classes or native serde. Structural records, aliases, lists, generic/recursive ADTs, named/recursive/higher-order functions and pattern matching are supported. Unsupported execution features reject the entire generation; see docs/JAVA-RUNTIME.md for the current boundaries.
func GenerateValidatorWithTypes ¶
func GenerateValidatorWithTypes(program *language.Program, namespace, className string, targets map[string]string) (files []File, failure error)
GenerateValidatorWithTypes additionally emits named handles for checked closed payload-type expressions, such as "Box Age" or "Tree (Int where it > 0)". Java receives static metadata, never a runtime schema/type-source parser. The target labels are map keys, not Java identifiers. All output is atomic.
type GenerationError ¶
GenerationError identifies syntax the development Java backend cannot yet execute. No files are returned on failure; no predicate is silently omitted.
func (*GenerationError) Error ¶
func (e *GenerationError) Error() string
type JSONCodecLimits ¶
type JSONCodecLimits struct {
Bytes int
Depth int
Nodes int
NumberLength int
StringLength int
NameLength int
}
JSONCodecLimits are generation-time maxima. Emitted Java constructors may tighten them, but cannot relax them. Zero fields select bounded defaults.
type JSONDiscriminator ¶
type JSONIntegerEncoding ¶
type JSONIntegerEncoding uint8
const ( JSONIntegerNumber JSONIntegerEncoding = iota JSONIntegerString )
type JSONRealEncoding ¶
type JSONRealEncoding uint8
const ( JSONRealUnspecified JSONRealEncoding = iota JSONRealExactDecimal JSONRealRationalString )
type JSONSerdeOptions ¶
type JSONSerdeOptions struct {
Root string
PreserveExtraFields bool
PreserveExtraFieldsFor map[string]bool
RejectExtraFields bool
RejectExtraFieldsFor map[string]bool
Discriminators map[string]JSONDiscriminator
Scalars map[string]native.ScalarEncoding
NumericExpansion int
Integers JSONIntegerEncoding
Reals JSONRealEncoding
Timestamps JSONTimestampEncoding
CodecLimits JSONCodecLimits
// contains filtered or unexported fields
}
func JSONSerdeOptionsFromMetadata ¶
func JSONSerdeOptionsFromMetadata(root string, metadata native.WireMetadata) (JSONSerdeOptions, error)
JSONSerdeOptionsFromMetadata is the single checked conversion from native project wire metadata to the policies understood by the Jackson JSON serde. Named scalar policies are copied and retained at each named reference.
type JSONTimestampEncoding ¶
type JSONTimestampEncoding uint8
const ( JSONTimestampUnspecified JSONTimestampEncoding = iota JSONTimestampRFC3339String )
type PropertyExample ¶
type PropertyExample struct {
Target string
Value value.Data
Expected PropertyOutcome
NativeExpected PropertyNativeOutcome
DiagnosticCodes []string
}
type PropertyNativeOutcome ¶
type PropertyNativeOutcome uint8
const ( ExampleNativeValid PropertyNativeOutcome = iota ExampleNativeInvalid )
type PropertyOutcome ¶
type PropertyOutcome uint8
const ( ExampleValid PropertyOutcome = iota + 1 ExampleInvalid ExampleIndeterminate )
type PropertyReplay ¶
type PropertyReplay struct {
Target string
Kind ReplayKind
DiagnosticCode string
SerializedData string
}
type PropertyTarget ¶
type PropertyTarget struct{ Name string }
type PropertyTestOptions ¶
type PropertyTestOptions struct {
Targets []PropertyTarget
CaseCount int
AttemptBudget int
Seed int64
Examples []PropertyExample
Replays []PropertyReplay
JSONModule string
AvroSerde string
NativeJSONValidator string
}
type Resource ¶
Resource is a non-source output required by generated Java. Its path is a classpath-relative slash-separated name and Content is always a defensive copy. It is deliberately separate from File's Java-source-only contract.
func GenerateProjectNativeJSONResources ¶
GenerateProjectNativeJSONResources returns the checked runtime resources required by GenerateProjectNativeJSONValidator, GenerateProjectJSONSerde, and GenerateProjectOpenAPIContext. Callers writing sources directly must place these at their exact classpath-relative paths. Project generation does this automatically. Schemas without native patterns return no resources and acquire no Chicory linkage.
Source Files
¶
- budget_gp.go
- codec_execution_gp.go
- codec_parser_gp.go
- codec_read_gp.go
- codec_unicode_gp.go
- contract_runtime_gp.go
- data_gp.go
- function_execution_gp.go
- function_types_gp.go
- generated_properties_gp.go
- initializer_gp.go
- inline_assertion_gp.go
- model_generics_gp.go
- model_inheritance_gp.go
- model_json_gp.go
- model_refinements_gp.go
- model_support_gp.go
- model_types_gp.go
- model_union_generics_gp.go
- model_unions_gp.go
- models_gp.go
- native_regex_gp.go
- native_resources_gp.go
- native_validation_gp.go
- openapi_context_gp.go
- openapi_native_gp.go
- openapi_properties_gp.go
- payload_type_gp.go
- property_integers_gp.go
- property_native_string_gp.go
- property_strategies_gp.go
- rational_gp.go
- regex_compile_gp.go
- regex_parse_gp.go
- regex_program_gp.go
- runtime_gp.go
- serde_avro_gp.go
- serde_json_gp.go
- serde_scalars_gp.go
- text_gp.go
- timestamp_gp.go
- validation_gp.go
- validator_gp.go