Reference
Contents
Index
OCPPData._BASE_NAMESOCPPData.AbstractOCPPSpecOCPPData.OCPPMessageOCPPData._build_all_exprsOCPPData._camel_to_snakeOCPPData._def_to_julia_nameOCPPData._enum_prefixOCPPData._load_all_schemas!OCPPData._make_member_nameOCPPData._ocpp_string_to_identifierOCPPData._primitive_typeOCPPData._resolve_typeOCPPData._strip_request_responseOCPPData._topo_sortOCPPData.decodeOCPPData.encodeOCPPData.encodeOCPPData.encodeOCPPData.enum_exprOCPPData.extract_fieldsOCPPData.generate_unique_idOCPPData.merge_definitionsOCPPData.read_schemasOCPPData.registry_exprOCPPData.struct_exprOCPPData.validateOCPPData.walk_propertiesOCPPData.@generate_ocpp_typesOCPPData.@generate_ocpp_types_from_definitions
OCPPData._BASE_NAMES — Constant
Names from Base that enum members must not shadow.
OCPPData.AbstractOCPPSpec — Type
Abstract base type for OCPP protocol version specifiers.
Concrete subtypes (V16.Spec, V201.Spec) are used as dispatch tokens to select version-specific behaviour — e.g. validate(V16.Spec(), ...).
OCPPData.OCPPMessage — Type
OCPP-J message framing types.
The OCPP-J protocol uses JSON arrays with a message type ID as the first element:
- [2, unique_id, action, payload] → Call
- [3, unique_id, payload] → CallResult
- [4, uniqueid, errorcode, desc, det] → CallError
OCPPData._build_all_exprs — Method
_build_all_exprs(enums, sorted_types, action_schemas, resolve_type_fn, registry_name)Shared codegen: emit enum AST, struct AST for sub-types, struct AST for action payloads, and registry AST. Both macros funnel into this.
OCPPData._camel_to_snake — Method
Convert camelCase to snake_case.
OCPPData._def_to_julia_name — Method
Derive a Julia type name from a v201 definition name. "BootReasonEnumType" → :BootReason, "ChargingStationType" → :ChargingStation
OCPPData._enum_prefix — Method
Derive an enum member prefix from a v201 definition name. "RegistrationStatusEnumType" → "Registration" "BootReasonEnumType" → "BootReason"
OCPPData._load_all_schemas! — Method
_load_all_schemas!(schemas, schema_dir, actions, filename_fn)Eagerly load all JSON schemas for a given OCPP version into schemas.
Iterates every action in actions and both message types (:request, :response), reads the JSON file, and stores the parsed JSONSchema.Schema.
OCPPData._make_member_name — Method
Create a Julia enum member name from a prefix and OCPP string value.
OCPPData._ocpp_string_to_identifier — Method
Convert an OCPP enum string value to a valid Julia identifier.
OCPPData._primitive_type — Method
Map a JSON schema type string to a Julia type symbol, or nothing for compound types.
OCPPData._resolve_type — Method
_resolve_type(prop, lookup_fn) -> Symbol or ExprResolve a JSON schema property to a Julia type expression. lookup_fn(prop) handles version-specific lookups (inline enums, nested types, $ref); shared primitive/array/object logic lives here.
OCPPData._strip_request_response — Method
Strip Request/Response suffix to get base action name.
OCPPData._topo_sort — Method
_topo_sort(deps_fn, items) -> VectorTopologically sort items so that dependencies (returned by deps_fn(item)) come before dependents. Falls back to sorted order for cycles.
OCPPData.decode — Method
decode(raw::String)::OCPPMessageDecode a raw OCPP-J JSON string into the appropriate OCPPMessage subtype. Dispatches on the first element (message type ID): 2=Call, 3=CallResult, 4=CallError.
OCPPData.encode — Method
encode(msg::CallError)::StringEncode a CallError to OCPP-J JSON array format: [4, unique_id, error_code, error_description, error_details].
OCPPData.encode — Method
encode(msg::CallResult)::StringEncode a CallResult to OCPP-J JSON array format: [3, unique_id, payload].
OCPPData.encode — Method
encode(msg::Call)::StringEncode a Call message to OCPP-J JSON array format: [2, unique_id, action, payload].
OCPPData.enum_expr — Method
Build AST for an @enum type with JSON serialization support.
OCPPData.extract_fields — Method
extract_fields(schema, resolve_type_fn) -> Vector{FieldDef}Extract field definitions from a JSON schema. resolve_type_fn(prop, name) maps each property to a Julia type — this is the single point of variation between V16 and V201.
OCPPData.generate_unique_id — Method
generate_unique_id()::StringGenerate a UUID string for use as an OCPP message unique_id.
OCPPData.merge_definitions — Method
Merge all definitions sections across schemas into one Dict.
OCPPData.read_schemas — Method
read_schemas(schema_dir::String) -> Dict{String, Any}Read all JSON schema files from a directory. Returns a Dict mapping schema title (e.g. "BootNotificationRequest") to parsed schema.
OCPPData.registry_expr — Method
Build AST for an action registry with requesttype/responsetype accessors.
OCPPData.struct_expr — Method
Build AST for a @kwdef struct with JSON camelCase name mapping via StructUtils.
OCPPData.validate — Method
validate(spec::AbstractOCPPSpec, action::String, payload::AbstractDict, msg_type::Symbol)Validate an OCPP message payload against its JSON schema.
Returns nothing if the payload is valid, or a diagnostic string describing the validation error.
Arguments
spec: Version spec instance —V16.Spec()orV201.Spec()action: Action name (e.g.,"BootNotification")payload: The message payload as a Dictmsg_type::requestor:response
Examples
result = validate(V16.Spec(), "BootNotification", payload, :request)
isnothing(result) # true if valid
result = validate(V201.Spec(), "BootNotification", payload, :response)
isnothing(result) # true if validOCPPData.walk_properties — Method
walk_properties(fn, props)Recursively walk JSON schema properties, calling fn(name, prop) for each. Descends into nested objects and array items that are objects.
OCPPData.@generate_ocpp_types — Macro
@generate_ocpp_types schema_dir enum_registry nested_type_names registry_nameRead V16-style OCPP JSON schemas at macro-expansion time and splice all enum, struct, and registry definitions into the calling module.
OCPPData.@generate_ocpp_types_from_definitions — Macro
@generate_ocpp_types_from_definitions schema_dir registry_nameRead V201-style OCPP JSON schemas (with definitions + $ref) at macro-expansion time and splice all type definitions into the calling module.