### Run Example Project Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/034-OpenApiCallbackServer/README.md Execute the .NET project to start the server. Ensure you are in the project directory. ```bash dotnet run --project docs/ExampleRecipes/034-OpenApiCallbackServer ``` -------------------------------- ### Run DataObject Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/001-DataObject/README.md Navigate to the example directory and execute the .NET run command to start the DataObject example. ```bash cd docs/ExampleRecipes/001-DataObject dotnet run ``` -------------------------------- ### Running the Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/008-CreatingAnArrayOfHigherRank/README.md Navigate to the example directory and execute the .NET project to run the demonstration. ```bash cd docs/ExampleRecipes/008-CreatingAnArrayOfHigherRank dotnet run ``` -------------------------------- ### Running the Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/013-PolymorphismWithDiscriminators/README.md Navigate to the example directory and run the .NET Core application to execute the polymorphism example. ```bash cd docs/ExampleRecipes/013-PolymorphismWithDiscriminators dotnet run ``` -------------------------------- ### Running the Example Recipe Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/016-Maps/README.md Navigate to the example directory and run the .NET application. ```bash cd docs/ExampleRecipes/016-Maps dotnet run ``` -------------------------------- ### Running the Consumer Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/037-AsyncApiConsumer/README.md Execute the .NET application to run the consumer example. This command starts the consumer and simulates message delivery. ```bash dotnet run -f net10.0 ``` -------------------------------- ### Run Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/027-Yaml/README.md Command to navigate to the example directory and execute the .NET project. ```bash cd docs/ExampleRecipes/027-Yaml dotnet run ``` -------------------------------- ### Running the Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/006-ConstrainingABaseType/README.md Navigate to the example directory and execute the .NET Core application to run the demonstration. ```bash cd docs/ExampleRecipes/006-ConstrainingABaseType dotnet run ``` -------------------------------- ### Run Example Recipe Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/024-JsonLogic/README.md Navigate to the example directory and run the dotnet command to execute the JsonLogic example. ```bash cd docs/ExampleRecipes/024-JsonLogic dotnet run ``` -------------------------------- ### Run JsonPath Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/028-JsonPath/README.md Navigate to the example directory and execute the .NET project to run the JsonPath example. ```bash cd docs/ExampleRecipes/028-JsonPath dotnet run ``` -------------------------------- ### Run the Example Server Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/030-OpenApiServer/README.md Navigate to the example directory and run the server using the dotnet CLI. ```bash cd docs/ExampleRecipes/030-OpenApiServer dotnet run ``` -------------------------------- ### Run Example Recipe Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/002-DataObjectValidation/README.md Navigate to the example directory and run the .NET Core application to execute the data object validation example. ```bash cd docs/ExampleRecipes/002-DataObjectValidation dotnet run ``` -------------------------------- ### Running the Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/004-OpenVersusClosedTypes/README.md Navigate to the example directory and execute the .NET run command to execute the code. ```bash cd docs/ExampleRecipes/004-OpenVersusClosedTypes dotnet run ``` -------------------------------- ### Initialize and Start Podman Machine Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Initializes and starts the Podman machine, which is necessary for Podman to function. This should be run after Podman installation. ```powershell podman machine init podman machine start ``` -------------------------------- ### Run Example Project Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/020-ConditionalSchemas/README.md Command to navigate to the example's directory and execute the .NET project. This is used to run the C# code examples. ```bash cd docs/ExampleRecipes/020-ConditionalSchemas dotnet run ``` -------------------------------- ### Running the Default Values Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/021-DefaultValues/README.md Command to navigate to the example directory and run the .NET application. ```bash cd docs/ExampleRecipes/021-DefaultValues dotnet run ``` -------------------------------- ### Run OpenAPI End-to-End Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/033-OpenApiEndToEnd/README.md Execute the end-to-end OpenAPI code generation example. This command starts an ASP.NET server, runs multiple scenarios, and logs the client/server round-trip to the console. ```bash dotnet run --project docs/ExampleRecipes/033-OpenApiEndToEnd ``` -------------------------------- ### Running the Pattern Matching Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/012-PatternMatching/README.md Command to navigate to the example directory and run the .NET application. ```bash cd docs/ExampleRecipes/012-PatternMatching dotnet run ``` -------------------------------- ### Running the JSONata Example Recipe Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/025-Jsonata/README.md This bash command navigates to the example recipe directory and executes the .NET run command to execute the JSONata example. ```bash cd docs/ExampleRecipes/025-JSONata dotnet run ``` -------------------------------- ### Run the Example Project Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/035-OpenApiCallbackClient/README.md Execute the .NET project to run the example, which uses an in-memory transport for a self-contained demonstration. ```bash dotnet run --project docs/ExampleRecipes/035-OpenApiCallbackClient ``` -------------------------------- ### Run CloneAndFreeze Example Recipe Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/019-CloneAndFreeze/README.md Navigate to the example directory and execute the .NET Core application to run the recipe. ```bash cd docs/ExampleRecipes/019-CloneAndFreeze dotnet run ``` -------------------------------- ### Run Example Recipe Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/011-InterfacesAndMixInTypes/README.md Navigate to the example recipe directory and execute the .NET run command to compile and run the code. ```bash cd docs/ExampleRecipes/011-InterfacesAndMixInTypes dotnet run ``` -------------------------------- ### Use Typed Consumer Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/AsyncApi.md Example of using the generated typed consumer to start consuming messages. It shows setting up the transport, handler, and consumer, then simulating message delivery. ```csharp using Corvus.Text.Json.AsyncApi; using Corvus.Text.Json.AsyncApi.Testing; using Streetlights.Client; using Streetlights.Client.Models; await using InMemoryMessageTransport transport = new(); LightMeasuredHandler handler = new(); ReceiveLightMeasurementConsumer consumer = new(transport, handler); await consumer.StartAsync(); // Simulate an incoming message (in production, the broker delivers these) await transport.DeliverAsync( "smartylighting.streetlights.1.0.action.{streetlightId}.lighting.measured", """{"lumens":250,"sentAt":"2024-01-15T10:30:00Z"}"""u8.ToArray()); await consumer.StopAsync(); ``` -------------------------------- ### Run JSON Schema Examples Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/README.md Execute a specific JSON Schema example recipe from the repository root or its directory. ```bash # From the repo root dotnet run --project docs/ExampleRecipes/001-DataObject/DataObject.csproj # Or from the recipe directory cd docs/ExampleRecipes/001-DataObject dotnet run ``` -------------------------------- ### Running the JMESPath Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/026-Jmespath/README.md Navigate to the example directory and run the .NET application to see the JMESPath expression evaluation in action. ```bash cd docs/ExampleRecipes/026-JMESPath dotnet run ``` -------------------------------- ### Install Corvus.Json.Cli as a Global Tool Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/CodeGenerator.md Installs the Corvus.Json.Cli .NET global tool. This is the recommended way to install the tool for general use. ```bash dotnet tool install --global Corvus.Json.Cli ``` -------------------------------- ### Install Corvus.Text.Json Core Library Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/README.md Install the core Corvus.Text.Json library using the .NET CLI. ```bash # Core library dotnet add package Corvus.Text.Json ``` -------------------------------- ### Install uv using PowerShell Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Recommended method to install the uv package manager on Windows using a PowerShell one-liner. Restart your terminal after installation. ```powershell powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Link to Example Recipes Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/website/DEVELOPMENT.md Markdown example for linking to an ExampleRecipe from a documentation page. The `../` prefix is crucial for the build pipeline to rewrite these links correctly. ```markdown [AsyncAPI Producer](../ExampleRecipes/036-AsyncApiProducer/) — description ``` -------------------------------- ### Pitfall: Consumer Not Started Before Publishing Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/038-AsyncApiEndToEnd/README.md Illustrates the incorrect pattern of publishing a message before starting the consumer, leading to undelivered messages. Shows the correct pattern of starting the consumer first. ```csharp // ❌ Wrong: publish before consumer starts await transport.PublishAsync(...); await consumer.StartAsync(); // Too late! // ✅ Correct: start consumer first await consumer.StopAsync(); await transport.PublishAsync(...); // Now delivered ``` -------------------------------- ### Running the String Enumerations Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/014-StringEnumerations/README.md Provides the command to navigate to the example directory and run the .NET application. This is used to execute the code demonstrating string enumerations. ```bash cd docs/ExampleRecipes/014-StringEnumerations dotnet run ``` -------------------------------- ### Install WSL Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Installs the Windows Subsystem for Linux if not already present. This is a prerequisite for running Podman on Windows. ```powershell wsl --install ``` -------------------------------- ### Verify Bowtie Installation Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Run the Bowtie help command to confirm the installation. This command is executed using the venv binary. ```powershell $bowtie = ".\.venv\Scripts\bowtie.exe" # from the bowtie clone directory & $bowtie --help ``` -------------------------------- ### Install uv using winget Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Alternative method to install the uv package manager using the winget package manager. ```powershell winget install astral-sh.uv ``` -------------------------------- ### Verify Docker Desktop Installation Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Runs a simple container to verify that Docker Desktop is installed and functioning correctly. This is an alternative to Podman. ```powershell docker run --rm hello-world ``` -------------------------------- ### Install Node Dependencies Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/website/DEVELOPMENT.md Installs necessary Node.js dependencies for SCSS compilation and search index generation. Run this command in the website's directory. ```powershell cd docs/website npm install ``` -------------------------------- ### Get Strongly-Typed Guid Values from JSON Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ParsedJsonDocument.md Shows how to extract GUID values from JSON strings using the `GetGuid()` method. ```csharp string json = """ { "userId": "550e8400-e29b-41d4-a716-446655440000", "sessionId": "12345678-1234-1234-1234-123456789012" } """; using ParsedJsonDocument doc = ParsedJsonDocument.Parse(json); JsonElement root = doc.RootElement; Guid userId = root.GetProperty("userId"u8).GetGuid(); Guid sessionId = root.GetProperty("sessionId"u8).GetGuid(); ``` -------------------------------- ### Install Corvus.Text.Json Package Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/Analyzers.md Add the Corvus.Text.Json NuGet package to your project to include the built-in Roslyn analyzers. No additional setup is required after installation. ```xml ``` -------------------------------- ### Install Corvus.Toon.SystemTextJson Package Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/Toon.md Use this command to add the System.Text.Json-only package. ```bash dotnet add package Corvus.Toon.SystemTextJson ``` -------------------------------- ### Run the End-to-End Demo Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/038-AsyncApiEndToEnd/README.md Navigate to the example directory and run the .NET application to execute the end-to-end demo. ```bash cd docs/ExampleRecipes/038-AsyncApiEndToEnd dotnet run ``` -------------------------------- ### Example JSON Schema Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/CodeGenerator.md This is an example JSON schema used to demonstrate the generated output. ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "required": ["name"], "properties": { "name": { "type": "string", "minLength": 1 }, "age": { "type": "integer", "format": "int32", "minimum": 0 } } } ``` -------------------------------- ### Install Corvus.Text.Json Packages Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/JMESPath.md Install the necessary packages for using Corvus.Text.Json and JMESPath functionality. ```bash dotnet add package Corvus.Text.Json dotnet add package Corvus.Text.Json.JMESPath ``` -------------------------------- ### Verify uv installation Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Command to verify that uv has been installed correctly by checking its version. ```powershell uv --version ``` -------------------------------- ### Configure Bowtie for Local Development Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/LocalNuGetTesting.md Run the setup script to build local packages, copy them to the bowtie implementation directory, create a NuGet.config, patch project files, and prepare the Docker environment for local testing. ```powershell .\configure-bowtie-for-local-development.ps1 -BowtiePath D:\source\bowtie ``` ```powershell .\configure-bowtie-for-local-development.ps1 -BowtiePath D:\source\bowtie -Version 5.0.0-local.2 ``` -------------------------------- ### Set up Bowtie virtual environment with uv Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Creates a Python virtual environment using uv, specifying Python 3.13, activates it, and installs Bowtie in editable mode. ```powershell uv venv --python 3.13 .\.venv\Scripts\Activate.ps1 uv pip install -e . ``` -------------------------------- ### Full Website Build Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/website/DEVELOPMENT.md Performs a complete build of the documentation website from scratch, generating all site content in the .output/ directory. This command executes all 11 pipeline steps. ```powershell cd docs/website ./build.ps1 ``` -------------------------------- ### Install Corvus Jsonata Packages Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/Jsonata.md Installs the necessary Corvus packages for JSON and Jsonata integration. ```bash dotnet add package Corvus.Text.Json dotnet add package Corvus.Text.Json.Jsonata ``` -------------------------------- ### Preview Website with Local Server Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/website/DEVELOPMENT.md Builds the website and starts a local development server for previewing changes. This command runs `build.ps1 -Preview`. ```powershell ./preview.ps1 ``` -------------------------------- ### Quick Start Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/JsonCanonicalization.md Demonstrates the basic usage of JSON canonicalization using `TryCanonicalize` for zero-allocation and `Canonicalize` for convenience. ```APIDOC ## Quick Start ```csharp using System.Text; using Corvus.Text.Json; using Corvus.Text.Json.Canonicalization; string json = """{"z": 1, "a": 2, "m": 3}""" ; using var doc = ParsedJsonDocument.Parse(json); // Option 1: Write to a caller-provided buffer (zero-allocation) Span buffer = stackalloc byte[256]; bool success = JsonCanonicalizer.TryCanonicalize(doc.RootElement, buffer, out int bytesWritten); string canonical = Encoding.UTF8.GetString(buffer.Slice(0, bytesWritten)); Console.WriteLine(canonical); // {"a":2,"m":3,"z":1} // Option 2: Get as a byte array (allocates the result array) byte[] canonicalBytes = JsonCanonicalizer.Canonicalize(doc.RootElement); Console.WriteLine(Encoding.UTF8.GetString(canonicalBytes)); // {"a":2,"m":3,"z":1} ``` ``` -------------------------------- ### Build the Solution Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/UsingCopilotForMigration.md Execute this command to build the entire solution after migrating a group of files. ```bash dotnet build ``` -------------------------------- ### Verify Python installation Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Command to verify that a compatible Python version (3.13+) has been installed and is accessible. ```powershell python --version ``` -------------------------------- ### Verify Podman Installation Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Runs a simple container to verify that Podman is installed and functioning correctly. ```powershell podman run --rm hello-world ``` -------------------------------- ### Creating API Folder and Schema File Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/V4/GettingStartedWithJsonSchemaCodeGeneration.md Demonstrates the command-line steps to create an 'api' directory and a 'person-from-api.json' file within it. ```bash mkdir api cd api code person-from-api.json ``` -------------------------------- ### Preview Local Documentation Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/README.md Navigate to the docs/website directory and run this script to build and preview the documentation locally. Open http://localhost:5000 in your browser. ```powershell cd docs/website ./preview.ps1 ``` -------------------------------- ### Install Corvus Json Packages Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/JsonPath.md Installs the necessary Corvus packages for JSON processing and JsonPath querying. ```bash dotnet add package Corvus.Text.Json dotnet add package Corvus.Text.Json.JsonPath ``` -------------------------------- ### Build Existing Projects Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/CodeSampleCatalog.md Builds the ExampleRecipes projects to ensure real code compiles and to provide a reference for README samples. This should be done before verifying any markdown code blocks. ```powershell dotnet build docs\ExampleRecipes\ExampleRecipes.slnx ``` -------------------------------- ### Static Object Creation (V4 and V5) Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/copilot/CopilotMigrationInstructions.md Demonstrates static creation of objects in V4 and the preferred convenience overload in V5. Also shows the delegate overload for advanced V5 scenarios. ```csharp // V4 MyType v4 = MyType.Create( name: "Alice", age: 30); // V5 — convenience overload (preferred) using JsonWorkspace workspace = JsonWorkspace.Create(); using var builder = MyType.CreateBuilder( workspace, name: "Alice", age: 30); MyType v5 = builder.RootElement; // V5 — delegate overload (for advanced scenarios like From() conversions) using var builder2 = MyType.CreateBuilder( workspace, (ref MyType.Builder b) => b.Create( name: "Alice", age: 30)); ``` -------------------------------- ### JSON Data Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/028-JsonPath/README.md This is the sample JSON data used throughout the examples. It represents a bookstore with books and a bicycle. ```json { "store": { "book": [ {"category": "reference", "author": "Sandi Toksvig", "title": "Between the Stops", "price": 8.95}, {"category": "fiction", "author": "Evelyn Waugh", "title": "Sword of Honour", "price": 12.99}, {"category": "fiction", "author": "Jane Austen", "title": "Pride and Prejudice", "price": 8.99}, {"category": "fiction", "author": "J. R. R. Tolkien", "title": "The Lord of the Rings", "price": 22.99} ], "bicycle": {"color": "red", "price": 399.99} } } ``` -------------------------------- ### Serve Existing Website Output Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/website/DEVELOPMENT.md Starts the Vellum preview server using the existing website output in the .output/ directory without performing a rebuild. Useful for quickly viewing the site after a full build. ```powershell ./build.ps1 -ServeOnly ``` -------------------------------- ### Setting up Bowtie Virtual Environment Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/LocalNuGetTesting.md Create and activate a virtual environment for Bowtie to ensure you are using the correct version, especially if the checkout contains specific fixes. Install the local package using pip. ```powershell cd D:\source\bowtie python -m venv .venv .\.venv\Scripts\pip.exe install -e . ``` -------------------------------- ### Install Podman using winget Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Installs the Podman container runtime using the Windows Package Manager (winget). ```powershell winget install RedHat.Podman ``` -------------------------------- ### Consumer Generation Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/AsyncApi.md Illustrates the generated consumer class, handler interface, and model types for receiving light measurements. ```csharp using Streetlights.Client; using Streetlights.Client.Models; // Consumer class public class ReceiveLightMeasurementConsumer { // Manages subscription lifecycle: subscribes to channel, deserializes payloads, validates, dispatches to handler, handles errors } // Handler interface public interface IReceiveLightMeasurementHandler { // One async method per message — you implement business logic here Task HandleAsync(LightMeasuredPayload payload); } // Model types (same as producer generation) public class LightMeasuredPayload { // Strongly-typed JSON Schema models with validation, zero-allocation access, and builder patterns } ``` -------------------------------- ### Migrate Legacy Installation to New Tool Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/src/Corvus.Json.CodeGenerator/README.md Replace the old global tool installation of Corvus.Json.CodeGenerator with the new Corvus.Json.Cli tool. ```bash # Old dotnet tool install --global Corvus.Json.CodeGenerator # New dotnet tool install --global Corvus.Json.Cli ``` -------------------------------- ### Build and run the C# application Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/V4/GettingStartedWithJsonSchemaCodeGeneration.md Compile the C# project using `dotnet build` and execute the generated application to see the output. ```bash dotnet build .\bin\Debug\net8.0\JsonSchemaSample.exe ``` -------------------------------- ### Install Corvus.Json.JsonSchema.TypeGeneratorTool Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/website/site/content/GettingStarted-V4/SetupAndSchema.md Install the Corvus.Json.JsonSchema.TypeGeneratorTool globally using the .NET CLI. This command is used for setting up the code generation tool. ```bash dotnet tool install --global Corvus.Json.JsonSchema.TypeGeneratorTool --prerelease ``` -------------------------------- ### Install Corvus.Json CLI Tool Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/OpenApi.md Install the Corvus.Json CLI tool globally or as a local tool using the .NET CLI. ```bash dotnet tool install --global Corvus.Json.Cli # Or as a local tool dotnet tool install Corvus.Json.Cli ``` -------------------------------- ### Tuple Creation (V4 and V5) Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/copilot/CopilotMigrationInstructions.md Demonstrates tuple creation in V4 and various V5 methods including CreateBuilder convenience, Build + CreateBuilder, and the delegate route for open tuples. ```csharp // V4 MyTuple v4 = MyTuple.Create("hello", 42, true); // V5 — CreateBuilder convenience (preferred for closed tuples) using JsonWorkspace workspace = JsonWorkspace.Create(); using var builder = MyTuple.CreateBuilder(workspace, "hello", 42, true); // V5 — Build + CreateBuilder (two-step) MyTuple.Source source = MyTuple.Build("hello", 42, true); using var builder2 = MyTuple.CreateBuilder(workspace, source); // V5 — delegate (required for open tuples with additional items) using var builder3 = MyTuple.CreateBuilder( workspace, MyTuple.Build( static (ref MyTuple.Builder b) => b.CreateTuple( item1: "hello", item2: 42, item3: true))); ``` -------------------------------- ### Install Jsonata Source Generator Package Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/Jsonata.md Install the Corvus.Text.Json.Jsonata.SourceGenerator package to enable build-time code generation for Jsonata expressions. ```bash dotnet add package Corvus.Text.Json.Jsonata.SourceGenerator ``` -------------------------------- ### Install JsonPath Source Generator Package Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/JsonPath.md Install the Corvus.Text.Json.JsonPath.SourceGenerator package to enable build-time code generation for JsonPath expressions. ```bash dotnet add package Corvus.Text.Json.JsonPath.SourceGenerator ``` -------------------------------- ### Navigate to Schema Type Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/Analyzers.md Demonstrates navigating to a schema type definition from a code construct like a type name or variable declaration. ```csharp Order order = ... // Cursor on 'Order' ``` ```csharp void Process(Order order) // Cursor on 'order' ``` ```csharp List // Cursor on 'Order' ``` -------------------------------- ### Workflow: Preview then Generate Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/OpenApi.md A typical workflow involves using `openapi-show` to preview filtered results, followed by `openapi-client` with the same filters to generate the code. ```bash # 1. See what's in the spec corvusjson openapi-show petstore.json --group-by tag # 2. Preview filtered subset corvusjson openapi-show petstore.json --include-path "/pets/**" # 3. Generate only that subset corvusjson openapi-client petstore.json --include-path "/pets/**" \ --rootNamespace MyApp.Pets --outputPath ./Generated/Pets ``` -------------------------------- ### Install JMESPath Source Generator Package Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/JMESPath.md Install the Corvus.Text.Json.JMESPath.SourceGenerator package to enable build-time code generation for JMESPath expressions. ```bash dotnet add package Corvus.Text.Json.JMESPath.SourceGenerator ``` -------------------------------- ### Add Polly Resilience Package Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/AsyncApi.md Install the Corvus.Text.Json.AsyncApi.Polly NuGet package using the .NET CLI. ```bash dotnet add package Corvus.Text.Json.AsyncApi.Polly ``` -------------------------------- ### Set up Bowtie virtual environment with Python venv Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Creates a Python virtual environment using the built-in venv module, activates it, and installs Bowtie in editable mode. ```powershell python -m venv .venv .\.venv\Scripts\Activate.ps1 .\.venv\Scripts\pip.exe install -e . ``` -------------------------------- ### Cookie Authentication Example Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/ExampleRecipes/031-OpenApiAdvancedClient/README.md Demonstrates how cookie parameters are handled as regular method parameters. The generated client automatically sets the 'Cookie' header. ```csharp await petsClient.CreatePetAsync( session_token: "sess_k7j2m9x4"u8, // Becomes: Cookie: session_token=sess_k7j2m9x4 body: ...); ``` -------------------------------- ### Built-in JsonPath Function Examples Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/JsonPath.md Examples demonstrating the usage of built-in JsonPath functions for filtering data based on various criteria. ```jsonpath $[?length(@.name) > 5] ``` ```jsonpath $[?count(@.tags) > 0] ``` ```jsonpath $[?value(@.score) > 90] ``` ```jsonpath $[?match(@.name, '^J.*')] ``` ```jsonpath $[?search(@.name, 'ohn')] ``` -------------------------------- ### Install Corvus.Text.Json.Toon Package Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/Toon.md Use this command to add the full Corvus document model package. ```bash dotnet add package Corvus.Text.Json.Toon ``` -------------------------------- ### Example CLI JsonPath Code Generation Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/JsonPath.md Example of using the corvusjson jsonpath command to generate a C# file for querying all authors. ```bash corvusjson jsonpath expressions/all-authors.jsonpath \ --className AllAuthors \ --namespace MyApp.Queries \ --outputPath Generated/AllAuthors.cs ``` -------------------------------- ### Install Python 3.13 using winget Source: https://github.com/corvus-dotnet/corvus.jsonschema/blob/main/docs/BowtiePrerequisites.md Installs Python version 3.13 using the winget package manager, a prerequisite for Bowtie. ```powershell winget install Python.Python.3.13 ```