Skip to content

Instantly share code, notes, and snippets.

@lmmx
Created September 4, 2025 10:21
Show Gist options
  • Save lmmx/bcceb62965d044e4fa894928342e0996 to your computer and use it in GitHub Desktop.
Save lmmx/bcceb62965d044e4fa894928342e0996 to your computer and use it in GitHub Desktop.
Trace of `cargo run -F cli tests/fixtures/jsonschema/string_format_email.json /tmp/out.avsc` rendered in Mermaid
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lmmx
Copy link
Author

lmmx commented Sep 4, 2025

Screenshot from 2025-09-04 11-20-28

@lmmx
Copy link
Author

lmmx commented Sep 4, 2025

Screenshot from 2025-09-04 11-27-58
flowchart TD

    subgraph RecordConv["json_schema_object_to_avro_record(...)"]
        A1(["json_schema_object_to_avro_record()"]):::func
        A2["name = "document""]:::data --> A1
        A3["namespace = "string_format_email""]:::data --> A1
        A4["utility_namespace = "string_format_email.utility""]:::data --> A1
        A5["record_stack = []"]:::data --> A1
        A6["avro_schema = []"]:::data --> A1
        A7["base_uri = tests/fixtures/jsonschema/string_format_email.json"]:::data --> A1

        subgraph JsonObj["json_object = Object {...}"]
            J1[""$schema" = String("https://json-schema.org/draft/2020-12/schema")"]:::data
            J2[""title" = String("Email Format")"]:::data
            J3[""type" = String("string")"]:::data
            J4[""format" = String("email")"]:::data
        end
        JsonObj --> A1

        subgraph JsonSchema["json_schema = Object {...}"]
            S1[""$schema" = String("https://json-schema.org/draft/2020-12/schema")"]:::data
            S2[""title" = String("Email Format")"]:::data
            S3[""type" = String("string")"]:::data
            S4[""format" = String("email")"]:::data
        end
        JsonSchema --> A1

        subgraph Pattern["→ handle_pattern_properties(...)"]
            B1["record_name = "document""]:::data
            B2["record_stack = ["document"]"]:::data
            B3["dependencies = []"]:::data
            subgraph PJsonObj["json_object = Object {...}"]
                PJ1[""$schema" = String("https://json-schema.org/draft/2020-12/schema")"]:::data
                PJ2[""title" = String("Email Format")"]:::data
                PJ3[""type" = String("string")"]:::data
                PJ4[""format" = String("email")"]:::data
            end
        end

        subgraph Additional["→ handle_additional_properties(...)"]
            C1["record_name = "document""]:::data
            C2["record_stack = ["document"]"]:::data
            C3["dependencies = []"]:::data
            subgraph AJsonObj["json_object = Object {...}"]
                AJ1[""$schema" = String("https://json-schema.org/draft/2020-12/schema")"]:::data
                AJ2[""title" = String("Email Format")"]:::data
                AJ3[""type" = String("string")"]:::data
                AJ4[""format" = String("email")"]:::data
            end
        end

        %% call sequence inside RecordConv
        A1 --> Pattern --> Additional
    end

    %% Styling
    classDef func fill:#c6f6d5,stroke:#2f855a,stroke-width:2px,color:#22543d;
    classDef data fill:#bee3f8,stroke:#2b6cb0,stroke-width:1.5px,color:#1a365d;
    style RecordConv fill:#f7fafc,stroke:#4a5568,stroke-width:1.5px;
    style Pattern fill:#f7fafc,stroke:#4a5568,stroke-width:1.5px;
    style Additional fill:#f7fafc,stroke:#4a5568,stroke-width:1.5px;
    style JsonObj fill:#edf2f7,stroke:#718096,stroke-width:1px;
    style JsonSchema fill:#edf2f7,stroke:#718096,stroke-width:1px;
    style PJsonObj fill:#edf2f7,stroke:#718096,stroke-width:1px;
    style AJsonObj fill:#edf2f7,stroke:#718096,stroke-width:1px;
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment