diff --git a/_docs/schema/api-openapi.md b/_docs/schema/api-openapi.md new file mode 100644 index 00000000..7c33bf3f --- /dev/null +++ b/_docs/schema/api-openapi.md @@ -0,0 +1,471 @@ +--- +layout: page +title: Describing APIs with OpenAPI +bookmark: OpenAPI +permalink: /schema/:title/ +icon: fas fa-tag +order: "01.026" +--- +_JsonSchema.Net.Api_ can describe an ASP.NET Core application in [OpenAPI 3.1](https://spec.openapis.org/oas/v3.1.1.html). The OpenAPI Description is assembled at compile time from your controllers and minimal-API route registrations, served as JSON or YAML, and presented on a built-in reference page. + +The schemas in the OpenAPI Description are the same ones used for [request validation](/schema/api-validation/). + +> OpenAPI support was added in _JsonSchema.Net.Api_ v1.2.0. +{: .prompt-info } + +## Getting started {#schema-api-openapi-setup} + +Add the OpenAPI services in `Program.cs`: + +```c# +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddControllers(); +builder.Services.AddOpenApi(); + +var app = builder.Build(); +app.MapControllers(); +app.Run(); +``` + +With no further configuration, the application: + +- serves the OpenAPI Description at `/openapi.json` and `/openapi.yaml` +- serves an interactive reference page at `/openapi/reference` +- registers request validation (see [Validation registration](#schema-api-openapi-validation)) + +The OpenAPI Description's title and version are seeded from the entry assembly's name and version. Everything else is discovered from the API surface. + +## Configuration {#schema-api-openapi-configuration} + +`AddOpenApi()` accepts an optional delegate that receives an `OpenApiOptions`: + +```c# +builder.Services.AddOpenApi(c => +{ + c.Document.Info.Title = "Pet Store"; + c.Document.Info.Description = "The pet store API."; + c.DocumentPath = "/openapi"; + c.InteractivePath = "/openapi/reference"; +}); +``` + +A OpenAPI Description is served only when `DocumentPath` has a value, the reference page only when `InteractivePath` does, and a file is written only when `FileOutputPath` does. Set a path to null to turn that piece off. + +| Option | Default | Purpose | +|:--|:--|:--| +| `Name` | null | The OpenAPI Description's name, read-only; null for the default OpenAPI Description (see [Publishing several OpenAPI Descriptions](#schema-api-openapi-named)) | +| `Document` | assembled from the API | The OpenAPI Description itself, exposed for editing | +| `DocumentPath` | `/openapi` | Where the OpenAPI Description is served, without an extension | +| `DocumentFormats` | `Json \| Yaml` | Which extensions resolve at `DocumentPath` | +| `InteractivePath` | `/openapi/reference` | Where the reference page is served | +| `StylesheetUrl` | null | A stylesheet applied to the reference page | +| `FileOutputPath` | null | A file path the OpenAPI Description is written to at startup, without an extension | +| `AddValidation` | `true` | Whether request validation is registered alongside the OpenAPI Description | + +### Editing the OpenAPI Description {#schema-api-openapi-document} + +`Document` is the assembled `OpenApiDocument`. It is built before your delegate runs, so anything the generator cannot infer is added by editing it directly: contact details, servers, security schemes, license and terms of service. + +```c# +builder.Services.AddOpenApi(c => +{ + c.Document.Info.Title = "Pet Store"; + c.Document.Info.Version = "2.4.0"; + c.Document.Info.Contact = new ContactInfo + { + Name = "API Support", + Email = "support@example.com" + }; + + c.Document.Servers = + [ + new Server("https://api.example.com") { Description = "Production" }, + new Server("https://staging.example.com") { Description = "Staging" } + ]; + + c.Document.Components ??= new ComponentCollection(); + c.Document.Components.SecuritySchemes = new Dictionary + { + ["bearer"] = new SecurityScheme("http") + { + Scheme = "bearer", + BearerFormat = "JWT" + } + }; +}); +``` + +The full OpenAPI 3.1 model is available under `Document`, so any part of the specification can be expressed. The path items and operations are reachable through `Document.Paths` if you need to adjust a discovered operation beyond what [its metadata](#schema-api-openapi-metadata) supplies. + +> A later `AddOpenApi()` call replaces an earlier one, so a test host or an environment-specific setup can reconfigure the OpenAPI Description. +{: .prompt-tip } + +### Document path and formats {#schema-api-openapi-formats} + +`DocumentPath` carries no extension. The extensions that resolve are decided by `DocumentFormats`: + +| `DocumentFormats` | URLs served | +|:--|:--| +| `Json \| Yaml` (default) | `/openapi.json`, `/openapi.yaml`, `/openapi.yml` | +| `Json` | `/openapi.json` | +| `Yaml` | `/openapi.yaml`, `/openapi.yml` | + +Requesting the bare path `/openapi` returns 404. + +To build the OpenAPI Description without serving it, set `DocumentPath` to null. This is useful when you only want a file written, or when the OpenAPI Description should be published only outside production: + +```c# +builder.Services.AddOpenApi(c => +{ + if (!builder.Environment.IsDevelopment()) + { + c.DocumentPath = null; + c.InteractivePath = null; + } +}); +``` + +### Reference page {#schema-api-openapi-interactive} + +`InteractivePath` is where the [reference page](#schema-api-openapi-page) is served. The page reads the OpenAPI Description over HTTP, so it requires that `DocumentPath` has a value and `DocumentFormats` includes `Json`. + +One page covers every OpenAPI Description the application publishes, so `InteractivePath` is configured on the `AddOpenApi()` call that takes no name. Setting it on a named OpenAPI Description is an error. + +If any of these constraints is violated, `AddOpenApi()` throws `InvalidOperationException` at startup. + +Set `InteractivePath` to null to serve the OpenAPI Description without a page. + +### Restyling the page {#schema-api-openapi-stylesheet} + +`StylesheetUrl` names a stylesheet that is loaded after the page's built-in styles, so its rules win where they overlap. + +The built-in styles define their palette as custom properties on `:root`, and every element carries a class prefixed `oa-`. A stylesheet can restyle the page by redefining the properties alone: + +```css +:root { + --oa-accent: #b3341e; + --oa-font: "Inter", sans-serif; +} +``` + +or by targeting classes directly: + +```css +.oa-bar { + border-bottom: 2px solid var(--oa-accent); +} +``` + +The page also defines a dark palette, applied when the browser prefers a dark color scheme or when the reader selects it with the page's theme toggle. Redefine the properties under `:root[data-theme="dark"]` to restyle that as well. + +### Writing the OpenAPI Description to disk {#schema-api-openapi-file} + +`FileOutputPath` names a file the OpenAPI Description is written to when the application starts. Like `DocumentPath`, it carries no extension; one file is written per format in `DocumentFormats`. + +```c# +builder.Services.AddOpenApi(c => +{ + c.FileOutputPath = "docs/openapi"; +}); +``` + +With the default formats, this writes `docs/openapi.json` and `docs/openapi.yaml`. The directory is created if it does not exist. + +Writing the OpenAPI Description to disk lets it be committed alongside the code, diffed in code review, and handed to client-generation tooling without running the application. The served and written OpenAPI Descriptions are rendered from the same document, so they cannot drift. + +### Validation registration {#schema-api-openapi-validation} + +`AddValidation` defaults to true, so `AddOpenApi()` registers [request validation](/schema/api-validation/) on its own. The OpenAPI Description states that a validated endpoint answers malformed input with `application/problem+json`, and registering validation here keeps that promise true without a second call. + +Registration is idempotent, and an explicit `AddJsonSchemaValidation(...)` still wins on configuration, so both calls together are fine: + +```c# +builder.Services.AddControllers() + .AddJsonSchemaValidation(converter => + { + converter.EvaluationOptions.RequireFormatValidation = true; + }); + +builder.Services.AddOpenApi(); +``` + +> If you previously called `AddJsonSchemaValidation()` yourself, nothing changes. If you did not, adding `AddOpenApi()` turns validation on. Set `AddValidation` to false to describe an API without validating requests. +{: .prompt-info } + +Registering validation also registers the enum converter matching the enum format the generated schemas describe, unless the application has already added a `JsonStringEnumConverter`. See [Enumerations](/schema/api-validation/#schema-api-enums) in the validation docs. + +## Publishing several OpenAPI Descriptions {#schema-api-openapi-named} + +An application can publish more than one OpenAPI Description, split by controller. Place `[OpenApiDocument]` on a controller to put its endpoints in a named OpenAPI Description: + +```c# +[OpenApiDocument("admin")] +[ApiController] +[Route("api/admin")] +public class AdminController : ControllerBase +{ + // ... +} +``` + +The attribute takes any number of names, so a controller that serves two audiences can name both and appears in each. Three rules govern where a controller lands: + +- A controller **without** the attribute appears in the default OpenAPI Description. +- A controller **with** the attribute appears only in the OpenAPI Descriptions it names, never in the default one. +- Adding the attribute to one controller does not move any other controller. + +Minimal APIs always land in the default OpenAPI Description. + +Each named OpenAPI Description is registered with its own `AddOpenApi()` call, passing the name: + +```c# +builder.Services.AddOpenApi(); // default +builder.Services.AddOpenApi("admin", c => // named +{ + c.Document.Info.Title = "Admin API"; +}); +``` + +A named OpenAPI Description is served at `/openapi/{name}.json` and `/openapi/{name}.yaml` by default, so several can be published without configuring paths, and each remains independently addressable for client generators and CI. A named OpenAPI Description carries no reference page of its own; the one page, configured on the unnamed call, covers all of them with a selector in its header. + +Each OpenAPI Description carries only the component schemas its own operations reach. Splitting the API does not give every OpenAPI Description every schema. + +If two OpenAPI Descriptions share a `DocumentPath`, `InteractivePath`, or `FileOutputPath`, `AddOpenApi()` throws `InvalidOperationException` at startup. Calling `AddOpenApi()` a second time with the same name replaces the earlier registration. + +> Only the default OpenAPI Description can be resolved from dependency injection as a bare `OpenApiDocument`. Named OpenAPI Descriptions are reachable through their `OpenApiOptions`. +{: .prompt-info } + +## How the OpenAPI Description is assembled {#schema-api-openapi-discovery} + +The OpenAPI Description is produced at compile time by a source generator. There is no runtime reflection over the API surface, so this works with Native AOT. + +The generator reads two kinds of declaration: + +- **Controllers** — public methods carrying `[HttpGet]`, `[HttpPost]`, `[HttpPut]`, `[HttpDelete]`, `[HttpPatch]`, `[HttpHead]`, or `[HttpOptions]`. The route is composed from the class's `[Route]` prefix and the method attribute's template, with `[controller]` and `[action]` substituted. +- **Minimal APIs** — `MapGet`, `MapPost`, `MapPut`, `MapDelete`, and `MapPatch` calls with a constant route template, including those made on a `MapGroup` (nested groups compose their prefixes, and fluent calls such as `.WithTags()` chained onto the group are seen through). `.Produces()` declares a response. + +Route templates are written in their OpenAPI form. ASP.NET constraints, defaults, optional markers, and catch-alls are stripped, so `/users/{id:int}` is described as `/users/{id}`. + +For each operation, the generator determines: + +- **Operation ID** — for a controller action, the controller name without its `Controller` suffix, an underscore, and the action name: `Users_GetById` for `UsersController.GetById`. OpenAPI requires operation IDs to be unique across a OpenAPI Description, and action names alone collide as soon as two controllers share one. A minimal API has an operation ID only when `.WithName()` is chained onto its registration. +- **Request body** — a `[FromBody]` parameter, or any complex-typed parameter on either style, mirroring ASP.NET's own binding inference. The body is documented as required `application/json`. Injected services, including interfaces and abstract types and anything marked `[FromServices]`, are never described. +- **Parameters** — the remaining parameters. A parameter named in the route template is a path parameter and is always required; any other is a query parameter. `[FromRoute]`, `[FromQuery]`, and `[FromHeader]` override this on both controllers and minimal APIs. A parameter is optional when it has a default value or its type admits null (`Nullable`, or a reference type annotated with `?`). +- **Responses** — `[ProducesResponseType]` attributes or `.Produces()` calls when present. Otherwise a 200 response whose payload type is read from an `ActionResult` return type, from a concrete return type, or from the argument of a `Results.Ok(...)` call in a minimal-API handler body. + +### Summaries, descriptions, and tags {#schema-api-openapi-metadata} + +Operations carry summaries, descriptions, tags, and descriptions for their parameters, request body, and responses. These come from two sources. + +**ASP.NET's own metadata** is read first. On controllers, `[EndpointSummary]`, `[EndpointDescription]`, and `[Tags]` on an action, plus `[Tags]` on the controller class, which applies to every action in it. On minimal APIs, `.WithSummary()`, `.WithDescription()`, and `.WithTags()` chained onto the registration. These are the framework's attributes from `Microsoft.AspNetCore.Http`, so an application migrating from another OpenAPI generator already has them. + +**XML documentation comments** fill whatever the attributes left unset. The comment on a controller action is read, as is the comment on the method a minimal-API method group points at. A lambda has no documentation comment. + +| Element | Where it lands | +|:--|:--| +| `` | the operation's `summary` | +| `` | the operation's `description` | +| `` | that parameter's `description`, or the request body's when `x` is the body parameter | +| `` | the 200 response's `description` | +| `` | that response's `description`; the response is added if the action does not declare it | + +Inline elements are flattened to text. `` becomes `Foo`, `` becomes `id`, `` and `` keep their contents, and `` separates paragraphs with a blank line. Tags come only from attributes and fluent calls. + +> The compiler only parses documentation comments when the project generates a documentation file. Without this setting, the OpenAPI Description silently carries no summaries or descriptions. +> +> ```xml +> +> true +> $(NoWarn);CS1591 +> +> ``` +> +> `CS1591` warns on every public member without a comment, which is rarely wanted on an API project. +{: .prompt-warning } + +### Schemas {#schema-api-openapi-schemas} + +Schemas come from types decorated with `[GenerateJsonSchema]`. Each such type lands in `components/schemas` once, keyed by its type name, and every body and response that uses it carries a `$ref`. The schemas are the same ones the source generator produces for validation, minus `$id` and `$schema`, which an OpenAPI-internal schema does not carry. + +Primitive parameter and response types (`string`, `int`, `bool`, `Guid`, `DateTime`, and so on) are described inline. A body or response type without `[GenerateJsonSchema]` is documented with no schema. + +Source-generated schemas describe an enumeration the way it is serialized: by name, as an integer, or either, following the enum's `[JsonConverter]` or the `JsonSchemaDefaultEnumFormat` build property. An enum type is a component schema like any other and is referenced with `$ref`; only where a property's serialization differs from the default, through a `[JsonConverter]` on that property, is the enum described inline for that property. See [Enumerations](/schema/schemagen/automatic-generation/#source-generation-enums) in the source generation docs. [Validation registration](#schema-api-openapi-validation) configures the serializer to match. + +### Class libraries {#schema-api-openapi-libraries} + +Controllers and endpoints declared in a class library appear in the host's OpenAPI Description without that library referencing the host or registering anything. A solution split into feature libraries needs no wiring beyond the project references it already has. + +### The validation response {#schema-api-openapi-problem} + +Every endpoint whose body type carries `[GenerateJsonSchema]` is validated by the middleware before the handler runs. When the body does not satisfy its schema, the middleware answers with 400 and a Problem Details body, and the handler never sees the request. + +The OpenAPI Description documents this. Each validated operation gets a `400` response returning `application/problem+json`: + +```json +"400": { + "description": "The request body did not satisfy its schema.", + "content": { + "application/problem+json": { + "schema": { + "$ref": "#/components/schemas/ValidationProblemDetails" + } + } + } +} +``` + +This response is added automatically to every validated operation. If an operation already declares a `400` response, that declaration is kept. + +## Example {#schema-api-openapi-example} + +A controller with one validated endpoint: + +```c# +// Models/CreateUserRequest.cs +[GenerateJsonSchema(PropertyNaming = NamingConvention.CamelCase)] +[AdditionalProperties(false)] +public class CreateUserRequest +{ + [Required] + [MinLength(3)] + [MaxLength(50)] + public string Username { get; set; } + + [Required] + [Minimum(18)] + public int Age { get; set; } +} + +// Models/User.cs +[GenerateJsonSchema(PropertyNaming = NamingConvention.CamelCase)] +public class User +{ + public Guid Id { get; set; } + public string Username { get; set; } +} + +// Controllers/UsersController.cs +[ApiController] +[Route("api/[controller]")] +[Tags("Users")] +public class UsersController : ControllerBase +{ + /// + /// Creates a user. + /// + /// The user to create. + /// The created user. + [HttpPost] + public ActionResult CreateUser([FromBody] CreateUserRequest request) + { + var user = _userService.CreateUser(request); + return user; + } +} +``` + +produces this OpenAPI Description: + +```json +{ + "openapi": "3.1.1", + "info": { + "title": "MyApi", + "version": "1.0.0" + }, + "paths": { + "/api/Users": { + "post": { + "tags": ["Users"], + "summary": "Creates a user.", + "operationId": "Users_CreateUser", + "requestBody": { + "description": "The user to create.", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/CreateUserRequest" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The created user.", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/User" } + } + } + }, + "400": { + "description": "The request body did not satisfy its schema.", + "content": { + "application/problem+json": { + "schema": { "$ref": "#/components/schemas/ValidationProblemDetails" } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "CreateUserRequest": { + "type": "object", + "properties": { + "username": { "type": "string", "minLength": 3, "maxLength": 50 }, + "age": { "type": "integer", "minimum": 18 } + }, + "required": ["username", "age"], + "additionalProperties": false + }, + "User": { + "type": "object", + "properties": { + "id": { "type": "string", "format": "uuid" }, + "username": { "type": "string" } + } + }, + "ValidationProblemDetails": { + "type": "object", + "properties": { + "type": { "type": "string", "const": "https://json-everything.net/errors/validation" }, + "title": { "type": "string" }, + "status": { "type": "integer" }, + "detail": { "type": "string" }, + "errors": { "type": "object" } + } + } + } + } +} +``` + +The same endpoint as a minimal API is discovered the same way, with the metadata supplied by fluent calls: + +```c# +app.MapPost("/api/users", (CreateUserRequest request, IUserService users) => + { + var user = users.CreateUser(request); + return Results.Ok(user); + }) + .WithName("Users_CreateUser") + .WithSummary("Creates a user.") + .WithTags("Users"); +``` + +## The reference page {#schema-api-openapi-page} + +The page at `InteractivePath` presents the OpenAPI Description for a reader and lets them exercise the API from the browser. It is a single page with no external dependencies. It fetches each OpenAPI Description from its `DocumentPath`. + +The page has three regions: + +- **Navigation** lists every operation by method and path. Clicking one scrolls the documentation to it and opens it in the request console. +- **Documentation** shows each operation's summary, description, tags, parameters, request body, and responses. Body schemas are rendered as property lists showing type, whether the property is required, `const` values, descriptions, and nested properties. A schema with `additionalProperties: false` says so. Clicking an operation's heading opens it in the request console. +- **Request console** shows the selected operation: a request in cURL, JavaScript, C#, Python, or Go with a copy button; inputs for each parameter and a body editor prefilled with an example built from the schema; and the full request body schema. Sending the request shows the status, elapsed time, and response body. + +The console changes only when the reader selects an operation. Scrolling the documentation does not change it, and each operation keeps its edited inputs and its last response for as long as the page is open. The navigation and console panes can be resized by dragging their edges; the widths are remembered by the browser. + +The header carries an OpenAPI Description selector when the application publishes more than one (labeled by each OpenAPI Description's title), a server selector populated from `Document.Servers`, a theme toggle that persists the reader's choice, and an authentication panel when `Document.Components.SecuritySchemes` is set. The panel supports HTTP bearer, HTTP basic, and API key schemes (header or query). Credentials entered there are held in page memory only and applied to the sample code and to sent requests. diff --git a/_docs/schema/api-validation.md b/_docs/schema/api-validation.md index 6baa2fa3..e5e0432f 100644 --- a/_docs/schema/api-validation.md +++ b/_docs/schema/api-validation.md @@ -13,6 +13,9 @@ This library combines the power of [_JsonSchema.Net_](https://www.nuget.org/pack > More information about schema-based validation can be found in the [Enhancing Deserialization with JSON Schema](/schema/serialization/) documentation. {: .prompt-tip } +> The same schemas can describe your API in OpenAPI 3.1. See [Describing APIs with OpenAPI](/schema/api-openapi/). +{: .prompt-tip } + > By default, this library uses source generation to create schemas at compile time, which works with Native AOT. If you need runtime schema generation, you can enable it via configuration, but that won't work with Native AOT. {: .prompt-info } @@ -32,6 +35,7 @@ This single call configures: - A validation filter that intercepts requests and validates JSON bodies - A custom model binder that performs schema validation during model binding - JSON serialization options with the generative validating converter +- An enum converter matching what the generated schemas describe (see [Enumerations](#schema-api-enums)) ### Customizing validation behavior {#schema-api-custom-config} @@ -66,6 +70,27 @@ If no configuration is provided, the following defaults are used: > When using source generation (the default), property naming, property order, and strict conditionals must be configured on the `[GenerateJsonSchema]` attribute itself, not in `GeneratorConfiguration`. Runtime-only settings like `PropertyNameResolver` and `Nullability` in `GeneratorConfiguration` only apply when you disable source generation. {: .prompt-warning} +### Enumerations {#schema-api-enums} + +Source-generated schemas describe an enum by its member names by default, but System.Text.Json's default configuration only accepts integers. Left alone, a request body with `"category": "Toys"` would pass schema validation and then fail deserialization. + +To keep the two in agreement, validation registers the converter that matches the enum format the schemas describe: + +| `JsonSchemaDefaultEnumFormat` | Converter registered | +|:--|:--| +| `Names` (default) | `JsonStringEnumConverter(allowIntegerValues: false)` | +| `NamesAndValues` | `JsonStringEnumConverter()` | +| `Values` | none; integers are the default | + +The converter is appended to both the MVC and the minimal-API `JsonSerializerOptions`, so a `JsonStringEnumConverter` the application registered first, or a `[JsonConverter]` on the enum type itself, wins. Nothing is added when a `JsonStringEnumConverter` is already present. + +When the application spans several assemblies with `[GenerateJsonSchema]` types, one serializer configuration has to satisfy all of them: if any assembly describes names and any describes integers, the converter accepts both. + +See [Enumerations](/schema/schemagen/automatic-generation/#source-generation-enums) in the source generation docs for how the schema side is decided, including per-type and per-property `[JsonConverter]` handling. + +> This registration was added in _JsonSchema.Net.Api_ v1.2.1 with _JsonSchema.Net.Generation_ v7.4.0. +{: .prompt-info} + ## Defining validation schemas {#schema-api-schemas} To validate a model, decorate it with the `[GenerateJsonSchema]` attribute and any applicable validation attributes: diff --git a/_docs/schema/schemagen/automatic-generation.md b/_docs/schema/schemagen/automatic-generation.md index 04555a52..02714c2a 100644 --- a/_docs/schema/schemagen/automatic-generation.md +++ b/_docs/schema/schemagen/automatic-generation.md @@ -83,6 +83,34 @@ public class MyModel > The source generator uses the same attribute system as `.FromType()`, so all of the attributes described in [the basics page](./schema-generation) work here too. {: .prompt-info} +### Enumerations {#source-generation-enums} + +Source generation describes an enumeration the way it will be serialized, so the schema and the serializer agree on what an enum value looks like. + +When the enum type carries a `[JsonConverter]`, the schema is derived from the converter: + +| Converter | Schema | +|:--|:--| +| System.Text.Json `JsonStringEnumConverter` (or `JsonStringEnumConverter`) | `anyOf` of the member names or an `integer`, matching what that converter accepts | +| Json.More `EnumStringConverter` | `enum` of the member names | + +A `[JsonConverter]` on a *property* applies to that property alone. Its schema is inlined in the format the converter implies, while other uses of the same enum type keep the shared `$ref`. + +An enum without a converter follows the `JsonSchemaDefaultEnumFormat` build property: + +| Value | Schema | +|:--|:--| +| `Names` (default) | `{ "enum": ["Books", "Toys"] }` | +| `Values` | `{ "type": "integer" }` | +| `NamesAndValues` | `{ "anyOf": [ { "enum": ["Books", "Toys"] }, { "type": "integer" } ] }` | + +When the enum is inlined for a nullable property, `null` is admitted alongside. + +> The schema is fixed at compile time, so the serializer has to accept what it describes. With the default `Names`, System.Text.Json needs a `JsonStringEnumConverter`; [_JsonSchema.Net.Api_](/schema/api-validation/#schema-api-enums) registers one for you. +> +> This applies to source generation only. Runtime generation (`.FromType()`) always describes enumerations by name. +{: .prompt-info} + ### Disabling source generation {#source-generation-disabling} If you need to use runtime generation instead, you can disable source generation by adding this to your project file: @@ -96,16 +124,17 @@ If you need to use runtime generation instead, you can disable source generation > Remember that runtime generation won't work with Native AOT. {: .prompt-warning} -Two additional MSBuild properties let you set project-wide defaults without repeating them on every attribute: +Three additional MSBuild properties let you set project-wide defaults without repeating them on every attribute: ```xml CamelCase AsDeclared + Names ``` -`JsonSchemaDefaultPropertyNaming` accepts any `NamingConvention` value (`AsDeclared`, `CamelCase`, `PascalCase`, `LowerSnakeCase`, `UpperSnakeCase`, `KebabCase`, `UpperKebabCase`). `JsonSchemaDefaultPropertyOrder` accepts `AsDeclared` or `ByName`. The `[GenerateJsonSchema]` attribute properties override these defaults per type. +`JsonSchemaDefaultPropertyNaming` accepts any `NamingConvention` value (`AsDeclared`, `CamelCase`, `PascalCase`, `LowerSnakeCase`, `UpperSnakeCase`, `KebabCase`, `UpperKebabCase`). `JsonSchemaDefaultPropertyOrder` accepts `AsDeclared` or `ByName`. The `[GenerateJsonSchema]` attribute properties override these defaults per type. `JsonSchemaDefaultEnumFormat` is covered under [Enumerations](#source-generation-enums). ## Automatic validation integration {#source-generation-validation} diff --git a/_docs/schema/schemagen/schema-generation.md b/_docs/schema/schemagen/schema-generation.md index 15ced455..5b867cae 100644 --- a/_docs/schema/schemagen/schema-generation.md +++ b/_docs/schema/schemagen/schema-generation.md @@ -155,7 +155,7 @@ The generator will handle most common types: - numeric types (`int`, `decimal`, etc.) - `bool` - `string` -- enumerations (mapped to strings) +- enumerations (mapped to strings; [source generation](./automatic-generation#source-generation-enums) can instead describe them as integers, or either, to match their serialization) - `Uri` - `JsonPointer` (from [JsonPointer.Net](https://www.nuget.org/packages/JsonPointer.Net/)) - `JsonObject`, `JsonArray`, & `JsonValue` (from namespace `System.Text.Json.Nodes`) diff --git a/assets/js/data/source-index.json b/assets/js/data/source-index.json new file mode 100644 index 00000000..29aa8ae4 --- /dev/null +++ b/assets/js/data/source-index.json @@ -0,0 +1,20517 @@ +{ + "generatedAt": "2026-06-18T07:35:44.313Z", + "repo": "json-everything/json-everything", + "ref": "main", + "fileCount": 1369, + "chunkCount": 1709, + "items": [ + { + "title": "src/Json.More.Tests/DevTest.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/DevTest.cs#L1-L43", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/DevTest.cs", + "startLine": 1, + "endLine": 43, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class DevTest\n{\n#if NET9_0_OR_GREATER\n\tpublic enum Issue890_Status\n\t{\n\t\t[JsonStringEnumMemberName(\"active\")]\n\t\tActive,\n\t\t[JsonStringEnumMemberName(\"inactive\")]\n\t\tInactive\n\t}\n\n\tpublic class Container\n\t{\n\t\tpublic Issue890_Status Enum { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Test()\n\t{\n\t\tvar options = new JsonSerializerOptions\n\t\t{\n\t\t\tWriteIndented = true,\n\t\t\tConverters = { new JsonStringEnumConverter() }\n\t\t};\n\n\t\tvar value = Issue890_Status.Inactive;\n\t\tvar objValue = (object)value;\n\n\t\tvar contained = new Container { Enum = Issue890_Status.Inactive };\n\n\t\tConsole.WriteLine(JsonSerializer.Serialize(value, options));\n\t\tConsole.WriteLine(JsonSerializer.Serialize(objValue, options));\n\t\tConsole.WriteLine(JsonSerializer.Serialize(contained, options));\n\t}\n#endif\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class DevTest\n{\n#if NET9_0_OR_GREATER\n\tpublic enum Issue890_Status\n\t{\n\t\t[JsonStringEn" + }, + { + "title": "src/Json.More.Tests/EnumStringConverterTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/EnumStringConverterTests.cs#L1-L103", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/EnumStringConverterTests.cs", + "startLine": 1, + "endLine": 103, + "content": "using System;\nusing System.Net;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class EnumStringConverterTests\n{\n\tprivate class ConversionTest\n\t{\n\t\t[JsonConverter(typeof(EnumStringConverter))]\n\t\tpublic DayOfWeek Day { get; set; }\n\t}\n\n\t[Test]\n\tpublic void DayOfWeekAsPropertyIsConverted()\n\t{\n\t\tvar expected = \"{\\\"Day\\\":\\\"Wednesday\\\"}\";\n\t\tvar actual = JsonSerializer.Serialize(new ConversionTest { Day = DayOfWeek.Wednesday });\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\n\t\tvar deserialized = JsonSerializer.Deserialize(actual)!;\n\n\t\tAssert.That(deserialized.Day, Is.EqualTo(DayOfWeek.Wednesday));\n\t}\n\n\t[JsonConverter(typeof(EnumStringConverter))]\n\tpublic enum CustomEnum\n\t{\n\t\tZero,\n\t\t[System.ComponentModel.Description(\"one\")]\n\t\tOne,\n\t\tTwo\n\t}\n\n\t[TestCase(CustomEnum.Zero, \"Zero\")]\n\t[TestCase(CustomEnum.One, \"one\")]\n\t[TestCase(CustomEnum.Two, \"Two\")]\n\tpublic void CustomEnumIsConverted(CustomEnum value, string serializedValue)\n\t{\n\t\tvar expected = $\"\\\"{serializedValue}\\\"\";\n\t\tvar actual = JsonSerializer.Serialize(value);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\n\t\tvar deserialized = JsonSerializer.Deserialize(actual);\n\n\t\tAssert.That(deserialized, Is.EqualTo(value));\n\t}\n\n\t[JsonConverter(typeof(EnumStringConverter))]\n\t[Flags]\n\tprivate enum CustomFlagsEnum\n\t{\n\t\tZero,\n\t\tOne = 1,\n\t\tTwo = 2\n\t}\n\n\tprivate class FlagsEnumContainer\n\t{\n\t\tpublic CustomFlagsEnum Value { get; set; }\n\t}\n\n\t[Test]\n\tpublic void CustomFlagsEnumIsConverted()\n\t{\n\t\tvar value = new FlagsEnumContainer { Value = CustomFlagsEnum.One | CustomFlagsEnum.Two };\n\n\t\tvar expected = \"{\\\"Value\\\":[\\\"One\\\",\\\"Two\\\"]}\";\n\t\tvar actual = JsonSerializer.Serialize(value);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\n\t\tvar deserialized = JsonSerializer.Deserialize(actual)!;\n\n\t\tAssert.That(deserialized.Value, Is.EqualTo(CustomFlagsEnum.One | CustomFlagsEnum.Two));\n\t}\n\n\tprivate class EnumWithDuplicatedMemberValuesContainer\n\t{\n\t\t[JsonConverter(typeof(EnumStringConverter))]\n\t\tpublic HttpStatusCode Value { get; set; }\n\t}\n\n\t[Test]\n\tpublic void EnumWithDuplicatedMemberValuesIsConverted()\n\t{\n\t\tvar value = new EnumWithDuplicatedMemberValuesContainer { Value = HttpStatusCode.MultipleChoices };\n\n\t\tvar expected = \"{\\\"Value\\\":\\\"MultipleChoices\\\"}\";\n\t\tvar actual = JsonSerializer.Serialize(value);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\n\t\tvar deserialized = JsonSerializer.Deserialize(actual)!;\n\n\t\tAssert.That(deserialized.Value, Is.EqualTo(HttpStatusCode.MultipleChoices));\n\t}\n}", + "snippet": "using System;\nusing System.Net;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class EnumStringConverterTests\n{\n\tprivate class ConversionTest\n\t{\n\t" + }, + { + "title": "src/Json.More.Tests/EqualityTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/EqualityTests.cs#L1-L55", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/EqualityTests.cs", + "startLine": 1, + "endLine": 55, + "content": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class EqualityTests\n{\n\t[Test]\n\tpublic void NumbersAreEqualEvenIfOneHasTrailingZero()\n\t{\n\t\tJsonNode intFour = 4;\n\t\tJsonNode floatFour = 4.0;\n\n\t\tAssert.That(intFour.IsEquivalentTo(floatFour), Is.True);\n\t}\n\n\t[Test]\n\tpublic void NumbersAreEqualEvenIfOneHasTrailingZero_Decimal()\n\t{\n\t\tJsonNode intFour = (decimal) 4;\n\t\tJsonNode floatFour = (decimal) 4.0;\n\n\t\tAssert.That(intFour.IsEquivalentTo(floatFour), Is.True);\n\t}\n\n\t[Test]\n\tpublic void NumbersAreEqualEvenIfOneHasTrailingZero_IntAndDecimal()\n\t{\n\t\tJsonNode intFour = 4;\n\t\tJsonNode floatFour = 4.0m;\n\n\t\tAssert.That(intFour.IsEquivalentTo(floatFour), Is.True);\n\t}\n\n\t[Test]\n\tpublic void NumbersAreEqualEvenIfOneHasTrailingZero_Summed()\n\t{\n\t\tdecimal a = 4;\n\t\tdecimal b = (decimal)4.00;\n\t\tJsonNode explicitFour = a;\n\t\tJsonNode summedFour = b;\n\n\t\tAssert.That(explicitFour.IsEquivalentTo(summedFour), Is.True);\n\t}\n\n\t[Test]\n\tpublic void NumbersAreEqualEvenIfOneHasTrailingZero_Parsed()\n\t{\n\t\tvar intFour = JsonNode.Parse(\"4\");\n\t\tvar floatFour = JsonNode.Parse(\"4.0\");\n\n\t\tAssert.That(intFour.IsEquivalentTo(floatFour), Is.True);\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class EqualityTests\n{\n\t[Test]\n\tpublic void NumbersAreEqualEvenIfOneHasTrailingZero()\n\t{\n\t\tJsonNode intFour = 4;\n\t\tJsonNode floatFou" + }, + { + "title": "src/Json.More.Tests/GetPathFromRootTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/GetPathFromRootTests.cs#L1-L75", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/GetPathFromRootTests.cs", + "startLine": 1, + "endLine": 75, + "content": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class GetPathFromRootTests\n{\n\t[Test]\n\tpublic void BasicPath()\n\t{\n\t\tvar data = new JsonObject\n\t\t{\n\t\t\t[\"foo\"] = new JsonArray(0, 1, 2, 3)\n\t\t};\n\n\t\tvar target = data[\"foo\"]![2]!;\n\n\t\tvar expected = \"$['foo'][2]\";\n\n\t\tvar actual = target.GetPathFromRoot();\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void BasicPathGetShorthand()\n\t{\n\t\tvar data = new JsonObject\n\t\t{\n\t\t\t[\"foo\"] = new JsonArray(0, 1, 2, 3)\n\t\t};\n\n\t\tvar target = data[\"foo\"]![2]!;\n\n\t\tvar expected = \"$.foo[2]\";\n\n\t\tvar actual = target.GetPathFromRoot(true);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void PathWithSingleQuoteInKey()\n\t{\n\t\tvar data = new JsonObject\n\t\t{\n\t\t\t[\"fo'o\"] = new JsonArray(0, 1, 2, 3)\n\t\t};\n\n\t\tvar target = data[\"fo'o\"]![2]!;\n\n\t\tvar expected = \"$['fo\\\\'o'][2]\";\n\n\t\tvar actual = target.GetPathFromRoot();\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void PathWithDoubleQuoteInKey()\n\t{\n\t\tvar data = new JsonObject\n\t\t{\n\t\t\t[\"fo\\\"o\"] = new JsonArray(0, 1, 2, 3)\n\t\t};\n\n\t\tvar target = data[\"fo\\\"o\"]![2]!;\n\n\t\tvar expected = \"$['fo\\\"o'][2]\";\n\n\t\tvar actual = target.GetPathFromRoot();\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class GetPathFromRootTests\n{\n\t[Test]\n\tpublic void BasicPath()\n\t{\n\t\tvar data = new JsonObject\n\t\t{\n\t\t\t[\"foo\"] = new JsonArray(0, 1, 2" + }, + { + "title": "src/Json.More.Tests/GetPointerFromRootTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/GetPointerFromRootTests.cs#L1-L58", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/GetPointerFromRootTests.cs", + "startLine": 1, + "endLine": 58, + "content": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class GetPointerFromRootTests\n{\n\t[Test]\n\tpublic void BasicPointer()\n\t{\n\t\tvar data = new JsonObject\n\t\t{\n\t\t\t[\"foo\"] = new JsonArray(0, 1, 2, 3)\n\t\t};\n\n\t\tvar target = data[\"foo\"]![2]!;\n\n\t\tvar expected = \"/foo/2\";\n\n\t\tvar actual = target.GetPointerFromRoot();\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void PointerWithTilde()\n\t{\n\t\tvar data = new JsonObject\n\t\t{\n\t\t\t[\"fo~o\"] = new JsonArray(0, 1, 2, 3)\n\t\t};\n\n\t\tvar target = data[\"fo~o\"]![2]!;\n\n\t\tvar expected = \"/fo~0o/2\";\n\n\t\tvar actual = target.GetPointerFromRoot();\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void PointerWithSlash()\n\t{\n\t\tvar data = new JsonObject\n\t\t{\n\t\t\t[\"fo/o\"] = new JsonArray(0, 1, 2, 3)\n\t\t};\n\n\t\tvar target = data[\"fo/o\"]![2]!;\n\n\t\tvar expected = \"/fo~1o/2\";\n\n\t\tvar actual = target.GetPointerFromRoot();\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class GetPointerFromRootTests\n{\n\t[Test]\n\tpublic void BasicPointer()\n\t{\n\t\tvar data = new JsonObject\n\t\t{\n\t\t\t[\"foo\"] = new JsonArray(0" + }, + { + "title": "src/Json.More.Tests/JsonArrayTupleConverterDeserializationTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/JsonArrayTupleConverterDeserializationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/JsonArrayTupleConverterDeserializationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class JsonArrayTupleConverterDeserializationTests\n{\n\tprivate static readonly JsonSerializerOptions _options = new()\n\t{\n\t\tConverters = { new JsonArrayTupleConverter() }\n\t};\n\n\t[Test]\n\tpublic void OneValue()\n\t{\n\t\tvar expected = ValueTuple.Create(1);\n\t\tvar json = \"[1]\";\n\n\t\tvar actual = JsonSerializer.Deserialize>(json, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void TwoValues()\n\t{\n\t\tvar expected = (1, \"string\");\n\t\tvar json = \"[1,\\\"string\\\"]\";\n\n\t\tvar actual = JsonSerializer.Deserialize<(int, string)>(json, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void ThreeValues()\n\t{\n\t\tvar expected = (1, \"string\", false);\n\t\tvar json = \"[1,\\\"string\\\",false]\";\n\n\t\tvar actual = JsonSerializer.Deserialize<(int, string, bool)>(json, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void FourValues()\n\t{\n\t\tvar expected = (1, \"string\", false, -4.2);\n\t\tvar json = \"[1,\\\"string\\\",false,-4.2]\";\n\n\t\tvar actual = JsonSerializer.Deserialize<(int, string, bool, double)>(json, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void FiveValues()\n\t{\n\t\tvar expected = (1, \"string\", false, -4.2, \"foo\");\n\t\tvar json = \"[1,\\\"string\\\",false,-4.2,\\\"foo\\\"]\";\n\n\t\tvar actual = JsonSerializer.Deserialize<(int, string, bool, double, string)>(json, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void SixValues()\n\t{\n\t\tvar expected = (1, \"string\", false, -4.2, \"foo\", 6);\n\t\tvar json = \"[1,\\\"string\\\",false,-4.2,\\\"foo\\\",6]\";\n\n\t\tvar actual = JsonSerializer.Deserialize<(int, string, bool, double, string, int)>(json, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void SevenValues()\n\t{\n\t\tvar expected = (1, \"string\", false, -4.2, \"foo\", 6, 7);\n\t\tvar json = \"[1,\\\"string\\\",false,-4.2,\\\"foo\\\",6,7]\";\n\n\t\tvar actual = JsonSerializer.Deserialize<(int, string, bool, double, string, int, int)>(json, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void EightValues()\n\t{\n\t\tvar expected = (1, \"string\", false, -4.2, \"foo\", 6, 7, 8);\n\t\tvar json = \"[1,\\\"string\\\",false,-4.2,\\\"foo\\\",6,7,8]\";\n\n\t\tvar actual = JsonSerializer.Deserialize<(int, string, bool, double, string, int, int, int)>(json, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void MoreValues()\n\t{\n\t\tvar expected = (1, \"string\", false, -4.2, \"foo\", 6, 7, 8, 9, 10, 11, 12);\n\t\tvar json = \"[1,\\\"string\\\",false,-4.2,\\\"foo\\\",6,7,8,9,10,11,12]\";\n\n\t\tvar actual = JsonSerializer.Deserialize<(int, string, bool, double, string, int, int, int, int, int, int, int)>(json, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void TupleInObject()\n\t{\n\t\tvar expected = (false, new ObjectWithTuple { Tuple = (42, \"foo\") });\n\t\tvar json = \"[false,{\\\"Tuple\\\":[42,\\\"foo\\\"]}]\";\n\n\t\tvar actual = JsonSerializer.Deserialize<(bool, ObjectWithTuple)>(json, _options);", + "snippet": "using System;\nusing System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class JsonArrayTupleConverterDeserializationTests\n{\n\tprivate static readonly JsonSerializerOptions _options = new()\n\t{\n\t\tCo" + }, + { + "title": "src/Json.More.Tests/JsonArrayTupleConverterDeserializationTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/JsonArrayTupleConverterDeserializationTests.cs#L121-L146", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/JsonArrayTupleConverterDeserializationTests.cs", + "startLine": 121, + "endLine": 146, + "content": "Assert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void TupleInArray()\n\t{\n\t\t(int, string, bool, double, string, int, int, int)[] expected = [(1, \"string\", false, -4.2, \"foo\", 6, 7, 8), (10, \"bool\", true, 4.2, \"bar\", 6, 7, 8)];\n\t\tvar json = \"[[1,\\\"string\\\",false,-4.2,\\\"foo\\\",6,7,8],[10,\\\"bool\\\",true,4.2,\\\"bar\\\",6,7,8]]\";\n\n\t\tvar actual = JsonSerializer.Deserialize<(int, string, bool, double, string, int, int, int)[]>(json, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void NullInTuple()\n\t{\n\t\tvar expected = new ValueTuple(null!);\n\t\tvar actual = JsonSerializer.Deserialize>(\"[null]\", new JsonSerializerOptions\n\t\t{\n\t\t\tConverters = { new JsonArrayTupleConverter() }\n\t\t});\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n}", + "snippet": "Assert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void TupleInArray()\n\t{\n\t\t(int, string, bool, double, string, int, int, int)[] expected = [(1, \"string\", false, -4.2, \"foo\", 6, 7, 8), (10, \"bool\", true, 4.2," + }, + { + "title": "src/Json.More.Tests/JsonArrayTupleConverterSerializationTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/JsonArrayTupleConverterSerializationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/JsonArrayTupleConverterSerializationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class JsonArrayTupleConverterSerializationTests\n{\n\tprivate static readonly JsonSerializerOptions _options = new()\n\t{\n\t\tConverters = { new JsonArrayTupleConverter() }\n\t};\n\n\t[Test]\n\tpublic void OneValue()\n\t{\n\t\tvar tuple = ValueTuple.Create(1);\n\t\tvar expected = \"[1]\";\n\n\t\tvar actual = JsonSerializer.Serialize(tuple, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void TwoValues()\n\t{\n\t\tvar tuple = (1, \"string\");\n\t\tvar expected = \"[1,\\\"string\\\"]\";\n\n\t\tvar actual = JsonSerializer.Serialize(tuple, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void ThreeValues()\n\t{\n\t\tvar tuple = (1, \"string\", false);\n\t\tvar expected = \"[1,\\\"string\\\",false]\";\n\n\t\tvar actual = JsonSerializer.Serialize(tuple, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void FourValues()\n\t{\n\t\tvar tuple = (1, \"string\", false, -4.2);\n\t\tvar expected = \"[1,\\\"string\\\",false,-4.2]\";\n\n\t\tvar actual = JsonSerializer.Serialize(tuple, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void FiveValues()\n\t{\n\t\tvar tuple = (1, \"string\", false, -4.2, \"foo\");\n\t\tvar expected = \"[1,\\\"string\\\",false,-4.2,\\\"foo\\\"]\";\n\n\t\tvar actual = JsonSerializer.Serialize(tuple, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void SixValues()\n\t{\n\t\tvar tuple = (1, \"string\", false, -4.2, \"foo\", 6);\n\t\tvar expected = \"[1,\\\"string\\\",false,-4.2,\\\"foo\\\",6]\";\n\n\t\tvar actual = JsonSerializer.Serialize(tuple, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void SevenValues()\n\t{\n\t\tvar tuple = (1, \"string\", false, -4.2, \"foo\", 6, 7);\n\t\tvar expected = \"[1,\\\"string\\\",false,-4.2,\\\"foo\\\",6,7]\";\n\n\t\tvar actual = JsonSerializer.Serialize(tuple, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void EightValues()\n\t{\n\t\tvar tuple = (1, \"string\", false, -4.2, \"foo\", 6, 7, 8);\n\t\tvar expected = \"[1,\\\"string\\\",false,-4.2,\\\"foo\\\",6,7,8]\";\n\n\t\tvar actual = JsonSerializer.Serialize(tuple, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void MoreValues()\n\t{\n\t\tvar tuple = (1, \"string\", false, -4.2, \"foo\", 6, 7, 8, 9, 10, 11, 12);\n\t\tvar expected = \"[1,\\\"string\\\",false,-4.2,\\\"foo\\\",6,7,8,9,10,11,12]\";\n\n\t\tvar actual = JsonSerializer.Serialize(tuple, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void TupleInObject()\n\t{\n\t\tvar tuple = (false, new ObjectWithTuple { Tuple = (42, \"foo\") });\n\t\tvar expected = \"[false,{\\\"Tuple\\\":[42,\\\"foo\\\"]}]\";\n\n\t\tvar actual = JsonSerializer.Serialize(tuple, _options);", + "snippet": "using System;\nusing System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.More.Tests;\n\npublic class JsonArrayTupleConverterSerializationTests\n{\n\tprivate static readonly JsonSerializerOptions _options = new()\n\t{\n\t\tConv" + }, + { + "title": "src/Json.More.Tests/JsonArrayTupleConverterSerializationTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/JsonArrayTupleConverterSerializationTests.cs#L121-L134", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/JsonArrayTupleConverterSerializationTests.cs", + "startLine": 121, + "endLine": 134, + "content": "Assert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void TupleInArray()\n\t{\n\t\t(int, string, bool, double, string, int, int, int)[] tuple = [(1, \"string\", false, -4.2, \"foo\", 6, 7, 8), (10, \"bool\", true, 4.2, \"bar\", 6, 7, 8)];\n\t\tvar expected = \"[[1,\\\"string\\\",false,-4.2,\\\"foo\\\",6,7,8],[10,\\\"bool\\\",true,4.2,\\\"bar\\\",6,7,8]]\";\n\n\t\tvar actual = JsonSerializer.Serialize(tuple, _options);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n}", + "snippet": "Assert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void TupleInArray()\n\t{\n\t\t(int, string, bool, double, string, int, int, int)[] tuple = [(1, \"string\", false, -4.2, \"foo\", 6, 7, 8), (10, \"bool\", true, 4.2, \"b" + }, + { + "title": "src/Json.More.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/Json.More.Tests/obj/Debug/net10.0/Json.More.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/obj/Debug/net10.0/Json.More.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/obj/Debug/net10.0/Json.More.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/Json.More.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/Json.More.Tests/obj/Debug/net8.0/Json.More.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/obj/Debug/net8.0/Json.More.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/obj/Debug/net8.0/Json.More.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/Json.More.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/Json.More.Tests/obj/Debug/net9.0/Json.More.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/obj/Debug/net9.0/Json.More.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/obj/Debug/net9.0/Json.More.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/Json.More.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/Json.More.Tests/obj/Release/net10.0/Json.More.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/obj/Release/net10.0/Json.More.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/obj/Release/net10.0/Json.More.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/Json.More.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/Json.More.Tests/obj/Release/net8.0/Json.More.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/obj/Release/net8.0/Json.More.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/obj/Release/net8.0/Json.More.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/Json.More.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/Json.More.Tests/obj/Release/net9.0/Json.More.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/obj/Release/net9.0/Json.More.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/obj/Release/net9.0/Json.More.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/Json.More.Tests/ObjectWithTuple.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More.Tests/ObjectWithTuple.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More.Tests/ObjectWithTuple.cs", + "startLine": 1, + "endLine": 26, + "content": "using System;\n\nnamespace Json.More.Tests;\n\npublic class ObjectWithTuple : IEquatable\n{\n\tpublic (int, string) Tuple { get; set; }\n\n\tpublic bool Equals(ObjectWithTuple? other)\n\t{\n\t\tif (other is null) return false;\n\t\tif (ReferenceEquals(this, other)) return true;\n\t\treturn Tuple.Equals(other.Tuple);\n\t}\n\n\tpublic override bool Equals(object? obj)\n\t{\n\t\treturn Equals(obj as ObjectWithTuple);\n\t}\n\n\tpublic override int GetHashCode()\n\t{\n\t\t// ReSharper disable once NonReadonlyMemberInGetHashCode\n\t\treturn Tuple.GetHashCode();\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.More.Tests;\n\npublic class ObjectWithTuple : IEquatable\n{\n\tpublic (int, string) Tuple { get; set; }\n\n\tpublic bool Equals(ObjectWithTuple? other)\n\t{\n\t\tif (other is null) retur" + }, + { + "title": "src/Json.More/EnumStringConverter.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/EnumStringConverter.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/EnumStringConverter.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Frozen;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Reflection;\nusing System.Text.Json;\n\nnamespace Json.More;\n\n/// \n/// Enum to string converter.\n/// \n/// The supported enum.\n/// \n///\tThis serializer supports the to indicate custom value naming.\n///\n/// The is supported via serializing to an array of base values. Inclusion\n/// of composite values is not supported.\n/// \n/// \n/// The attribute can be applied to both the enum type itself:\n/// ```c#\n/// [JsonConverter(typeof(EnumStringConverter))]\n/// public enum MyEnum {\n/// Foo,\n/// Bar\n/// }\n/// ```\n/// \n/// or to a property of the enum type:\n///\n/// ```c#\n/// public class MyClass {\n///\t [JsonConverter(typeof(EnumStringConverter))]\n///\t public MyEnum Value { get; set; }\n/// }\n/// ```\n/// \npublic class EnumStringConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] T> : WeaklyTypedJsonConverter\n\twhere T : Enum\n{\n\tprivate static FrozenDictionary? _readValues;\n\tprivate static FrozenDictionary? _writeValues;\n\tprivate static Func? _aggregator;\n\t// ReSharper disable once StaticMemberInGenericType\n\tprivate static readonly object _lock = new();\n\n\tprivate static FrozenDictionary ReadValues\n\t{\n\t\tget\n\t\t{\n\t\t\tEnsureMap();\n\t\t\treturn _readValues!;\n\t\t}\n\t}\n\n\tprivate static FrozenDictionary WriteValues\n\t{\n\t\tget\n\t\t{\n\t\t\tEnsureMap();\n\t\t\treturn _writeValues!;\n\t\t}\n\t}\n\n\tprivate static Func Aggregator => _aggregator ??= BuildAggregator();\n\n\t/// Reads and converts the JSON to type .\n\t/// The reader.\n\t/// The type to convert.\n\t/// An object that specifies serialization options to use.\n\t/// The converted value.\n\t/// Element was not a string or could not identify the JSON value as a known enum value.\n\tpublic override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tEnsureMap();\n\n\t\tstring str;\n\t\tif (reader.TokenType is not (JsonTokenType.String or JsonTokenType.PropertyName))\n\t\t{\n\t\t\tif (typeToConvert.GetCustomAttribute() != null && reader.TokenType == JsonTokenType.StartArray)\n\t\t\t{\n\t\t\t\treader.Read(); // waste the start array\n\t\t\t\tvar values = new List();\n\t\t\t\twhile (reader.TokenType != JsonTokenType.EndArray)\n\t\t\t\t{\n\t\t\t\t\tstr = reader.GetString()!;\n\n\t\t\t\t\tif (!ReadValues.TryGetValue(str, out var immediate))\n\t\t\t\t\t\tthrow new JsonException($\"Could not find appropriate value for {str} in type {typeToConvert.Name}\");\n\n\t\t\t\t\tvalues.Add(immediate);\n\t\t\t\t\treader.Read();\n\t\t\t\t}\n\n\t\t\t\treturn values.Aggregate(Aggregator);\n\t\t\t}\n\t\t\tthrow new JsonException(\"Expected string\");\n\t\t}\n\n\t\tstr = reader.GetString()!;\n\n\t\treturn ReadValues.TryGetValue(str, out var value)\n\t\t\t? value\n\t\t\t: throw new JsonException($\"Could not find appropriate value for {str} in type {typeToConvert.Name}\");\n\t}\n\n\t/// Reads a dictionary key from a JSON property name.\n\t/// The to read from.\n\t/// The type to convert.\n\t/// The options to use when reading the value.\n\t/// The value that was converted.\n\tpublic override T ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\treturn Read(ref reader, typeToConvert, options);\n\t}", + "snippet": "using System;\nusing System.Collections.Frozen;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Reflecti" + }, + { + "title": "src/Json.More/EnumStringConverter.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/EnumStringConverter.cs#L121-L202", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/EnumStringConverter.cs", + "startLine": 121, + "endLine": 202, + "content": "/// Writes a specified value as JSON.\n\t/// The writer to write to.\n\t/// The value to convert to JSON.\n\t/// An object that specifies serialization options to use.\n\tpublic override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)\n\t{\n\t\tEnsureMap();\n\n\t\tif (typeof(T).GetCustomAttribute() != null && !WriteValues.ContainsKey(value))\n\t\t{\n\t\t\twriter.WriteStartArray();\n\t\t\tforeach (var name in WriteValues.Keys)\n\t\t\t{\n\t\t\t\tif (value.HasFlag(name) && !name.Equals(default(T)))\n\t\t\t\t\twriter.WriteStringValue(WriteValues[name]);\n\t\t\t}\n\t\t\twriter.WriteEndArray();\n\t\t\treturn;\n\t\t}\n\n\t\twriter.WriteStringValue(WriteValues[value]);\n\t}\n\n\t/// Writes a dictionary key as a JSON property name.\n\t/// The to write to.\n\t/// The value to convert. The value of determines if the converter handles values.\n\t/// The options to use when writing the value.\n\tpublic override void WriteAsPropertyName(Utf8JsonWriter writer, T value, JsonSerializerOptions options)\n\t{\n EnsureMap();\n \n writer.WritePropertyName(WriteValues[value]);\n\t}\n\n\tprivate static Func BuildAggregator()\n\t{\n\t\tvar underlyingType = Enum.GetUnderlyingType(typeof(T));\n\t\tvar currentParameter = Expression.Parameter(typeof(T), \"current\");\n\t\tvar nextParameter = Expression.Parameter(typeof(T), \"next\");\n\n\t\treturn Expression.Lambda>(\n\t\t\tExpression.Convert(\n\t\t\t\tExpression.Or(\n\t\t\t\t\tExpression.Convert(currentParameter, underlyingType),\n\t\t\t\t\tExpression.Convert(nextParameter, underlyingType)\n\t\t\t\t),\n\t\t\t\ttypeof(T)\n\t\t\t),\n\t\t\tcurrentParameter,\n\t\t\tnextParameter\n\t\t).Compile();\n\t}\n\n\tprivate static void EnsureMap()\n\t{\n\t\tif (_readValues != null && _writeValues != null) return;\n\t\tlock (_lock)\n\t\t{\n\t\t\tif (_readValues != null && _writeValues != null) return;\n\n\t\t\tvar fields = typeof(T).GetFields();\n\n\t\t\tvar readValues = new Dictionary(capacity: fields.Length);\n\t\t\tvar writeValues = new Dictionary(capacity: fields.Length);\n\n\t\t\tforeach (var field in fields.Where(f => !f.IsSpecialName))\n\t\t\t{\n\t\t\t\tvar value = (T) Enum.Parse(typeof(T), field.Name);\n\t\t\t\tvar description = field.GetCustomAttribute()?.Description ?? field.Name;\n\n\t\t\t\tif (!readValues.ContainsKey(description))\n\t\t\t\t\treadValues.Add(description, value);\n\t\t\t\tif (!writeValues.ContainsKey(value))\n\t\t\t\t\twriteValues.Add(value, description);\n\t\t\t}\n\n\t\t\t_readValues = readValues.ToFrozenDictionary();\n\t\t\t_writeValues = writeValues.ToFrozenDictionary();\n\t\t}\n\t}\n}", + "snippet": "/// Writes a specified value as JSON.\n\t/// The writer to write to.\n\t/// The value to convert to JSON.\n\t/// An object that " + }, + { + "title": "src/Json.More/JsonArrayTupleConverter.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonArrayTupleConverter.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonArrayTupleConverter.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\n\nnamespace Json.More;\n\n/// \n/// Provides JSON serialization for the family of types.\n/// \n/// \n/// WARNING: This converter is not AOT-friendly.\n/// \n[RequiresDynamicCode(\"JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.\")]\npublic class JsonArrayTupleConverter : JsonConverterFactory\n{\n\t/// When overridden in a derived class, determines whether the converter instance can convert the specified object type.\n\t/// The type of the object to check whether it can be converted by this converter instance.\n\t/// \n\t/// if the instance can convert the specified object type; otherwise, .\n\tpublic override bool CanConvert(Type typeToConvert)\n\t{\n\t\treturn !typeToConvert.IsArray &&\n\t\t (typeToConvert.FullName?.StartsWith(\"System.ValueTuple`\") ?? false);\n\t}\n\n\t/// Creates a converter for a specified type.\n\t/// The type handled by the converter.\n\t/// The serialization options to use.\n\t/// A converter which is compatible with .\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar typeParams = typeToConvert.GetGenericArguments();\n\t\tvar converterType = typeParams.Length switch\n\t\t{\n\t\t\t1 => typeof(JsonArrayTupleConverter<>).MakeGenericType(typeParams),\n\t\t\t2 => typeof(JsonArrayTupleConverter<,>).MakeGenericType(typeParams),\n\t\t\t3 => typeof(JsonArrayTupleConverter<,,>).MakeGenericType(typeParams),\n\t\t\t4 => typeof(JsonArrayTupleConverter<,,,>).MakeGenericType(typeParams),\n\t\t\t5 => typeof(JsonArrayTupleConverter<,,,,>).MakeGenericType(typeParams),\n\t\t\t6 => typeof(JsonArrayTupleConverter<,,,,,>).MakeGenericType(typeParams),\n\t\t\t7 => typeof(JsonArrayTupleConverter<,,,,,,>).MakeGenericType(typeParams),\n#pragma warning disable IL2055 // Either the type on which the MakeGenericType is called can't be statically determined, or the type parameters to be used for generic arguments can't be statically determined.\n\t\t\t8 => typeof(JsonArrayTupleConverter<,,,,,,,>).MakeGenericType(typeParams),\n#pragma warning restore IL2055 // Either the type on which the MakeGenericType is called can't be statically determined, or the type parameters to be used for generic arguments can't be statically determined.\n\t\t\t_ => throw new ArgumentOutOfRangeException()\n\t\t};\n\n\t\treturn (JsonConverter?)Activator.CreateInstance(converterType, []);\n\t}\n}\n\ninternal class JsonArrayTupleConverter : JsonConverter>\n{\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override ValueTuple Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tif (reader.TokenType != JsonTokenType.StartArray)\n\t\t\tthrow new JsonException(\"Expected tuple to be encoded as an array.\");\n\n\t\tvar array = JsonElement.ParseValue(ref reader);\n\t\tvar enumerator = array.EnumerateArray();\n\n\t\treturn ValueReader.ReadValues1(enumerator, options);\n\t}\n\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override void Write(Utf8JsonWriter writer, ValueTuple value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartArray();\n\t\tJsonSerializer.Serialize(writer, value.Item1, options);\n\t\twriter.WriteEndArray();\n\t}\n}\n\ninternal class JsonArrayTupleConverter : JsonConverter<(T1, T2)>\n{\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override (T1, T2) Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tif (reader.TokenType != JsonTokenType.StartArray)\n\t\t\tthrow new JsonException(\"Expected tuple to be encoded as an array.\");\n\n\t\tvar array = JsonElement.ParseValue(ref reader);\n\t\tvar enumerator = array.EnumerateArray();\n\n\t\treturn ValueReader.ReadValues2(enumerator, options);\n\t}\n\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override void Write(Utf8JsonWriter writer, (T1, T2) value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartArray();\n\t\tJsonSerializer.Serialize(writer, value.Item1, options);\n\t\tJsonSerializer.Serialize(writer, value.Item2, options);\n\t\twriter.WriteEndArray();\n\t}\n}\n\ninternal class JsonArrayTupleConverter : JsonConverter<(T1, T2, T3)>\n{\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override (T1, T2, T3) Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tif (reader.TokenType != JsonTokenType.StartArray)\n\t\t\tthrow new JsonException(\"Expected tuple to be encoded as an array.\");\n\t\n\t\tvar array = JsonElement.ParseValue(ref reader);\n\t\tvar enumerator = array.EnumerateArray();\n\n\t\treturn ValueReader.ReadValues3(enumerator, options);\n\t}", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\n\nnamespace Json.More;\n\n/// \n/// Provides JSON serialization for the " + }, + { + "title": "src/Json.More/JsonArrayTupleConverter.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonArrayTupleConverter.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonArrayTupleConverter.cs", + "startLine": 121, + "endLine": 240, + "content": "[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override void Write(Utf8JsonWriter writer, (T1, T2, T3) value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartArray();\n\t\tJsonSerializer.Serialize(writer, value.Item1, options);\n\t\tJsonSerializer.Serialize(writer, value.Item2, options);\n\t\tJsonSerializer.Serialize(writer, value.Item3, options);\n\t\twriter.WriteEndArray();\n\t}\n}\n\ninternal class JsonArrayTupleConverter : JsonConverter<(T1, T2, T3, T4)>\n{\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override (T1, T2, T3, T4) Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tif (reader.TokenType != JsonTokenType.StartArray)\n\t\t\tthrow new JsonException(\"Expected tuple to be encoded as an array.\");\n\n\t\tvar array = JsonElement.ParseValue(ref reader);\n\t\tvar enumerator = array.EnumerateArray();\n\n\t\treturn ValueReader.ReadValues4(enumerator, options);\n\t}\n\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override void Write(Utf8JsonWriter writer, (T1, T2, T3, T4) value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartArray();\n\t\tJsonSerializer.Serialize(writer, value.Item1, options);\n\t\tJsonSerializer.Serialize(writer, value.Item2, options);\n\t\tJsonSerializer.Serialize(writer, value.Item3, options);\n\t\tJsonSerializer.Serialize(writer, value.Item4, options);\n\t\twriter.WriteEndArray();\n\t}\n}\n\ninternal class JsonArrayTupleConverter : JsonConverter<(T1, T2, T3, T4, T5)>\n{\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override (T1, T2, T3, T4, T5) Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tif (reader.TokenType != JsonTokenType.StartArray)\n\t\t\tthrow new JsonException(\"Expected tuple to be encoded as an array.\");\n\n\t\tvar array = JsonElement.ParseValue(ref reader);\n\t\tvar enumerator = array.EnumerateArray();\n\n\t\treturn ValueReader.ReadValues5(enumerator, options);\n\t}\n\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override void Write(Utf8JsonWriter writer, (T1, T2, T3, T4, T5) value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartArray();\n\t\tJsonSerializer.Serialize(writer, value.Item1, options);\n\t\tJsonSerializer.Serialize(writer, value.Item2, options);\n\t\tJsonSerializer.Serialize(writer, value.Item3, options);\n\t\tJsonSerializer.Serialize(writer, value.Item4, options);\n\t\tJsonSerializer.Serialize(writer, value.Item5, options);\n\t\twriter.WriteEndArray();\n\t}\n}\n\ninternal class JsonArrayTupleConverter : JsonConverter<(T1, T2, T3, T4, T5, T6)>\n{\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override (T1, T2, T3, T4, T5, T6) Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tif (reader.TokenType != JsonTokenType.StartArray)\n\t\t\tthrow new JsonException(\"Expected tuple to be encoded as an array.\");\n\n\t\tvar array = JsonElement.ParseValue(ref reader);\n\t\tvar enumerator = array.EnumerateArray();\n\n\t\treturn ValueReader.ReadValues6(enumerator, options);\n\t}\n\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override void Write(Utf8JsonWriter writer, (T1, T2, T3, T4, T5, T6) value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartArray();\n\t\tJsonSerializer.Serialize(writer, value.Item1, options);\n\t\tJsonSerializer.Serialize(writer, value.Item2, options);\n\t\tJsonSerializer.Serialize(writer, value.Item3, options);\n\t\tJsonSerializer.Serialize(writer, value.Item4, options);\n\t\tJsonSerializer.Serialize(writer, value.Item5, options);\n\t\tJsonSerializer.Serialize(writer, value.Item6, options);\n\t\twriter.WriteEndArray();\n\t}\n}\n\ninternal class JsonArrayTupleConverter : JsonConverter<(T1, T2, T3, T4, T5, T6, T7)>\n{\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override (T1, T2, T3, T4, T5, T6, T7) Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tif (reader.TokenType != JsonTokenType.StartArray)\n\t\t\tthrow new JsonException(\"Expected tuple to be encoded as an array.\");\n\n\t\tvar array = JsonElement.ParseValue(ref reader);\n\t\tvar enumerator = array.EnumerateArray();\n\n\t\treturn ValueReader.ReadValues7(enumerator, options);\n\t}\n\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override void Write(Utf8JsonWriter writer, (T1, T2, T3, T4, T5, T6, T7) value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartArray();\n\t\tJsonSerializer.Serialize(writer, value.Item1, options);", + "snippet": "[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \" : JsonConverter>\n\twhere TRest : struct\n{\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override ValueTuple Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tif (reader.TokenType != JsonTokenType.StartArray)\n\t\t\tthrow new JsonException(\"Expected tuple to be encoded as an array.\");\n\n\t\tvar array = JsonElement.ParseValue(ref reader);\n\t\tvar enumerator = array.EnumerateArray();\n\n\t\treturn ValueReader.ReadValues8(enumerator, options);\n\t}\n\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic override void Write(Utf8JsonWriter writer, ValueTuple value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartArray();\n\t\tValueWriter.WriteValues(writer, ValueWriter.Unwrap8(value), options);\n\t\twriter.WriteEndArray();\n\t}\n}", + "snippet": "JsonSerializer.Serialize(writer, value.Item2, options);\n\t\tJsonSerializer.Serialize(writer, value.Item3, options);\n\t\tJsonSerializer.Serialize(writer, value.Item4, options);\n\t\tJsonSerializer.Serialize(writer, value.Item5, " + }, + { + "title": "src/Json.More/JsonDocumentEqualityComparer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonDocumentEqualityComparer.cs#L1-L42", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonDocumentEqualityComparer.cs", + "startLine": 1, + "endLine": 42, + "content": "using System.Collections.Generic;\nusing System.Text.Json;\n\nnamespace Json.More;\n\n/// \n/// Calculates equality between two s.\n/// \n/// \n/// This comparison is compliant with the ideals expressed by JSON:\n///\n/// - Objects are unordered.\n/// - Arrays are ordered.\n/// \npublic class JsonDocumentEqualityComparer : IEqualityComparer\n{\n\t/// \n\t/// A singleton instance for convenience.\n\t/// \n\tpublic static JsonDocumentEqualityComparer Instance { get; } = new();\n\n\t/// Determines whether the specified objects are equal.\n\t/// The first object of type T to compare.\n\t/// The second object of type T to compare.\n\t/// true if the specified objects are equal; otherwise, false.\n\tpublic bool Equals(JsonDocument? x, JsonDocument? y)\n\t{\n\t\tif (x is null) return y is null;\n\t\tif (y is null) return false;\n\n\t\treturn x.IsEquivalentTo(y);\n\t}\n\n\t/// Returns a hash code for the specified object.\n\t/// The for which a hash code is to be returned.\n\t/// A hash code for the specified object.\n\t/// The type of obj is a reference type and obj is null.\n\tpublic int GetHashCode(JsonDocument obj)\n\t{\n\t\treturn obj.GetHashCode();\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\n\nnamespace Json.More;\n\n/// \n/// Calculates equality between two s.\n/// \n/// \n/// This comparison is complian" + }, + { + "title": "src/Json.More/JsonDocumentExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonDocumentExtensions.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonDocumentExtensions.cs", + "startLine": 1, + "endLine": 37, + "content": "using System.Diagnostics.CodeAnalysis;\nusing System.Text.Json;\n\nnamespace Json.More;\n\n/// \n/// Provides extension functionality for .\n/// \npublic static class JsonDocumentExtensions\n{\n\t/// \n\t/// Determines JSON-compatible equivalence.\n\t/// \n\t/// The first document.\n\t/// The second document.\n\t/// `true` if the documents are equivalent; `false` otherwise.\n\tpublic static bool IsEquivalentTo(this JsonDocument a, JsonDocument b)\n\t{\n\t\treturn a.RootElement.IsEquivalentTo(b.RootElement);\n\t}\n\n\t/// \n\t/// Converts an object to a .\n\t/// \n\t/// The type of the object.\n\t/// The value to convert.\n\t/// (optional) JSON serialization options.\n\t/// A representing the vale.\n\t[RequiresUnreferencedCode(\"Calls System.Text.Json.JsonSerializer.Serialize(T, JsonSerializerOptions)\")]\n\t[RequiresDynamicCode(\"Calls System.Text.Json.JsonSerializer.Serialize(T, JsonSerializerOptions)\")]\n\tpublic static JsonDocument ToJsonDocument(this T value, JsonSerializerOptions? options = null)\n\t{\n\t\tif (value is JsonDocument doc) return doc;\n\n\t\treturn JsonDocument.Parse(JsonSerializer.Serialize(value, options));\n\t}\n}", + "snippet": "using System.Diagnostics.CodeAnalysis;\nusing System.Text.Json;\n\nnamespace Json.More;\n\n/// \n/// Provides extension functionality for .\n/// \npublic static class JsonDocumentExte" + }, + { + "title": "src/Json.More/JsonElementEqualityComparer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonElementEqualityComparer.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonElementEqualityComparer.cs", + "startLine": 1, + "endLine": 39, + "content": "using System.Collections.Generic;\nusing System.Text.Json;\n\nnamespace Json.More;\n\n/// \n/// Calculates equality between two s.\n/// \n/// \n/// This comparison is compliant with the ideals expressed by JSON:\n///\n/// - Objects are unordered.\n/// - Arrays are ordered.\n/// \npublic class JsonElementEqualityComparer : IEqualityComparer\n{\n\t/// \n\t/// A singleton instance for convenience.\n\t/// \n\tpublic static JsonElementEqualityComparer Instance { get; } = new();\n\n\t/// Determines whether the specified objects are equal.\n\t/// The first object of type T to compare.\n\t/// The second object of type T to compare.\n\t/// true if the specified objects are equal; otherwise, false.\n\tpublic bool Equals(JsonElement x, JsonElement y)\n\t{\n\t\treturn x.IsEquivalentTo(y);\n\t}\n\n\t/// Returns a hash code for the specified object.\n\t/// The for which a hash code is to be returned.\n\t/// A hash code for the specified object.\n\t/// The type of obj is a reference type and obj is null.\n\tpublic int GetHashCode(JsonElement obj)\n\t{\n\t\treturn obj.GetEquivalenceHashCode();\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\n\nnamespace Json.More;\n\n/// \n/// Calculates equality between two s.\n/// \n/// \n/// This comparison is compliant" + }, + { + "title": "src/Json.More/JsonElementExtensions.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonElementExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonElementExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\n\nnamespace Json.More;\n\n/// \n/// Provides extension functionality for .\n/// \npublic static class JsonElementExtensions\n{\n\t/// \n\t/// Determines JSON-compatible equivalence.\n\t/// \n\t/// The first element.\n\t/// The second element.\n\t/// `true` if the element are equivalent; `false` otherwise.\n\t/// The is not valid.\n\tpublic static bool IsEquivalentTo(this JsonElement a, JsonElement b)\n\t{\n\t\tif (a.ValueKind != b.ValueKind) return false;\n\t\tswitch (a.ValueKind)\n\t\t{\n\t\t\tcase JsonValueKind.Object:\n\t\t\t\tvar aProperties = a.EnumerateObject().ToList();\n\t\t\t\tvar bProperties = b.EnumerateObject().ToList();\n\t\t\t\tif (aProperties.Count != bProperties.Count) return false;\n\t\t\t\tvar grouped = aProperties.Concat(bProperties)\n\t\t\t\t\t.GroupBy(p => p.Name)\n\t\t\t\t\t.Select(g => g.ToList())\n\t\t\t\t\t.ToList();\n\t\t\t\treturn grouped.All(g => g.Count == 2 && g[0].Value.IsEquivalentTo(g[1].Value));\n\t\t\tcase JsonValueKind.Array:\n\t\t\t\tvar aElements = a.EnumerateArray().ToList();\n\t\t\t\tvar bElements = b.EnumerateArray().ToList();\n\t\t\t\tif (aElements.Count != bElements.Count) return false;\n\t\t\t\tvar zipped = aElements.Zip(bElements, (ae, be) => (ae, be));\n\t\t\t\treturn zipped.All(p => p.ae.IsEquivalentTo(p.be));\n\t\t\tcase JsonValueKind.String:\n\t\t\t\treturn a.GetString() == b.GetString();\n\t\t\tcase JsonValueKind.Number:\n\t\t\t\treturn a.GetDecimal() == b.GetDecimal();\n\t\t\tcase JsonValueKind.Undefined:\n\t\t\t\treturn false;\n\t\t\tcase JsonValueKind.True:\n\t\t\tcase JsonValueKind.False:\n\t\t\tcase JsonValueKind.Null:\n\t\t\t\treturn true;\n\t\t\tdefault:\n\t\t\t\tthrow new ArgumentOutOfRangeException();\n\t\t}\n\t}\n\n\t// source: https://stackoverflow.com/a/60592310/878701, modified for netstandard2.0\n\t// license: https://creativecommons.org/licenses/by-sa/4.0/\n\t/// \n\t/// Generate a consistent JSON-value-based hash code for the element.\n\t/// \n\t/// The element.\n\t/// Maximum depth to calculate. Default is -1 which utilizes the entire structure without limitation.\n\t/// The hash code.\n\t/// \n\t/// See the following for discussion on why the default implementation is insufficient:\n\t///\n\t/// - https://github.com/json-everything/json-everything/issues/76\n\t/// - https://github.com/dotnet/runtime/issues/33388\n\t/// \n\tpublic static int GetEquivalenceHashCode(this JsonElement element, int maxHashDepth = -1)\n\t{\n\t\tstatic void Add(ref int current, object? newValue)\n\t\t{\n\t\t\tunchecked\n\t\t\t{\n\t\t\t\tcurrent = current * 397 ^ (newValue?.GetHashCode() ?? 0);\n\t\t\t}\n\t\t}\n\n\t\tvoid ComputeHashCode(JsonElement obj, ref int current, int depth)\n\t\t{\n\t\t\tAdd(ref current, obj.ValueKind);\n\n\t\t\tswitch (obj.ValueKind)\n\t\t\t{\n\t\t\t\tcase JsonValueKind.Null:\n\t\t\t\tcase JsonValueKind.True:\n\t\t\t\tcase JsonValueKind.False:\n\t\t\t\tcase JsonValueKind.Undefined:\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase JsonValueKind.Number:\n\t\t\t\t\tAdd(ref current, obj.GetRawText());\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase JsonValueKind.String:\n\t\t\t\t\tAdd(ref current, obj.GetString());\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase JsonValueKind.Array:\n\t\t\t\t\tif (depth != maxHashDepth)\n\t\t\t\t\t\tforeach (var item in obj.EnumerateArray())\n\t\t\t\t\t\t\tComputeHashCode(item, ref current, depth + 1);\n\t\t\t\t\telse\n\t\t\t\t\t\tAdd(ref current, obj.GetArrayLength());\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase JsonValueKind.Object:\n\t\t\t\t\tforeach (var property in obj.EnumerateObject().OrderBy(p => p.Name, StringComparer.Ordinal))\n\t\t\t\t\t{\n\t\t\t\t\t\tAdd(ref current, property.Name);\n\t\t\t\t\t\tif (depth != maxHashDepth)\n\t\t\t\t\t\t\tComputeHashCode(property.Value, ref current, depth + 1);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serializa" + }, + { + "title": "src/Json.More/JsonElementExtensions.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonElementExtensions.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonElementExtensions.cs", + "startLine": 121, + "endLine": 240, + "content": "throw new JsonException($\"Unknown JsonValueKind {obj.ValueKind}\");\n\t\t\t}\n\t\t}\n\n\t\tvar hash = 0;\n\t\tComputeHashCode(element, ref hash, 0);\n\t\treturn hash;\n\n\t}\n\n\t/// \n\t/// Just a shortcut for calling `JsonSerializer.Serialize()` because `.ToString()` doesn't do what you might expect.\n\t/// \n\t/// The value to convert.\n\t/// A JSON string.\n\t/// \n\t/// See https://github.com/dotnet/runtime/issues/42502\n\t/// \n\tpublic static string ToJsonString(this JsonElement element)\n\t{\n\t\treturn JsonSerializer.Serialize(element, MoreSerializerContext.Default.JsonElement);\n\t}\n\n\t/// \n\t/// Converts a to a .\n\t/// \n\t/// The value to convert.\n\t/// A representing the value.\n\t/// This is a workaround for lack of native support in the System.Text.Json namespace.\n\tpublic static JsonElement AsJsonElement(this long value)\n\t{\n\t\tusing var doc = JsonDocument.Parse(value.ToString(CultureInfo.InvariantCulture));\n\t\treturn doc.RootElement.Clone();\n\t}\n\n\t/// \n\t/// Converts a to a .\n\t/// \n\t/// The value to convert.\n\t/// A representing the value.\n\t/// This is a workaround for lack of native support in the System.Text.Json namespace.\n\tpublic static JsonElement AsJsonElement(this int value)\n\t{\n\t\tusing var doc = JsonDocument.Parse(value.ToString(CultureInfo.InvariantCulture));\n\t\treturn doc.RootElement.Clone();\n\t}\n\n\t/// \n\t/// Converts a to a .\n\t/// \n\t/// The value to convert.\n\t/// A representing the value.\n\t/// This is a workaround for lack of native support in the System.Text.Json namespace.\n\tpublic static JsonElement AsJsonElement(this short value)\n\t{\n\t\tusing var doc = JsonDocument.Parse(value.ToString(CultureInfo.InvariantCulture));\n\t\treturn doc.RootElement.Clone();\n\t}\n\n\t/// \n\t/// Converts a to a .\n\t/// \n\t/// The value to convert.\n\t/// A representing the value.\n\t/// This is a workaround for lack of native support in the System.Text.Json namespace.\n\tpublic static JsonElement AsJsonElement(this bool value)\n\t{\n\t\tusing var doc = JsonDocument.Parse(value ? \"true\" : \"false\");\n\t\treturn doc.RootElement.Clone();\n\t}\n\n\t/// \n\t/// Converts a to a .\n\t/// \n\t/// The value to convert.\n\t/// A representing the value.\n\t/// This is a workaround for lack of native support in the System.Text.Json namespace.\n\tpublic static JsonElement AsJsonElement(this decimal value)\n\t{\n\t\tusing var doc = JsonDocument.Parse(value.ToString(CultureInfo.InvariantCulture));\n\t\treturn doc.RootElement.Clone();\n\t}\n\n\t/// \n\t/// Converts a to a .\n\t/// \n\t/// The value to convert.\n\t/// A representing the value.\n\t/// This is a workaround for lack of native support in the System.Text.Json namespace.\n\tpublic static JsonElement AsJsonElement(this double value)\n\t{\n\t\tusing var doc = JsonDocument.Parse(value.ToString(CultureInfo.InvariantCulture));\n\t\treturn doc.RootElement.Clone();\n\t}\n\n\t/// \n\t/// Converts a to a .\n\t/// \n\t/// The value to convert.\n\t/// A representing the value.\n\t/// This is a workaround for lack of native support in the System.Text.Json namespace.\n\tpublic static JsonElement AsJsonElement(this float value)\n\t{\n\t\tusing var doc = JsonDocument.Parse(value.ToString(CultureInfo.InvariantCulture));\n\t\treturn doc.RootElement.Clone();\n\t}\n\n\t/// \n\t/// Converts a to a . Can also be used to get a `null` element.\n\t/// \n\t/// The value to convert.\n\t/// A representing the value.\n\t/// This is a workaround for lack of native support in the System.Text.Json namespace.\n\tpublic static JsonElement AsJsonElement(this string? value)\n\t{\n\t\tusing var doc = JsonDocument.Parse(JsonSerializer.Serialize(value, MoreSerializerContext.Default.String!));\n\t\treturn doc.RootElement.Clone();\n\t}\n\n\t/// ", + "snippet": "throw new JsonException($\"Unknown JsonValueKind {obj.ValueKind}\");\n\t\t\t}\n\t\t}\n\n\t\tvar hash = 0;\n\t\tComputeHashCode(element, ref hash, 0);\n\t\treturn hash;\n\n\t}\n\n\t/// \n\t/// Just a shortcut for calling `JsonSerializer.Se" + }, + { + "title": "src/Json.More/JsonElementExtensions.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonElementExtensions.cs#L241-L291", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonElementExtensions.cs", + "startLine": 241, + "endLine": 291, + "content": "/// Converts a to a .\n\t/// \n\t/// The array of values to convert.\n\t/// A representing the value.\n\t/// This is a workaround for lack of native support in the System.Text.Json namespace.\n\tpublic static JsonElement AsJsonElement(this IEnumerable values)\n\t{\n\t\tusing var doc = JsonDocument.Parse($\"[{string.Join(\",\", values.Select(v => v.ToJsonString()))}]\");\n\t\treturn doc.RootElement.Clone();\n\t}\n\n\t/// \n\t/// Converts a to a .\n\t/// \n\t/// The value to convert.\n\t/// A representing the value.\n\t/// This is a workaround for lack of native support in the System.Text.Json namespace.\n\tpublic static JsonElement AsJsonElement(this IDictionary values)\n\t{\n\t\tusing var doc = JsonDocument.Parse($\"{{{string.Join(\",\", values.Select(v => $\"{JsonSerializer.Serialize(v.Key, MoreSerializerContext.Default.String)}:{v.Value.ToJsonString()}\"))}}}\");\n\t\treturn doc.RootElement.Clone();\n\t}\n\n\t/// \n\t/// Converts a to a .\n\t/// \n\t/// The element.\n\t/// An equivalent node.\n\t/// \n\t/// This provides a single point of conversion as one is not provided by .Net.\n\t/// See https://github.com/dotnet/runtime/issues/70427 for more information.\n\t/// \n\tpublic static JsonNode? AsNode(this JsonElement element) => element.ValueKind switch\n\t{\n\t\tJsonValueKind.Array => JsonArray.Create(element),\n\t\tJsonValueKind.Object => JsonObject.Create(element),\n\t\t_ => JsonValue.Create(element)\n\t};\n\n\t[RequiresDynamicCode(\"Calls System.Text.Json.JsonSerializer.Deserialize(JsonSerializerOptions)\")]\n\t[RequiresUnreferencedCode(\"Calls System.Text.Json.JsonSerializer.Deserialize(JsonSerializerOptions)\")]\n\tinternal static T? ReadValue(ref JsonElement.ArrayEnumerator enumerator, JsonSerializerOptions options)\n\t{\n\t\tenumerator.MoveNext();\n\t\treturn enumerator.Current.Deserialize(options);\n\t}\n}\n\n[JsonSerializable(typeof(JsonElement))]\n[JsonSerializable(typeof(string))]\ninternal partial class MoreSerializerContext : JsonSerializerContext;", + "snippet": "/// Converts a to a .\n\t/// \n\t/// The array of values to convert.\n\t/// A representing the value.\n/// Acts as an intermediary that allows an \"implicit casting\"-like behavior between\n/// native JSON types and .\n/// \npublic readonly struct JsonElementProxy\n{\n\tprivate readonly JsonElement _value;\n\n\tprivate JsonElementProxy(JsonElement value)\n\t{\n\t\t_value = value;\n\t}\n\n\t/// \n\t/// Converts an `int` to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator JsonElementProxy(int value) => new(value.AsJsonElement());\n\t/// \n\t/// Converts an `long` to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator JsonElementProxy(long value) => new(value.AsJsonElement());\n\t/// \n\t/// Converts an `short` to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator JsonElementProxy(short value) => new(value.AsJsonElement());\n\t/// \n\t/// Converts an `float` to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator JsonElementProxy(float value) => new(value.AsJsonElement());\n\t/// \n\t/// Converts an `double` to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator JsonElementProxy(double value) => new(value.AsJsonElement());\n\t/// \n\t/// Converts an `decimal` to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator JsonElementProxy(decimal value) => new(value.AsJsonElement());\n\t/// \n\t/// Converts an `string` to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator JsonElementProxy(string value) => new(value.AsJsonElement());\n\t/// \n\t/// Converts an `bool` to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator JsonElementProxy(bool value) => new(value.AsJsonElement());\n\n\t/// \n\t/// Converts a to a .\n\t/// \n\t/// The proxy.\n\tpublic static implicit operator JsonElement(JsonElementProxy proxy) => proxy._value;\n}", + "snippet": "using System.Diagnostics.CodeAnalysis;\nusing System.Text.Json;\n\nnamespace Json.More;\n\n/// \n/// Acts as an intermediary that allows an \"implicit casting\"-like behavior between\n/// native JSON types and \n/// Calculates equality between two s.\n/// \n/// \n/// This comparison is compliant with the ideals expressed by JSON:\n///\n/// - Objects are unordered.\n/// - Arrays are ordered.\n/// \npublic class JsonNodeEqualityComparer : IEqualityComparer\n{\n\t/// \n\t/// A singleton instance for convenience.\n\t/// \n\tpublic static JsonNodeEqualityComparer Instance { get; } = new();\n\n\t/// Determines whether the specified objects are equal.\n\t/// The first object of type T to compare.\n\t/// The second object of type T to compare.\n\t/// true if the specified objects are equal; otherwise, false.\n\tpublic bool Equals(JsonNode? x, JsonNode? y)\n\t{\n\t\treturn x.IsEquivalentTo(y);\n\t}\n\n\t/// Returns a hash code for the specified object.\n\t/// The for which a hash code is to be returned.\n\t/// A hash code for the specified object.\n\t/// The type of obj is a reference type and obj is null.\n\tpublic int GetHashCode(JsonNode? obj)\n\t{\n\t\treturn obj?.GetEquivalenceHashCode() ?? 0;\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\n\nnamespace Json.More;\n\n/// \n/// Calculates equality between two s.\n/// \n/// \n//" + }, + { + "title": "src/Json.More/JsonNodeExtensions.cs (1/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonNodeExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonNodeExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\n\nnamespace Json.More;\n\n/// \n/// Provides extension functionality for .\n/// \npublic static class JsonNodeExtensions\n{\n\tprivate static readonly JsonSerializerOptions _unfriendlyCharSerialization = new()\n\t{\n\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t};\n\n\t/// \n\t/// Determines JSON-compatible equivalence.\n\t/// \n\t/// The first element.\n\t/// The second element.\n\t/// `true` if the element are equivalent; `false` otherwise.\n\t/// \n\t/// has trouble testing numeric\n\t/// equality when `decimal` is involved. As such, it is still advised to use this\n\t/// method instead. See https://github.com/dotnet/runtime/issues/97490.\n\t/// \n\tpublic static bool IsEquivalentTo(this JsonNode? a, JsonNode? b)\n\t{\n\t\tswitch (a, b)\n\t\t{\n\t\t\tcase (null, null):\n\t\t\t\treturn true;\n\t\t\tcase (JsonObject objA, JsonObject objB):\n\t\t\t\tif (objA.Count != objB.Count) return false;\n\t\t\t\tvar grouped = objA.Concat(objB)\n\t\t\t\t\t.GroupBy(p => p.Key)\n\t\t\t\t\t.Select(g => g.ToList())\n\t\t\t\t\t.ToList();\n\t\t\t\treturn grouped.All(g => g.Count == 2 && g[0].Value.IsEquivalentTo(g[1].Value));\n\t\t\tcase (JsonArray arrayA, JsonArray arrayB):\n\t\t\t\tif (arrayA.Count != arrayB.Count) return false;\n\t\t\t\tvar zipped = arrayA.Zip(arrayB, (ae, be) => (ae, be));\n\t\t\t\treturn zipped.All(p => p.ae.IsEquivalentTo(p.be));\n\t\t\tcase (JsonValue aValue, JsonValue bValue):\n\t\t\t\tvar aNumber = aValue.GetNumber();\n\t\t\t\tvar bNumber = bValue.GetNumber();\n\t\t\t\tif (aNumber != null) return aNumber == bNumber;\n\n\t\t\t\tvar aString = aValue.GetString();\n\t\t\t\tvar bString = bValue.GetString();\n\t\t\t\tif (aString != null) return aString == bString;\n\n\t\t\t\tvar aBool = aValue.GetBool();\n\t\t\t\tvar bBool = bValue.GetBool();\n\t\t\t\tif (aBool.HasValue) return aBool == bBool;\n\n\t\t\t\tvar aObj = aValue.GetValue();\n\t\t\t\tvar bObj = bValue.GetValue();\n\t\t\t\tif (aObj is JsonElement aElement && bObj is JsonElement bElement)\n\t\t\t\t\treturn aElement.IsEquivalentTo(bElement);\n\n\t\t\t\treturn aObj.Equals(bObj);\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t}\n\n\t// source: https://stackoverflow.com/a/60592310/878701, modified for netstandard2.0\n\t// license: https://creativecommons.org/licenses/by-sa/4.0/\n\t/// \n\t/// Generate a consistent JSON-value-based hash code for the element.\n\t/// \n\t/// The element.\n\t/// Maximum depth to calculate. Default is -1 which utilizes the entire structure without limitation.\n\t/// The hash code.\n\t/// \n\t/// See the following for discussion on why the default implementation is insufficient:\n\t///\n\t/// - https://github.com/json-everything/json-everything/issues/76\n\t/// - https://github.com/dotnet/runtime/issues/33388\n\t/// \n\tpublic static int GetEquivalenceHashCode(this JsonNode node, int maxHashDepth = -1)\n\t{\n\t\tstatic void Add(ref int current, object? newValue)\n\t\t{\n\t\t\tunchecked\n\t\t\t{\n\t\t\t\tcurrent = current * 397 ^ (newValue?.GetHashCode() ?? 0);\n\t\t\t}\n\t\t}\n\n\t\tvoid ComputeHashCode(JsonNode? target, ref int current, int depth)\n\t\t{\n\t\t\tif (target == null) return;\n\n\t\t\tAdd(ref current, target.GetType());\n\n\t\t\tswitch (target)\n\t\t\t{\n\t\t\t\tcase JsonArray array:\n\t\t\t\t\tif (depth != maxHashDepth)\n\t\t\t\t\t\tforeach (var item in array)\n\t\t\t\t\t\t\tComputeHashCode(item, ref current, depth + 1);\n\t\t\t\t\telse\n\t\t\t\t\t\tAdd(ref current, array.Count);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase JsonObject obj:\n\t\t\t\t\tforeach (var property in obj.OrderBy(p => p.Key, StringComparer.Ordinal))\n\t\t\t\t\t{\n\t\t\t\t\t\tAdd(ref current, property.Key);\n\t\t\t\t\t\tif (depth != maxHashDepth)\n\t\t\t\t\t\t\tComputeHashCode(property.Value, ref current, depth + 1);\n\t\t\t\t\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\n\nnamespac" + }, + { + "title": "src/Json.More/JsonNodeExtensions.cs (2/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonNodeExtensions.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonNodeExtensions.cs", + "startLine": 121, + "endLine": 240, + "content": "break;\n\t\t\t\tdefault:\n\t\t\t\t\tvar value = target.AsValue();\n\t\t\t\t\tif (value.TryGetValue(out var boolA))\n\t\t\t\t\t\tAdd(ref current, boolA);\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tvar number = value.GetNumber();\n\t\t\t\t\t\tif (number != null)\n\t\t\t\t\t\t\tAdd(ref current, number);\n\t\t\t\t\t\telse if (value.TryGetValue(out var stringA))\n\t\t\t\t\t\t\tAdd(ref current, stringA);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tvar hash = 0;\n\t\tComputeHashCode(node, ref hash, 0);\n\t\treturn hash;\n\t}\n\n\t/// \n\t/// Gets JSON string representation for , including null support.\n\t/// \n\t/// A node.\n\t/// Serializer options\n\t/// JSON string representation.\n\tpublic static string AsJsonString(this JsonNode? node, JsonSerializerOptions? options = null)\n\t{\n\t\treturn node?.ToJsonString(options) ?? \"null\";\n\t}\n\n\t/// \n\t/// Gets a node's underlying numeric value.\n\t/// \n\t/// A JSON value.\n\t/// Gets the underlying numeric value, or null if the node represented a non-numeric value.\n\tpublic static decimal? GetNumber(this JsonValue value)\n\t{\n\t\tif (value.TryGetValue(out JsonElement e))\n\t\t{\n\t\t\tif (e.ValueKind != JsonValueKind.Number) return null;\n\t\t\treturn e.GetDecimal();\n\t\t}\n\n\t\tvar number = GetInteger(value);\n\t\tif (number != null) return number;\n\n\t\tif (value.TryGetValue(out float f)) return (decimal)f;\n\t\tif (value.TryGetValue(out double d)) return (decimal)d;\n\t\tif (value.TryGetValue(out decimal dc)) return dc;\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Gets a node's underlying numeric value if it's an integer.\n\t/// \n\t/// A JSON value.\n\t/// Gets the underlying numeric value if it's an integer, or null if the node represented a non-integer value.\n\tpublic static long? GetInteger(this JsonValue value)\n\t{\n\t\tif (value.TryGetValue(out JsonElement e))\n\t\t{\n\t\t\tif (e.ValueKind != JsonValueKind.Number) return null;\n\t\t\tvar d = e.GetDecimal();\n\t\t\tif (d == Math.Floor(d)) return (long)d;\n\t\t\treturn null;\n\t\t}\n\t\tif (value.TryGetValue(out byte b)) return b;\n\t\tif (value.TryGetValue(out sbyte sb)) return sb;\n\t\tif (value.TryGetValue(out short s)) return s;\n\t\tif (value.TryGetValue(out ushort us)) return us;\n\t\tif (value.TryGetValue(out int i)) return i;\n\t\tif (value.TryGetValue(out uint ui)) return ui;\n\t\tif (value.TryGetValue(out long l)) return l;\n\t\t// this doesn't feel right... throw?\n\t\tif (value.TryGetValue(out _))\n\t\t\tthrow new NotSupportedException(\"Unsigned longs cannot be supported with this method. A separate check will need to be used.\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Gets a node's underlying string value.\n\t/// \n\t/// A JSON value.\n\t/// Gets the underlying string value, or null.\n\t/// \n\t/// JsonNode may use a under the hood which subsequently contains a string.\n\t/// This means that `JsonNode.GetValue<string>()` will not work as expected.\n\t/// \n\tpublic static string? GetString(this JsonValue value)\n\t{\n\t\tif (value.TryGetValue(out JsonElement e))\n\t\t{\n\t\t\tif (e.ValueKind != JsonValueKind.String) return null;\n\t\t\treturn e.GetString();\n\t\t}\n\n\t\tif (value.TryGetValue(out string? s)) return s;\n\t\tif (value.TryGetValue(out char c)) return c.ToString();\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Gets a node's underlying boolean value.\n\t/// \n\t/// A JSON value.\n\t/// Gets the underlying boolean value, or null.\n\t/// \n\t/// JsonNode may use a under the hood which subsequently contains a boolean.\n\t/// This means that `JsonNode.GetValue<bool>()` will not work as expected.\n\t/// \n\tpublic static bool? GetBool(this JsonValue value)\n\t{\n\t\tif (value.TryGetValue(out JsonElement e))", + "snippet": "break;\n\t\t\t\tdefault:\n\t\t\t\t\tvar value = target.AsValue();\n\t\t\t\t\tif (value.TryGetValue(out var boolA))\n\t\t\t\t\t\tAdd(ref current, boolA);\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tvar number = value.GetNumber();\n\t\t\t\t\t\tif (number != null)\n\t\t\t\t" + }, + { + "title": "src/Json.More/JsonNodeExtensions.cs (3/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonNodeExtensions.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonNodeExtensions.cs", + "startLine": 241, + "endLine": 360, + "content": "{\n\t\t\tif (e.ValueKind == JsonValueKind.True) return true;\n\t\t\tif (e.ValueKind == JsonValueKind.False) return false;\n\n\t\t\treturn null;\n\t\t}\n\n\t\tif (value.TryGetValue(out bool b)) return b;\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Convenience method that wraps \n\t/// and catches argument exceptions.\n\t/// \n\t/// The JSON object.\n\t/// The property name\n\t/// The node under the property name if it exists and is singular; null otherwise.\n\t/// An exception if one was thrown during the access attempt.\n\t/// true if the property exists and is singular within the JSON data.\n\t/// \n\t/// throws an\n\t/// if the node was parsed from data that has duplicate\n\t/// keys. Please see https://github.com/dotnet/runtime/issues/70604 for more information.\n\t/// \n\tpublic static bool TryGetValue(this JsonObject obj, string propertyName, out JsonNode? node, out Exception? e)\n\t{\n\t\te = null;\n\t\ttry\n\t\t{\n\t\t\treturn obj.TryGetPropertyValue(propertyName, out node);\n\t\t}\n\t\tcatch (ArgumentException ae)\n\t\t{\n\t\t\te = ae;\n\t\t\tnode = null;\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/// \n\t/// Creates a new by copying from an enumerable of nodes.\n\t/// \n\t/// The nodes.\n\t/// A JSON array.\n\t/// \n\t///\t`JsonNode` may only be part of a single JSON tree, i.e. have a single parent.\n\t/// Copying a node allows its value to be saved to another JSON tree.\n\t/// \n\tpublic static JsonArray ToJsonArray(this IEnumerable nodes)\n\t{\n\t\treturn new JsonArray(nodes.Select(x => x?.DeepClone()).ToArray());\n\t}\n\n\t/// \n\t/// Gets a JSON Path string that indicates the node's location within\n\t/// its JSON structure.\n\t/// \n\t/// The node to find.\n\t/// Determines whether shorthand syntax is used when possible, e.g. `$.foo`.\n\t/// Null nodes cannot be located as the parent cannot be determined.\n\t/// \n\t/// \tA string containing a JSON Path.\n\t/// \n\tpublic static string GetPathFromRoot(this JsonNode node, bool useShorthand = false)\n\t{\n\t\tvar current = node ?? throw new ArgumentNullException(nameof(node), \"null nodes cannot be located\");\n\n\t\tvar segments = GetSegments(current);\n\n\t\tvar sb = new StringBuilder();\n\t\tsb.Append('$');\n\t\tsegments.Pop(); // first is always null - the root\n\t\twhile (segments.Count != 0)\n\t\t{\n\t\t\tvar segment = segments.Pop();\n\t\t\tvar index = segment?.GetNumber();\n\t\t\tsb.Append(index != null ? $\"[{index}]\" : GetNamedSegmentForPath(segment!, useShorthand));\n\t\t}\n\n\t\treturn sb.ToString();\n\t}\n\n\tprivate static Stack GetSegments(JsonNode? current)\n\t{\n\t\tvar segments = new Stack();\n\t\twhile (current != null)\n\t\t{\n\t\t\tvar segment = current.Parent switch\n\t\t\t{\n\t\t\t\tnull => null,\n\t\t\t\tJsonObject obj => GetKey(obj, current),\n\t\t\t\tJsonArray arr => GetIndex(arr, current),\n#pragma warning disable CA2208\n\t\t\t\t_ => throw new ArgumentOutOfRangeException(\"parent\", \"this shouldn't happen\")\n#pragma warning restore CA2208\n\t\t\t};\n\t\t\tsegments.Push(segment);\n\t\t\tcurrent = current.Parent;\n\t\t}\n\n\t\treturn segments;\n\t}\n\n\tprivate static JsonValue GetKey(JsonObject obj, JsonNode current)\n\t{\n\t\treturn JsonValue.Create(obj.First(x => ReferenceEquals(x.Value, current)).Key)!;\n\t}\n\n\tprivate static JsonValue GetIndex(JsonArray arr, JsonNode current)\n\t{\n\t\treturn JsonValue.Create(arr.IndexOf(current));\n\t}\n\n\tprivate static readonly Regex _pathSegmentTestPattern = new(\"^[a-z][a-z_]*$\", RegexOptions.Compiled | RegexOptions.IgnoreCase);\n\n\tprivate static string GetNamedSegmentForPath(JsonValue segment, bool useShorthand)\n\t{\n\t\tvar value = segment.GetValue();", + "snippet": "{\n\t\t\tif (e.ValueKind == JsonValueKind.True) return true;\n\t\t\tif (e.ValueKind == JsonValueKind.False) return false;\n\n\t\t\treturn null;\n\t\t}\n\n\t\tif (value.TryGetValue(out bool b)) return b;\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/" + }, + { + "title": "src/Json.More/JsonNodeExtensions.cs (4/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonNodeExtensions.cs#L361-L409", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonNodeExtensions.cs", + "startLine": 361, + "endLine": 409, + "content": "if (useShorthand && _pathSegmentTestPattern.IsMatch(value)) return $\".{value}\";\n\n\t\treturn $\"['{PrepForJsonPath(segment.AsJsonString(_unfriendlyCharSerialization))}']\";\n\t}\n\n\t// pass JSON string because it will handle char escaping inside the string.\n\t// just need to replace the quotes.\n\tprivate static string PrepForJsonPath(string jsonString)\n\t{\n\t\tvar content = jsonString[1..^1];\n\t\tvar escaped = content.Replace(\"\\\\\\\"\", \"\\\"\")\n\t\t\t.Replace(\"'\", \"\\\\'\");\n\t\treturn escaped;\n\t}\n\n\t/// \n\t/// Gets a JSON Pointer string that indicates the node's location within\n\t/// its JSON structure.\n\t/// \n\t/// The node to find.\n\t/// Null nodes cannot be located as the parent cannot be determined.\n\t/// \n\t/// \tA string containing a JSON Pointer.\n\t/// \n\tpublic static string GetPointerFromRoot(this JsonNode node)\n\t{\n\t\tvar current = node ?? throw new ArgumentNullException(nameof(node), \"null nodes cannot be located\");\n\n\t\tvar segments = GetSegments(current);\n\n\t\tvar sb = new StringBuilder();\n\t\tsegments.Pop(); // first is always null - the root\n\t\twhile (segments.Count != 0)\n\t\t{\n\t\t\tvar segment = segments.Pop();\n\t\t\tvar index = segment?.GetNumber();\n\t\t\tsb.Append(index != null ? $\"/{index}\" : $\"/{PrepForJsonPointer(segment!.GetValue())}\");\n\t\t}\n\n\t\treturn sb.ToString();\n\t}\n\n\tprivate static string PrepForJsonPointer(string s)\n\t{\n\t\tvar escaped = s.Replace(\"~\", \"~0\")\n\t\t\t.Replace(\"/\", \"~1\");\n\t\treturn escaped;\n\t}\n}", + "snippet": "if (useShorthand && _pathSegmentTestPattern.IsMatch(value)) return $\".{value}\";\n\n\t\treturn $\"['{PrepForJsonPath(segment.AsJsonString(_unfriendlyCharSerialization))}']\";\n\t}\n\n\t// pass JSON string because it will handle cha" + }, + { + "title": "src/Json.More/JsonSerializerOptionsExtensions.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonSerializerOptionsExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonSerializerOptionsExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing System.Text.Json.Serialization.Metadata;\n\nnamespace Json.More;\n\n/// \n/// Provides extension functionality for .\n/// \n/// \n/// Most (if not all) of these extension methods are workarounds for\n/// https://github.com/dotnet/runtime/issues/50205.\n/// \npublic static class JsonSerializerOptionsExtensions\n{\n\t/// \n\t/// Returns the converter for the specified type.\n\t/// \n\t/// The to convert.\n\t/// The being used.\n\t/// An explicit typeInfo to use for looking up the Converter. If not provided, options.GetTypeInfo will be used.\n\t/// An implementation of as determined by the provided options\n\tpublic static JsonConverter GetConverter(this JsonSerializerOptions options, JsonTypeInfo? typeInfo)\n\t{\n\t\tvar optionsConverter = (JsonConverter?)options.Converters.FirstOrDefault(x => x is JsonConverter);\n\n\t\treturn optionsConverter ?? (JsonConverter)(typeInfo ?? options.GetTypeInfo(typeof(T))).Converter;\n\t}\n\n\t/// \n\t/// Read and convert the JSON to T.\n\t/// \n\t/// \n\t/// A converter may throw any Exception, but should throw JsonException when the JSON is invalid.\n\t/// \n\t/// The to convert.\n\t/// The being used.\n\t/// The to read from.\n\t/// An explicit typeInfo to use for looking up the Converter. If not provided, options.GetTypeInfo will be used.\n\t/// The value that was converted.\n\tpublic static T? Read(this JsonSerializerOptions options, ref Utf8JsonReader reader, JsonTypeInfo? typeInfo)\n\t{\n\t\treturn options.GetConverter(typeInfo).Read(ref reader, typeof(T), options);\n\t}\n\n\t/// \n\t/// Write a T to JSON.\n\t/// \n\t/// \n\t/// A converter may throw any Exception, but should throw JsonException when the JSON is invalid.\n\t/// \n\t/// The to convert.\n\t/// The being used.\n\t/// The to read from.\n\t/// The value to serialize.\n\t/// An explicit typeInfo to use for looking up the Converter. If not provided, options.GetTypeInfo will be used.\n\t/// The value that was converted.\n\tpublic static void Write(this JsonSerializerOptions options, Utf8JsonWriter writer, T value, JsonTypeInfo typeInfo)\n\t{\n\t\toptions.GetConverter(typeInfo).Write(writer, value, options);\n\t\t//((JsonConverter)typeInfo.Converter).Write(writer, value, options);\n\t}\n\n\t/// \n\t/// Read and convert the JSON to multiple T.\n\t/// \n\t/// \n\t/// A converter may throw any Exception, but should throw JsonException when the JSON is invalid.\n\t/// \n\t/// The to convert.\n\t/// The being used.\n\t/// The to read from.\n\t/// An explicit typeInfo to use for looking up the Converter. If not provided, options.GetTypeInfo will be used.\n\t/// The value that was converted.\n\tpublic static List? ReadList(this JsonSerializerOptions options, ref Utf8JsonReader reader, JsonTypeInfo typeInfo)\n\t{\n\t\tif (reader.TokenType == JsonTokenType.Null) return default;\n\n\t\tif (reader.TokenType == JsonTokenType.StartArray)\n\t\t{\n\t\t\tvar valueConverter = (JsonConverter)typeInfo.Converter;\n\t\t\tvar values = new List();\n\t\t\treader.Read();\n\t\t\twhile (reader.TokenType != JsonTokenType.EndArray)\n\t\t\t{\n\t\t\t\tvalues.Add(valueConverter.Read(ref reader, typeof(T), options)!);\n\t\t\t\treader.Read();\n\t\t\t}\n\n\t\t\treturn values;\n\t\t}\n\n\t\tif (reader.TokenType == JsonTokenType.Null) return default;\n\n\t\tthrow new JsonException(\"Expected StartArray or Null\");\n\t}\n\n\t/// \n\t/// Read and convert the JSON to multiple T.\n\t/// \n\t/// \n\t/// A converter may throw any Exception, but should throw JsonException when the JSON is invalid.\n\t/// \n\t/// The to convert.\n\t/// The being used.\n\t/// The to read from.\n\t/// An explicit typeInfo to use for looking up the Converter. If not provided, options.GetTypeInfo will be used.\n\t/// The value that was converted.\n\tpublic static T[]? ReadArray(this JsonSerializerOptions options, ref Utf8JsonReader reader, JsonTypeInfo typeInfo)\n\t{\n\t\treturn ReadList(options, ref reader, typeInfo)?.ToArray();\n\t}\n\n\t/// \n\t/// Convert and write multiple T to JSON\n\t/// ", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing System.Text.Json.Serialization.Metadata;\n\nname" + }, + { + "title": "src/Json.More/JsonSerializerOptionsExtensions.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonSerializerOptionsExtensions.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonSerializerOptionsExtensions.cs", + "startLine": 121, + "endLine": 240, + "content": "/// The to convert.\n\t/// The being used.\n\t/// The to write to.\n\t/// The collection of values to convert.\n\t/// An explicit typeInfo to use for looking up the Converter. If not provided, options.GetTypeInfo will be used.\n\tpublic static void WriteList(this JsonSerializerOptions options, Utf8JsonWriter writer, IEnumerable? values, JsonTypeInfo typeInfo)\n\t{\n\t\tif (values == null)\n\t\t{\n\t\t\twriter.WriteNullValue();\n\t\t\treturn;\n\t\t}\n\n\t\tvar valueConverter = (JsonConverter)typeInfo.Converter;\n\t\twriter.WriteStartArray();\n\t\tforeach (var val in values)\n\t\t{\n\t\t\tvalueConverter.Write(writer, val, options);\n\t\t}\n\t\twriter.WriteEndArray();\n\t}\n\n\t/// \n\t/// Read and convert string/T dictionary to JSON\n\t/// \n\t/// The to convert.\n\t/// The being used.\n\t/// The to read from.\n\t/// An explicit typeInfo to use for looking up the Converter. If not provided, options.GetTypeInfo will be used.\n\t/// The value that was converted.\n\t/// The JSON is not valid for this type.\n\tpublic static Dictionary? ReadDictionary(this JsonSerializerOptions options, ref Utf8JsonReader reader, JsonTypeInfo valueTypeInfo)\n\t{\n\t\tif (reader.TokenType == JsonTokenType.Null) return default;\n\t\tif (reader.TokenType != JsonTokenType.StartObject)\n\t\t\tthrow new JsonException(\"Expected StartObject or Null\");\n\n\t\tvar valueConverter = (JsonConverter)valueTypeInfo.Converter;\n\t\tvar values = new Dictionary();\n\t\treader.Read();\n\t\twhile (reader.TokenType != JsonTokenType.EndObject)\n\t\t{\n\t\t\tif (reader.TokenType != JsonTokenType.PropertyName)\n\t\t\t\tthrow new JsonException(\"Expected PropertyName\");\n\n\t\t\tvar key = reader.GetString()!;\n\t\t\treader.Read();\n\t\t\tvalues[key] = valueConverter.Read(ref reader, typeof(T), options)!;\n\t\t\treader.Read();\n\t\t}\n\n\t\treturn values;\n\t}\n\n\t/// \n\t/// Read and convert string/list-T dictionary to JSON\n\t/// \n\t/// The to convert.\n\t/// The being used.\n\t/// The to read from.\n\t/// An explicit typeInfo to use for looking up the Converter. If not provided, options.GetTypeInfo will be used.\n\t/// The value that was converted.\n\t/// \n\tpublic static Dictionary>? ReadDictionaryList(this JsonSerializerOptions options, ref Utf8JsonReader reader, JsonTypeInfo valueTypeInfo)\n\t{\n\t\tif (reader.TokenType == JsonTokenType.Null) return default;\n\t\tif (reader.TokenType != JsonTokenType.StartObject)\n\t\t\tthrow new JsonException(\"Expected StartObject or Null\");\n\n\t\tvar values = new Dictionary>();\n\t\treader.Read();\n\t\twhile (reader.TokenType != JsonTokenType.EndObject)\n\t\t{\n\t\t\tif (reader.TokenType != JsonTokenType.PropertyName)\n\t\t\t\tthrow new JsonException(\"Expected PropertyName\");\n\n\t\t\tvar key = reader.GetString()!;\n\t\t\treader.Read();\n\t\t\tvalues[key] = options.ReadList(ref reader, valueTypeInfo)!;\n\t\t\treader.Read();\n\t\t}\n\t\n\t\treturn values;\n\t}\n\n\t/// \n\t/// Convert and write string/T dictionary to JSON\n\t/// \n\t/// The to convert.\n\t/// The being used.\n\t/// The to write to.\n\t/// The collection of values to convert.\n\t/// An explicit typeInfo to use for looking up the Converter. If not provided, options.GetTypeInfo will be used.\n\tpublic static void WriteDictionary(this JsonSerializerOptions options, Utf8JsonWriter writer,\n\t\tIEnumerable>? values, JsonTypeInfo valueTypeInfo)\n\t{\n\t\tif (values == null)\n\t\t{\n\t\t\twriter.WriteNullValue();\n\t\t\treturn;\n\t\t}\n\n\t\twriter.WriteStartObject();\n\n\t\tvar valueConverter = ((JsonConverter)valueTypeInfo.Converter);\n\t\tforeach (var entry in values)\n\t\t{\n\t\t\twriter.WritePropertyName(entry.Key!);\n\t\t\tvalueConverter.Write(writer, entry.Value, options);\n\t\t}\n\n\t\twriter.WriteEndObject();\n\t}\n\n\t/// \n\t/// Convert and write string/list-T dictionary to JSON\n\t/// \n\t/// The to convert.\n\t/// The being used.\n\t/// The to write to.", + "snippet": "/// The to convert.\n\t/// The being used.\n\t/// The to " + }, + { + "title": "src/Json.More/JsonSerializerOptionsExtensions.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/JsonSerializerOptionsExtensions.cs#L241-L281", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/JsonSerializerOptionsExtensions.cs", + "startLine": 241, + "endLine": 281, + "content": "/// The collection of values to convert.\n\t/// An explicit typeInfo to use for looking up the Converter. If not provided, options.GetTypeInfo will be used.\n\tpublic static void WriteDictionaryList(this JsonSerializerOptions options, Utf8JsonWriter writer,\n\t\tIEnumerable>>? values, JsonTypeInfo valueTypeInfo)\n\t{\n\t\tif (values == null)\n\t\t{\n\t\t\twriter.WriteNullValue();\n\t\t\treturn;\n\t\t}\n\n\t\twriter.WriteStartObject();\n\n\t\tforeach (var entry in values)\n\t\t{\n\t\t\twriter.WritePropertyName(entry.Key!);\n\t\t\toptions.WriteList(writer, entry.Value, valueTypeInfo);\n\t\t}\n\n\t\twriter.WriteEndObject();\n\t}\n\n\t/// \n\t/// Write an object to JSON. If the type is known, prefer Write]]>\n\t/// \n\t/// \n\t/// A converter may throw any Exception, but should throw JsonException when the JSON is invalid.\n\t/// \n\t/// The being used.\n\t/// The to read from.\n\t/// The value to serialize.\n\t/// The type to serialize.\n\t/// The value that was converted.\n\t[RequiresDynamicCode(\"Calls JsonSerializer.Serialize. Make sure the options object contains all relevant JsonTypeInfos before suppressing this warning.\")]\n\t[RequiresUnreferencedCode(\"Calls JsonSerializer.Serialize. Make sure the options object contains all relevant JsonTypeInfos before suppressing this warning.\")]\n\tpublic static void Write(this JsonSerializerOptions options, Utf8JsonWriter writer, object? value, Type inputType)\n\t{\n\t\tJsonSerializer.Serialize(writer, value, inputType, options);\n\t}\n}", + "snippet": "/// The collection of values to convert.\n\t/// An explicit typeInfo to use for looking up the Converter. If not provided, options.GetTypeInfo will be used.\n" + }, + { + "title": "src/Json.More/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/Json.More/obj/Debug/net10.0/Json.More.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Debug/net10.0/Json.More.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Debug/net10.0/Json.More.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Provides extended functionality for the System.Text.Json namespace.\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/Json.More/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/Json.More/obj/Debug/net8.0/Json.More.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Debug/net8.0/Json.More.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Debug/net8.0/Json.More.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Provides extended functionality for the System.Text.Json namespace.\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/Json.More/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/Json.More/obj/Debug/net9.0/Json.More.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Debug/net9.0/Json.More.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Debug/net9.0/Json.More.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Provides extended functionality for the System.Text.Json namespace.\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/Json.More/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/Json.More/obj/Debug/netstandard2.0/Json.More.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Debug/netstandard2.0/Json.More.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Debug/netstandard2.0/Json.More.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Provides extended functionality for the System.Text.Json namespace.\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/Json.More/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs#L1-L4", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs", + "startLine": 1, + "endLine": 4, + "content": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.IsExternalInit))]", + "snippet": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.IsExternalInit))]" + }, + { + "title": "src/Json.More/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.RequiresLocationAttribute.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.RequiresLocationAttribute.g.cs#L1-L4", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.RequiresLocationAttribute.g.cs", + "startLine": 1, + "endLine": 4, + "content": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.RequiresLocationAttribute))]", + "snippet": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.RequiresLocationAttribute))]" + }, + { + "title": "src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.g.cs#L1-L88", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.g.cs", + "startLine": 1, + "endLine": 88, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.More\n{\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Text.Json.SourceGeneration\", \"9.0.14.11910\")]\n internal partial class MoreSerializerContext\n {\n private readonly static global::System.Text.Json.JsonSerializerOptions s_defaultOptions = new();\n \n private const global::System.Reflection.BindingFlags InstanceMemberBindingFlags =\n global::System.Reflection.BindingFlags.Instance |\n global::System.Reflection.BindingFlags.Public |\n global::System.Reflection.BindingFlags.NonPublic;\n \n /// \n /// The default associated with a default instance.\n /// \n public static global::Json.More.MoreSerializerContext Default { get; } = new global::Json.More.MoreSerializerContext(new global::System.Text.Json.JsonSerializerOptions(s_defaultOptions));\n \n /// \n /// The source-generated options associated with this context.\n /// \n protected override global::System.Text.Json.JsonSerializerOptions? GeneratedSerializerOptions { get; } = s_defaultOptions;\n \n /// \n public MoreSerializerContext() : base(null)\n {\n }\n \n /// \n public MoreSerializerContext(global::System.Text.Json.JsonSerializerOptions options) : base(options)\n {\n }\n\n private static bool TryGetTypeInfoForRuntimeCustomConverter(global::System.Text.Json.JsonSerializerOptions options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo)\n {\n global::System.Text.Json.Serialization.JsonConverter? converter = GetRuntimeConverterForType(typeof(TJsonMetadataType), options);\n if (converter != null)\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, converter);\n return true;\n }\n \n jsonTypeInfo = null;\n return false;\n }\n \n private static global::System.Text.Json.Serialization.JsonConverter? GetRuntimeConverterForType(global::System.Type type, global::System.Text.Json.JsonSerializerOptions options)\n {\n for (int i = 0; i < options.Converters.Count; i++)\n {\n global::System.Text.Json.Serialization.JsonConverter? converter = options.Converters[i];\n if (converter?.CanConvert(type) == true)\n {\n return ExpandConverter(type, converter, options, validateCanConvert: false);\n }\n }\n \n return null;\n }\n \n private static global::System.Text.Json.Serialization.JsonConverter ExpandConverter(global::System.Type type, global::System.Text.Json.Serialization.JsonConverter converter, global::System.Text.Json.JsonSerializerOptions options, bool validateCanConvert = true)\n {\n if (validateCanConvert && !converter.CanConvert(type))\n {\n throw new global::System.InvalidOperationException(string.Format(\"The converter '{0}' is not compatible with the type '{1}'.\", converter.GetType(), type));\n }\n \n if (converter is global::System.Text.Json.Serialization.JsonConverterFactory factory)\n {\n converter = factory.CreateConverter(type, options);\n if (converter is null || converter is global::System.Text.Json.Serialization.JsonConverterFactory)\n {\n throw new global::System.InvalidOperationException(string.Format(\"The converter '{0}' cannot return null or a JsonConverterFactory instance.\", factory.GetType()));\n }\n }\n \n return converter;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.More\n{\n [glob" + }, + { + "title": "src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.GetJsonTypeInfo.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.GetJsonTypeInfo.g.cs#L1-L34", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.GetJsonTypeInfo.g.cs", + "startLine": 1, + "endLine": 34, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.More\n{\n internal partial class MoreSerializerContext : global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver\n {\n /// \n public override global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo(global::System.Type type)\n {\n Options.TryGetTypeInfo(type, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? typeInfo);\n return typeInfo;\n }\n\n global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver.GetTypeInfo(global::System.Type type, global::System.Text.Json.JsonSerializerOptions options)\n {\n if (type == typeof(global::System.Text.Json.JsonElement))\n {\n return Create_JsonElement(options);\n }\n if (type == typeof(string))\n {\n return Create_String(options);\n }\n return null;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.More\n{\n inter" + }, + { + "title": "src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.JsonElement.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.JsonElement.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.JsonElement.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.More\n{\n internal partial class MoreSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _JsonElement;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo JsonElement\n #nullable enable annotations\n {\n get => _JsonElement ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::System.Text.Json.JsonElement));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_JsonElement(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.JsonElementConverter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.More\n{\n inter" + }, + { + "title": "src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.PropertyNames.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.PropertyNames.g.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.PropertyNames.g.cs", + "startLine": 1, + "endLine": 15, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.More\n{\n internal partial class MoreSerializerContext\n {\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.More\n{\n inter" + }, + { + "title": "src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.String.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.String.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/MoreSerializerContext.String.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.More\n{\n internal partial class MoreSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _String;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo String\n #nullable enable annotations\n {\n get => _String ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(string));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_String(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.StringConverter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.More\n{\n inter" + }, + { + "title": "src/Json.More/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/Json.More/obj/Release/net10.0/Json.More.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Release/net10.0/Json.More.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Release/net10.0/Json.More.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Provides extended functionality for the System.Text.Json namespace.\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/Json.More/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/Json.More/obj/Release/net8.0/Json.More.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Release/net8.0/Json.More.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Release/net8.0/Json.More.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Provides extended functionality for the System.Text.Json namespace.\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/Json.More/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/Json.More/obj/Release/net9.0/Json.More.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Release/net9.0/Json.More.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Release/net9.0/Json.More.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Provides extended functionality for the System.Text.Json namespace.\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/Json.More/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/Json.More/obj/Release/netstandard2.0/Json.More.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/obj/Release/netstandard2.0/Json.More.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/obj/Release/netstandard2.0/Json.More.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Provides extended functionality for the System.Text.Json namespace.\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"Json.More\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/Json.More/TypeExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/TypeExtensions.cs#L1-L49", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/TypeExtensions.cs", + "startLine": 1, + "endLine": 49, + "content": "using System;\n\nnamespace Json.More;\n\n/// \n/// Provides informative methods for types.\n/// \npublic static class TypeExtensions\n{\n\t/// \n\t/// Determines whether the type is considered an integer.\n\t/// \n\t/// The type.\n\t/// true if it represents an integer; false otherwise.\n\tpublic static bool IsInteger(this Type type)\n\t{\n\t\treturn type == typeof(byte) ||\n\t\t\t type == typeof(sbyte) ||\n\t\t\t type == typeof(short) ||\n\t\t\t type == typeof(ushort) ||\n\t\t\t type == typeof(int) ||\n\t\t\t type == typeof(uint) ||\n\t\t\t type == typeof(long) ||\n\t\t\t type == typeof(ulong);\n\t}\n\n\t/// \n\t/// Determines whether the type is a non-integer floating point number.\n\t/// \n\t/// The type.\n\t/// true if it represents a floating-point number; false otherwise.\n\tpublic static bool IsFloatingPoint(this Type type)\n\t{\n\t\treturn type == typeof(float) ||\n\t\t\t type == typeof(double) ||\n\t\t\t type == typeof(decimal);\n\t}\n\n\t/// \n\t/// Determines whether the type is a number.\n\t/// \n\t/// The type.\n\t/// true if it represents a number; false otherwise.\n\tpublic static bool IsNumber(this Type type)\n\t{\n\t\treturn type.IsInteger() || type.IsFloatingPoint();\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.More;\n\n/// \n/// Provides informative methods for types.\n/// \npublic static class TypeExtensions\n{\n\t/// \n\t/// Determines whether the type is considered an integer." + }, + { + "title": "src/Json.More/Utf8JsonWriterExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/Utf8JsonWriterExtensions.cs#L1-L67", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/Utf8JsonWriterExtensions.cs", + "startLine": 1, + "endLine": 67, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.More;\n\n/// \n/// Provides extension functionality for .\n/// \npublic static class Utf8JsonWriterExtensions\n{\n\t/// \n\t/// Writes a to the stream.\n\t/// \n\t/// The JSON stream writer.\n\t/// The element to write.\n\t/// The is not valid.\n\tpublic static void WriteValue(this Utf8JsonWriter writer, JsonElement element)\n\t{\n\t\tswitch (element.ValueKind)\n\t\t{\n\t\t\tcase JsonValueKind.Object:\n\t\t\t\tWriteObject(writer, element);\n\t\t\t\tbreak;\n\t\t\tcase JsonValueKind.Array:\n\t\t\t\tWriteArray(writer, element);\n\t\t\t\tbreak;\n\t\t\tcase JsonValueKind.String:\n\t\t\t\twriter.WriteStringValue(element.GetString());\n\t\t\t\tbreak;\n\t\t\tcase JsonValueKind.Number:\n\t\t\t\twriter.WriteNumberValue(element.GetDecimal());\n\t\t\t\tbreak;\n\t\t\tcase JsonValueKind.True:\n\t\t\t\twriter.WriteBooleanValue(true);\n\t\t\t\tbreak;\n\t\t\tcase JsonValueKind.False:\n\t\t\t\twriter.WriteBooleanValue(false);\n\t\t\t\tbreak;\n\t\t\tcase JsonValueKind.Null:\n\t\t\t\twriter.WriteNullValue();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new ArgumentOutOfRangeException();\n\t\t}\n\t}\n\n\tprivate static void WriteObject(this Utf8JsonWriter writer, JsonElement element)\n\t{\n\t\twriter.WriteStartObject();\n\t\tforeach (var property in element.EnumerateObject())\n\t\t{\n\t\t\twriter.WritePropertyName(property.Name);\n\t\t\tWriteValue(writer, property.Value);\n\t\t}\n\t\twriter.WriteEndObject();\n\t}\n\n\tprivate static void WriteArray(this Utf8JsonWriter writer, JsonElement element)\n\t{\n\t\twriter.WriteStartArray();\n\t\tforeach (var item in element.EnumerateArray())\n\t\t{\n\t\t\tWriteValue(writer, item);\n\t\t}\n\t\twriter.WriteEndArray();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.More;\n\n/// \n/// Provides extension functionality for .\n/// \npublic static class Utf8JsonWriterExtensions\n{\n\t/// (ref ArrayEnumerator, JsonSerializerOptions)\")]\n\t[RequiresDynamicCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\tpublic static ValueTuple ReadValues1(JsonElement.ArrayEnumerator enumerator, JsonSerializerOptions options)\n\t{\n\t\tvar value1 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\n\t\treturn new ValueTuple(value1!);\n\t}\n\n\t[RequiresUnreferencedCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\t[RequiresDynamicCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\tpublic static (T1, T2) ReadValues2(JsonElement.ArrayEnumerator enumerator, JsonSerializerOptions options)\n\t{\n\t\tvar value1 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value2 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\n\t\treturn (value1!, value2!);\n\t}\n\n\t[RequiresUnreferencedCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\t[RequiresDynamicCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\tpublic static (T1, T2, T3) ReadValues3(JsonElement.ArrayEnumerator enumerator, JsonSerializerOptions options)\n\t{\n\t\tvar value1 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value2 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value3 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\n\t\treturn (value1!, value2!, value3!);\n\t}\n\n\t[RequiresUnreferencedCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\t[RequiresDynamicCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\tpublic static (T1, T2, T3, T4) ReadValues4(JsonElement.ArrayEnumerator enumerator, JsonSerializerOptions options)\n\t{\n\t\tvar value1 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value2 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value3 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value4 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\n\t\treturn (value1!, value2!, value3!, value4!);\n\t}\n\n\t[RequiresUnreferencedCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\t[RequiresDynamicCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\tpublic static (T1, T2, T3, T4, T5) ReadValues5(JsonElement.ArrayEnumerator enumerator, JsonSerializerOptions options)\n\t{\n\t\tvar value1 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value2 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value3 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value4 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value5 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\n\t\treturn (value1!, value2!, value3!, value4!, value5!);\n\t}\n\n\t[RequiresUnreferencedCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\t[RequiresDynamicCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\tpublic static (T1, T2, T3, T4, T5, T6) ReadValues6(JsonElement.ArrayEnumerator enumerator, JsonSerializerOptions options)\n\t{\n\t\tvar value1 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value2 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value3 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value4 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value5 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value6 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\n\t\treturn (value1!, value2!, value3!, value4!, value5!, value6!);\n\t}\n\n\t[RequiresUnreferencedCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\t[RequiresDynamicCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\tpublic static (T1, T2, T3, T4, T5, T6, T7) ReadValues7(JsonElement.ArrayEnumerator enumerator, JsonSerializerOptions options)\n\t{\n\t\tvar value1 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value2 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value3 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value4 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value5 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value6 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value7 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\n\t\treturn (value1!, value2!, value3!, value4!, value5!, value6!, value7!);\n\t}\n\n\t[RequiresUnreferencedCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions) and Json.More.ValueReader.GetReadValuesMethod(string, Type[])\")]\n\t[RequiresDynamicCode(\"Calls Json.More.JsonElementExtensions.ReadValue(ref ArrayEnumerator, JsonSerializerOptions)\")]\n\tpublic static ValueTuple ReadValues8(JsonElement.ArrayEnumerator enumerator, JsonSerializerOptions options)\n\t\twhere TRest : struct\n\t{\n\t\tvar value1 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value2 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value3 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value4 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value5 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value6 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\t\tvar value7 = JsonElementExtensions.ReadValue(ref enumerator, options);\n\n\t\tvar restParams = typeof(TRest).GetGenericArguments();\n\t\tvar method = GetReadValuesMethod($\"ReadValues{restParams.Length}\", restParams);\n\n\t\tvar rest = (TRest) method.Invoke(null, [enumerator, options])!;\n\n\t\treturn new ValueTuple(value1!, value2!, value3!, value4!, value5!, value6!, value7!, rest);\n\t}\n\n\t[RequiresUnreferencedCode(\"Calls System.Reflection.MethodInfo.MakeGenericType(Type[])\")]\n\t[RequiresDynamicCode(\"Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])\")]\n\tprivate static MethodInfo GetReadValuesMethod(string methodName, Type[] types)\n\t{\n\t\tvar type = typeof(ValueReader);\n\t\tvar generic = type.GetMethod(methodName);", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Reflection;\nusing System.Text.Json;\n\nnamespace Json.More;\n\ninternal static class ValueReader\n{\n\t[RequiresUnreferencedCode(\"Calls Json.More.JsonElementExte" + }, + { + "title": "src/Json.More/ValueReader.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/ValueReader.cs#L121-L123", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/ValueReader.cs", + "startLine": 121, + "endLine": 123, + "content": "return generic!.MakeGenericMethod(types);\n\t}\n}", + "snippet": "return generic!.MakeGenericMethod(types);\n\t}\n}" + }, + { + "title": "src/Json.More/ValueWriter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/ValueWriter.cs#L1-L108", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/ValueWriter.cs", + "startLine": 1, + "endLine": 108, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Reflection;\nusing System.Text.Json;\n\nnamespace Json.More;\n\ninternal static class ValueWriter\n{\n\t[RequiresUnreferencedCode(\"Calls System.Text.Json.JsonSerializer.Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)\")]\n\t[RequiresDynamicCode(\"Calls System.Text.Json.JsonSerializer.Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)\")]\n\tpublic static void WriteValues(Utf8JsonWriter writer, IEnumerable<(object? value, Type type)> values, JsonSerializerOptions options)\n\t{\n\t\tforeach (var (value, type) in values)\n\t\t{\n\t\t\tJsonSerializer.Serialize(writer, value, type, options);\n\t\t}\n\t}\n\n\tpublic static IEnumerable<(object?, Type)> Unwrap1(ValueTuple value)\n\t{\n\t\tyield return (value.Item1, typeof(T));\n\t}\n\n\tpublic static IEnumerable<(object?, Type)> Unwrap2(ValueTuple value)\n\t{\n\t\tyield return (value.Item1, typeof(T1));\n\t\tyield return (value.Item2, typeof(T2));\n\t}\n\n\tpublic static IEnumerable<(object?, Type)> Unwrap3(ValueTuple value)\n\t{\n\t\tyield return (value.Item1, typeof(T1));\n\t\tyield return (value.Item2, typeof(T2));\n\t\tyield return (value.Item3, typeof(T3));\n\t}\n\n\tpublic static IEnumerable<(object?, Type)> Unwrap4(ValueTuple value)\n\t{\n\t\tyield return (value.Item1, typeof(T1));\n\t\tyield return (value.Item2, typeof(T2));\n\t\tyield return (value.Item3, typeof(T3));\n\t\tyield return (value.Item4, typeof(T4));\n\t}\n\n\tpublic static IEnumerable<(object?, Type)> Unwrap5(ValueTuple value)\n\t{\n\t\tyield return (value.Item1, typeof(T1));\n\t\tyield return (value.Item2, typeof(T2));\n\t\tyield return (value.Item3, typeof(T3));\n\t\tyield return (value.Item4, typeof(T4));\n\t\tyield return (value.Item5, typeof(T5));\n\t}\n\n\tpublic static IEnumerable<(object?, Type)> Unwrap6(ValueTuple value)\n\t{\n\t\tyield return (value.Item1, typeof(T1));\n\t\tyield return (value.Item2, typeof(T2));\n\t\tyield return (value.Item3, typeof(T3));\n\t\tyield return (value.Item4, typeof(T4));\n\t\tyield return (value.Item5, typeof(T5));\n\t\tyield return (value.Item6, typeof(T6));\n\t}\n\n\tpublic static IEnumerable<(object?, Type)> Unwrap7(ValueTuple value)\n\t{\n\t\tyield return (value.Item1, typeof(T1));\n\t\tyield return (value.Item2, typeof(T2));\n\t\tyield return (value.Item3, typeof(T3));\n\t\tyield return (value.Item4, typeof(T4));\n\t\tyield return (value.Item5, typeof(T5));\n\t\tyield return (value.Item6, typeof(T6));\n\t\tyield return (value.Item7, typeof(T7));\n\t}\n\n\t[RequiresDynamicCode(\"Calls Json.More.ValueWriter.GetUnwrapMethod(String, Type[])\")]\n\t[RequiresUnreferencedCode(\"Calls Json.More.ValueWriter.GetUnwrapMethod(String, Type[])\")]\n\tpublic static IEnumerable<(object?, Type)> Unwrap8(ValueTuple value)\n\t\twhere TRest : struct\n\t{\n\t\tyield return (value.Item1, typeof(T1));\n\t\tyield return (value.Item2, typeof(T2));\n\t\tyield return (value.Item3, typeof(T3));\n\t\tyield return (value.Item4, typeof(T4));\n\t\tyield return (value.Item5, typeof(T5));\n\t\tyield return (value.Item6, typeof(T6));\n\t\tyield return (value.Item7, typeof(T7));\n\n\t\tvar typeParams = typeof(TRest).GetGenericArguments();\n\t\tvar method = GetUnwrapMethod($\"Unwrap{typeParams.Length}\", typeParams);\n\n\t\tvar unwrapped = (IEnumerable<(object?, Type)>) method.Invoke(null, new object[] { value.Rest })!;\n\t\tforeach (var item in unwrapped)\n\t\t{\n\t\t\tyield return item;\n\t\t}\n\t}\n\n\t[RequiresDynamicCode(\"Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])\")]\n\t[RequiresUnreferencedCode(\"Calls System.Type.GetMethod(String) and System.Reflection.MethodInfo.MakeGenericMethod(Type[])\")]\n\tprivate static MethodInfo GetUnwrapMethod(string methodName, Type[] types)\n\t{\n\t\tvar type = typeof(ValueWriter);\n\t\tvar generic = type.GetMethod(methodName);\n\t\treturn generic!.MakeGenericMethod(types);\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Reflection;\nusing System.Text.Json;\n\nnamespace Json.More;\n\ninternal static class ValueWriter\n{\n\t[RequiresUnreferencedCod" + }, + { + "title": "src/Json.More/WeaklyTypedJsonConverter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/Json.More/WeaklyTypedJsonConverter.cs#L1-L50", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/Json.More/WeaklyTypedJsonConverter.cs", + "startLine": 1, + "endLine": 50, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing System.Text.Json.Serialization.Metadata;\n\nnamespace Json.More\n{\n\t/// \n\t/// Interface to enable JsonConverter implementations to call other JsonConverter's Read methods\n\t/// without statically being aware of their type parameters.\n\t/// \n\tpublic interface IWeaklyTypedJsonConverter\n\t{\n\t\t/// Reads and converts the JSON to object?.\n\t\t/// The reader.\n\t\t/// The type to convert.\n\t\t/// An object that specifies serialization options to use.\n\t\t/// The converted value.\n\t\tobject? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options);\n\n\t\t/// Writes a specified value as JSON.\n\t\t/// The writer to write to.\n\t\t/// The value to convert to JSON.\n\t\t/// An object that specifies serialization options to use.\n\t\t/// The for the value being serialized.\n\t\tvoid Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options, JsonTypeInfo? typeInfo = null);\n\t}\n\n\t/// \n\t/// Abstract base class of JsonConverter that helps external code call \n\t/// a JsonConverter without statically knowing about T.\n\t/// \n\tpublic abstract class WeaklyTypedJsonConverter : JsonConverter, IWeaklyTypedJsonConverter\n\t{\n\t\tobject? IWeaklyTypedJsonConverter.Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t\t{\n\t\t\treturn Read(ref reader, typeToConvert, options);\n\t\t}\n\n\t\tvoid IWeaklyTypedJsonConverter.Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options, JsonTypeInfo? typeInfo)\n\t\t{\n\t\t\tif (typeInfo is null)\n\t\t\t\tWrite(writer, (T)value, options);\n\t\t\telse\n\t\t\t\toptions.Write(writer, (T)value, (JsonTypeInfo)typeInfo);\n\t\t}\n\t}\n\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing System.Text.Json.Serialization.Metadata;\n\nnamespace Json.More\n{\n\t/// \n\t/// Interface to enable JsonConverter implementations to c" + }, + { + "title": "src/JsonE.Tests/ClientTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/ClientTests.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/ClientTests.cs", + "startLine": 1, + "endLine": 28, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\n\nnamespace Json.JsonE.Tests;\n\npublic class ClientTests\n{\n\t[Test]\n\tpublic void Issue931_NegativeIndex()\n\t{\n\t\tvar template = JsonNode.Parse(\"\"\" \n\t\t { \n\t\t \"$eval\": \"array[-1]\"\n\t\t } \n\t\t \"\"\");\n\n\t\tvar context = JsonNode.Parse(\"\"\" \n\t\t { \n\t\t \"array\": [1]\n\t\t } \n\t\t \"\"\");\n\n\t\t// throws InterpreterException \"index out of bounds\"\n\t\tvar output = JsonE.Evaluate(template, context);\n\t\tAssert.That(output.AsJsonString(), Is.EqualTo(\"1\"));\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\n\nnamespace Json.JsonE.Tests;\n\npublic class ClientTests\n{\n\t[Test]\n\tpublic void Issue931_NegativeIndex()\n\t{\n\t\tvar template = JsonNode.Parse(\"\"\" \n\t\t " + }, + { + "title": "src/JsonE.Tests/CustomFunctionTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/CustomFunctionTests.cs#L1-L34", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/CustomFunctionTests.cs", + "startLine": 1, + "endLine": 34, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\n\nnamespace Json.JsonE.Tests;\n\npublic class CustomFunctionTests\n{\n\t[Test]\n\tpublic void ModFunction()\n\t{\n\t\tvar context = new JsonObject\n\t\t{\n\t\t\t[\"mod\"] = JsonFunction.Create((parameters, context) =>\n\t\t\t{\n\t\t\t\tvar a = parameters[0]?.AsValue().GetNumber();\n\t\t\t\tvar b = parameters[1]?.AsValue().GetNumber();\n\n\t\t\t\treturn a % b;\n\t\t\t})\n\t\t};\n\n\t\tvar template = new JsonObject\n\t\t{\n\t\t\t[\"$eval\"] = \"mod(10, 4)\"\n\t\t};\n\n\n\t\tvar result = JsonE.Evaluate(template, context);\n\n\t\tAssert.That(result.IsEquivalentTo(2), Is.True);\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\n\nnamespace Json.JsonE.Tests;\n\npublic class CustomFunctionTests\n{\n\t[Test]\n\tpublic void ModFunction()\n\t{\n\t\tvar context = new JsonObject\n\t\t" + }, + { + "title": "src/JsonE.Tests/DevTest.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/DevTest.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/DevTest.cs", + "startLine": 1, + "endLine": 24, + "content": "using System.Text.Json.Nodes;\nusing Json.JsonE.Expressions.Functions;\nusing NUnit.Framework;\n\nnamespace Json.JsonE.Tests;\n\npublic class DevTest\n{\n\t[Test]\n\t[Ignore(\"dev use only\")]\n\tpublic void Check()\n\t{\n\t\tvar value = JsonValue.Create(new MinFunction())!;\n\n\t\tvar stored = value.GetValue();\n\t\tAssert.That(stored, Is.InstanceOf());\n\n\t\tvar copy = value.DeepClone();\n\n\t\tstored = copy.GetValue();\n\t\tAssert.That(stored, Is.InstanceOf());\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.JsonE.Expressions.Functions;\nusing NUnit.Framework;\n\nnamespace Json.JsonE.Tests;\n\npublic class DevTest\n{\n\t[Test]\n\t[Ignore(\"dev use only\")]\n\tpublic void Check()\n\t{\n\t\tvar value = Js" + }, + { + "title": "src/JsonE.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonE.Tests/obj/Debug/net10.0/JsonE.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/obj/Debug/net10.0/JsonE.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/obj/Debug/net10.0/JsonE.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonE.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonE.Tests/obj/Debug/net8.0/JsonE.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/obj/Debug/net8.0/JsonE.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/obj/Debug/net8.0/JsonE.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonE.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonE.Tests/obj/Debug/net9.0/JsonE.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/obj/Debug/net9.0/JsonE.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/obj/Debug/net9.0/JsonE.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonE.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonE.Tests/obj/Release/net10.0/JsonE.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/obj/Release/net10.0/JsonE.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/obj/Release/net10.0/JsonE.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonE.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonE.Tests/obj/Release/net8.0/JsonE.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/obj/Release/net8.0/JsonE.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/obj/Release/net8.0/JsonE.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonE.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonE.Tests/obj/Release/net9.0/JsonE.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/obj/Release/net9.0/JsonE.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/obj/Release/net9.0/JsonE.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonE.Tests/Suite/MoreTestsRunner.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/Suite/MoreTestsRunner.cs#L1-L87", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/Suite/MoreTestsRunner.cs", + "startLine": 1, + "endLine": 87, + "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\nusing Yaml2JsonNode;\n\nnamespace Json.JsonE.Tests.Suite;\n\npublic class MoreTestsRunner\n{\n\tprivate const string _testsFile = \"Files/more-tests.yml\";\n\n\tprivate static IEnumerable? DeserializeAll(string yamlText, JsonSerializerOptions? options = null)\n\t{\n\t\tvar yaml = YamlSerializer.Parse(yamlText);\n\t\tvar json = yaml.ToJsonNode().Where(x => x![\"title\"] is not null).ToJsonArray();\n\n\t\treturn json.Deserialize(options);\n\t}\n\n\tpublic static IEnumerable Suite()\n\t{\n\t\tvar testsPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, _testsFile);\n\n\t\tvar yamlText = File.ReadAllText(testsPath);\n\n\t\tvar tests = DeserializeAll(yamlText, TestEnvironment.SerializerOptions)!;\n\n\t\treturn tests.Select(t => new TestCaseData(t) { TestName = $\"{t.Title} | {t.Template.AsJsonString(TestEnvironment.SerializerOptions)} | {t.Context.AsJsonString(TestEnvironment.SerializerOptions)}\" });\n\t}\n\n\t[TestCaseSource(nameof(Suite))]\n\tpublic void Run(Test test)\n\t{\n\t\ttry\n\t\t{\n\t\t\tOutputTest(test);\n\n\t\t\ttest.Context![\"now\"] = \"2017-01-19T16:27:20.974Z\";\n\n\t\t\tvar result = JsonE.Evaluate(test.Template, test.Context);\n\n\t\t\tif (test.HasError)\n\t\t\t\tAssert.Fail($\"Expected error: {test.Error}\\nActual: {result}\");\n\n\t\t\tJsonAssert.AreEquivalent(test.Expected, result);\n\t\t}\n\t\tcatch (Exception e) when (e is not AssertionException)\n\t\t{\n\t\t\tif (!test.HasError) throw;\n\t\t\tif (test.Error is not null)\n\t\t\t{\n\t\t\t\tvar errorMessage = $\"{GetErrorPrefix(e)}: {e.Message}\";\n\t\t\t\tif (test.Error != errorMessage && test.Error.EndsWith(e.Message))\n\t\t\t\t\tAssert.Inconclusive($\"Error message is correct, but received type ({GetErrorPrefix(e)}) is wrong.\\n\");\n\n\t\t\t\tAssert.That(errorMessage, Is.EqualTo(test.Error));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static string GetErrorPrefix(Exception exception)\n\t{\n\t\tif (exception is TemplateException) return \"TemplateError\";\n\t\tif (exception is InterpreterException) return \"InterpreterError\";\n\n\t\treturn string.Empty;\n\t}\n\n\tprivate static void OutputTest(Test test)\n\t{\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine($\"Title: {test.Title}\");\n\t\tTestConsole.WriteLine($\"Template: {test.Template.AsJsonString(TestEnvironment.SerializerOptions)}\");\n\t\tTestConsole.WriteLine($\"Template: {test.Template.AsJsonString(TestEnvironment.SerializerOptions)}\");\n\t\tTestConsole.WriteLine($\"Context: {test.Context.AsJsonString(TestEnvironment.SerializerOptions)}\");\n\t\tif (test.Expected is not null)\n\t\t\tTestConsole.WriteLine($\"Result: {test.Expected.AsJsonString(TestEnvironment.SerializerOptions)}\");\n\t\tif (test.HasError)\n\t\t\tTestConsole.WriteLine($\"Error: {test.ErrorNode.AsJsonString(TestEnvironment.SerializerOptions)}\");\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\nusing Yaml2JsonNode;\n\nnamespace Json.JsonE.Tests.Suit" + }, + { + "title": "src/JsonE.Tests/Suite/SuiteRunner.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/Suite/SuiteRunner.cs#L1-L106", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/Suite/SuiteRunner.cs", + "startLine": 1, + "endLine": 106, + "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\nusing Yaml2JsonNode;\n\nnamespace Json.JsonE.Tests.Suite;\n\npublic class SuiteRunner\n{\n\tprivate const string _testsFile = \"../../../../../ref-repos/json-e/specification.yml\";\n\n\tprivate static readonly (string Name, string Reason)[] _ignored =\n\t[\n\t\t(\"division (3)\", \"decimals are more precise than the test expects\"),\n\t\t(\"division (4)\", \"decimals are more precise than the test expects\"),\n\t\t(\"representation of various unicode codepoints are consistent\", \"json can be encoded differently\"),\n\t\t(\"sorting pairs by unicode key strings sorts lexically by codepoint\", \"json can be encoded differently\"),\n\t\t(\"sorting pairs by unicode key strings sorts lexically by codepoint, even with chars above base plane\", \"json can be encoded differently\"),\n\t];\n\n\tprivate static IEnumerable? DeserializeAll(string yamlText, JsonSerializerOptions? options = null)\n\t{\n\t\tvar yaml = YamlSerializer.Parse(yamlText);\n\t\tvar json = yaml.ToJsonNode().Where(x => x![\"title\"] is not null).ToJsonArray();\n\n\t\treturn json.Deserialize(options);\n\t}\n\n\tpublic static IEnumerable Suite()\n\t{\n\t\tvar testsPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, _testsFile);\n\n\t\tvar yamlText = File.ReadAllText(testsPath);\n\n\t\tvar tests = DeserializeAll(yamlText, TestEnvironment.SerializerOptions)!;\n\n\t\treturn tests.Select(t => new TestCaseData(t) { TestName = $\"{t.Title} | {t.Template.AsJsonString(TestEnvironment.SerializerOptions)} | {t.Context.AsJsonString(TestEnvironment.SerializerOptions)}\" });\n\t}\n\n\t[TestCaseSource(nameof(Suite))]\n\tpublic void Run(Test test)\n\t{\n\t\ttry\n\t\t{\n\t\t\tOutputTest(test);\n\n\t\t\tvar ignored = _ignored.FirstOrDefault(x => x.Name == test.Title);\n\t\t\tif (ignored.Name != null)\n\t\t\t\tAssert.Inconclusive(ignored.Reason);\n\n\t\t\ttest.Context![\"now\"] = \"2017-01-19T16:27:20.974Z\";\n\n\t\t\tvar result = JsonE.Evaluate(test.Template, test.Context);\n\n\t\t\tif (test.HasError)\n\t\t\t\tAssert.Fail($\"Expected error: {test.Error}\\nActual: {result}\");\n\n\t\t\tJsonAssert.AreEquivalent(test.Expected, result);\n\t\t}\n\t\tcatch (Exception e) when (e is not AssertionException)\n\t\t{\n\t\t\tif (!test.HasError) throw;\n\t\t\tif (test.Error is not null)\n\t\t\t{\n\t\t\t\tvar errorMessage = $\"{GetErrorPrefix(e)}: {e.Message}\";\n\t\t\t\tif (test.Error != errorMessage)\n\t\t\t\t\tAssert.Inconclusive($\"Received error message, but it was different.\\n\" +\n\t\t\t\t\t $\" Expected: {test.Error}\\n\" +\n\t\t\t\t\t $\" Actual: {errorMessage}\\n\");\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static string GetErrorPrefix(Exception exception)\n\t{\n\t\tif (exception is TemplateException) return \"TemplateError\";\n\t\tif (exception is InterpreterException) return \"InterpreterError\";\n\t\tif (exception is BuiltInException) return \"BuiltinError\";\n\t\tif (exception is SyntaxException) return \"SyntaxError\";\n\t\tif (exception is TypeException) return \"TypeError\";\n\n\t\treturn string.Empty;\n\t}\n\n\tprivate static void OutputTest(Test test)\n\t{\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine($\"Title: {test.Title}\");\n\t\tTestConsole.WriteLine($\"Template: {test.Template.AsJsonString(TestEnvironment.SerializerOptions)}\");\n\t\tTestConsole.WriteLine($\"Context: {test.Context.AsJsonString(TestEnvironment.SerializerOptions)}\");\n\t\tif (test.HasError)\n\t\t\tTestConsole.WriteLine($\"Error: {test.ErrorNode.AsJsonString(TestEnvironment.SerializerOptions)}\");\n\t\telse\n\t\t\tTestConsole.WriteLine($\"Result: {test.Expected.AsJsonString(TestEnvironment.SerializerOptions)}\");\n\t}\n}\n\n[JsonSerializable(typeof(Test))]\n[JsonSerializable(typeof(Test[]))]\ninternal partial class JsonETestSerializerContext : JsonSerializerContext;", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\nusing Yaml2Json" + }, + { + "title": "src/JsonE.Tests/Suite/Test.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/Suite/Test.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/Suite/Test.cs", + "startLine": 1, + "endLine": 26, + "content": "using System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\n\nnamespace Json.JsonE.Tests.Suite;\n\npublic class Test\n{\n#pragma warning disable CS8618\n\t[JsonPropertyName(\"title\")]\n\tpublic string Title { get; set;}\n\t[JsonPropertyName(\"template\")]\n\tpublic JsonNode? Template { get; set; }\n\t[JsonPropertyName(\"context\")]\n\tpublic JsonNode? Context { get; set; }\n\t[JsonPropertyName(\"result\")]\n\tpublic JsonNode? Expected { get; set; }\n\t[JsonPropertyName(\"error\")]\n\tpublic JsonNode? ErrorNode { get; set; }\n\n\tpublic string? Error => ErrorNode is JsonValue value && value.TryGetValue(out var s) ? s : null;\n\tpublic bool HasError => ErrorNode is JsonValue value &&\n\t (value.TryGetValue(out _) ||\n\t (value.TryGetValue(out var b) && b));\n#pragma warning restore CS8618\n}", + "snippet": "using System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\n\nnamespace Json.JsonE.Tests.Suite;\n\npublic class Test\n{\n#pragma warning disable CS8618\n\t[JsonPropertyName(\"title\")]\n\tpublic string Title { get; set;}\n\t[" + }, + { + "title": "src/JsonE.Tests/TestEnvironment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/TestEnvironment.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/TestEnvironment.cs", + "startLine": 1, + "endLine": 17, + "content": "using System.Text.Encodings.Web;\nusing System.Text.Json;\nusing Json.JsonE.Tests.Suite;\nusing NUnit.Framework;\n\nnamespace Json.JsonE.Tests;\n\n[SetUpFixture]\npublic class TestEnvironment\n{\n\tpublic static readonly JsonSerializerOptions SerializerOptions =\n\t\tnew()\n\t\t{\n\t\t\tTypeInfoResolverChain = { JsonETestSerializerContext.Default },\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t\t};\n}", + "snippet": "using System.Text.Encodings.Web;\nusing System.Text.Json;\nusing Json.JsonE.Tests.Suite;\nusing NUnit.Framework;\n\nnamespace Json.JsonE.Tests;\n\n[SetUpFixture]\npublic class TestEnvironment\n{\n\tpublic static readonly JsonSerial" + }, + { + "title": "src/JsonE.Tests/TruthyTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE.Tests/TruthyTests.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE.Tests/TruthyTests.cs", + "startLine": 1, + "endLine": 32, + "content": "using System.Collections.Generic;\nusing System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.JsonE.Tests;\n\npublic class TruthyTests\n{\n\tpublic static IEnumerable TruthyTestCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(null, false);\n\t\t\tyield return new TestCaseData(new JsonObject(), false);\n\t\t\tyield return new TestCaseData(new JsonObject { [\"foo\"] = 42 }, true);\n\t\t\tyield return new TestCaseData(new JsonArray(), false);\n\t\t\tyield return new TestCaseData(new JsonArray(42), true);\n\t\t\tyield return new TestCaseData((JsonNode?)string.Empty, false);\n\t\t\tyield return new TestCaseData((JsonNode?)\"foo\", true);\n\t\t\tyield return new TestCaseData((JsonNode?)0, false);\n\t\t\tyield return new TestCaseData((JsonNode?)1, true);\n\t\t\tyield return new TestCaseData((JsonNode?)false, false);\n\t\t\tyield return new TestCaseData((JsonNode?)true, true);\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(TruthyTestCases))]\n\tpublic void IsTruthy(JsonNode? node, bool expected)\n\t{\n\t\tAssert.That(node.IsTruthy(), Is.EqualTo(expected));\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.JsonE.Tests;\n\npublic class TruthyTests\n{\n\tpublic static IEnumerable TruthyTestCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyie" + }, + { + "title": "src/JsonE/assembly.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/assembly.cs#L1-L3", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/assembly.cs", + "startLine": 1, + "endLine": 3, + "content": "using System.Runtime.CompilerServices;\n\n[assembly: InternalsVisibleTo(\"JsonE.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d111b5991feb360746cf4535b9ec3196825996680b6599cf10748f90a58ec820431f81d21eff5229a3fd7c3e42e46a20584ac413ebe39b4c05905fd47b877bffed36bff23ad4ad14aad3deed8f24ed40a1371daad79a41172b2cdf0db4b664198f38f3a19419457131f8ee4558e628b5c986bb574d4e151b650eae6aa1f5ccbf\")]", + "snippet": "using System.Runtime.CompilerServices;\n\n[assembly: InternalsVisibleTo(\"JsonE.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d111b5991feb360746cf4535b9ec3196825996680b6599cf10748f90a58ec8" + }, + { + "title": "src/JsonE/BuiltInException.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/BuiltInException.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/BuiltInException.cs", + "startLine": 1, + "endLine": 15, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Thrown from when a built-in function cannot be evaluated.\n/// \npublic class BuiltInException : JsonEException\n{\n\t/// \n\t/// Creates a new instance of .\n\t/// \n\t/// The error message.\n\tpublic BuiltInException(string message) : base(message){}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Thrown from when a built-in function cannot be evaluated.\n/// \npublic class BuiltInExcep" + }, + { + "title": "src/JsonE/ContextAccessor.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/ContextAccessor.cs#L1-L72", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/ContextAccessor.cs", + "startLine": 1, + "endLine": 72, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions;\nusing Json.More;\n\nnamespace Json.JsonE;\n\n/// \n/// Represents a property. Used for retrieving data from the context.\n/// \npublic class ContextAccessor\n{\n\tprivate readonly string _name;\n\n\tinternal static ContextAccessor Now => \"now\";\n\n\tprivate ContextAccessor(string asString)\n\t{\n\t\t_name = asString;\n\t}\n\n\tinternal static bool TryParse(ReadOnlySpan source, ref int index, out ContextAccessor? accessor)\n\t{\n\t\tvar i = index;\n\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\taccessor = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (source.TryParseName(ref i, out var name))\n\t\t{\n\t\t\tif (name!.In(\"true\", \"false\", \"null\"))\n\t\t\t{\n\t\t\t\taccessor = null;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\taccessor = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tindex = i;\n\t\taccessor = new ContextAccessor(name!);\n\t\treturn true;\n\t}\n\n\tinternal bool TryFind(JsonObject context, out JsonNode? value)\n\t{\n\t\treturn context.TryGetValue(_name, out value, out _);\n\t}\n\n\t/// Returns a string that represents the current object.\n\t/// A string that represents the current object.\n\tpublic override string ToString() => _name;\n\n\t/// \n\t/// Implicitly converts a string into a \n\t/// by using \n\t/// \n\t/// \n\tpublic static implicit operator ContextAccessor(string name)\n\t{\n\t\tint index = 0;\n\t\tif (!TryParse(name.AsSpan(), ref index, out var accessor))\n\t\t\tthrow new TemplateException($\"{name} is not a valid accessor\");\n\n\t\treturn accessor!;\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions;\nusing Json.More;\n\nnamespace Json.JsonE;\n\n/// \n/// Represents a property. Used for retrieving data from the context.\n/// \npubli" + }, + { + "title": "src/JsonE/EvaluationContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/EvaluationContext.cs#L1-L96", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/EvaluationContext.cs", + "startLine": 1, + "endLine": 96, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions.Functions;\n\nnamespace Json.JsonE;\n\n/// \n/// Provides context data for JSON-e evaluation.\n/// \npublic class EvaluationContext\n{\n\tprivate static readonly JsonObject _functionsContext =\n\t\tnew()\n\t\t{\n\t\t\t[\"abs\"] = new AbsFunction(),\n\t\t\t[\"ceil\"] = new CeilFunction(),\n\t\t\t[\"defined\"] = new DefinedFunction(),\n\t\t\t[\"floor\"] = new FloorFunction(),\n\t\t\t[\"fromNow\"] = new FromNowFunction(),\n\t\t\t[\"join\"] = new JoinFunction(),\n\t\t\t[\"len\"] = new LenFunction(),\n\t\t\t[\"lowercase\"] = new LowercaseFunction(),\n\t\t\t[\"lstrip\"] = new LStripFunction(),\n\t\t\t[\"max\"] = new MaxFunction(),\n\t\t\t[\"min\"] = new MinFunction(),\n\t\t\t[\"number\"] = new NumberFunction(),\n\t\t\t[\"range\"] = new RangeFunction(),\n\t\t\t[\"rstrip\"] = new RStripFunction(),\n\t\t\t[\"split\"] = new SplitFunction(),\n\t\t\t[\"sqrt\"] = new SqrtFunction(),\n\t\t\t[\"str\"] = new StrFunction(),\n\t\t\t[\"strip\"] = new StripFunction(),\n\t\t\t[\"typeof\"] = new TypeOfFunction(),\n\t\t\t[\"uppercase\"] = new UppercaseFunction()\n\t\t};\n\n\tprivate readonly Stack _contextStack;\n\n\tinternal EvaluationContext(JsonObject baseContext)\n\t{\n\t\t_contextStack = new Stack();\n\t\t_contextStack.Push(_functionsContext);\n\t\t_contextStack.Push(new JsonObject { [\"now\"] = DateTime.Now.ToString(\"O\") });\n\t\t_contextStack.Push(baseContext);\n\t}\n\n\t/// \n\t/// Adds or overrides context data.\n\t/// \n\t/// \n\tpublic void Push(JsonObject newContext)\n\t{\n\t\t_contextStack.Push(newContext);\n\t}\n\n\t/// \n\t/// Removes the previous context data. Call only if you've explicitly added context data with \n\t/// \n\t/// \n\tpublic JsonNode? Pop()\n\t{\n\t\treturn _contextStack.Pop();\n\t}\n\n\t/// \n\t/// Finds data within the context.\n\t/// \n\t/// An accessor.\n\t/// The value, if it exists.\n\t/// Thrown if the context doesn't contain the indicated property.\n\tpublic JsonNode? Find(ContextAccessor identifier)\n\t{\n\t\tforeach (var contextValue in _contextStack)\n\t\t{\n\t\t\tif (identifier.TryFind(contextValue, out var target)) return target;\n\t\t}\n\n\t\tthrow new InterpreterException($\"unknown context value {identifier}\");\n\t}\n\n\t/// \n\t/// Checks data for a given property.\n\t/// \n\t/// An accessor.\n\t/// true if the value exists in the context; otherwise false.\n\tpublic bool IsDefined(ContextAccessor identifier)\n\t{\n\t\tforeach (var context in _contextStack)\n\t\t{\n\t\t\tif (identifier.TryFind(context, out _)) return true;\n\t\t}\n\n\t\treturn false;\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions.Functions;\n\nnamespace Json.JsonE;\n\n/// \n/// Provides context data for JSON-e evaluation.\n/// \n" + }, + { + "title": "src/JsonE/Expressions/ArrayExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/ArrayExpressionNode.cs#L1-L86", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/ArrayExpressionNode.cs", + "startLine": 1, + "endLine": 86, + "content": "using System;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class ArrayExpressionNode : ExpressionNode\n{\n\tpublic JsonArray Value { get; }\n\n\tpublic ArrayExpressionNode(JsonArray value)\n\t{\n\t\tValue = value;\n\t}\n\n\tpublic override JsonNode? Evaluate(EvaluationContext context)\n\t{\n\t\treturn JsonE.Evaluate(Value, context);\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append(Value.AsJsonString());\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn Value.AsJsonString();\n\t}\n}\n\ninternal class ArrayExpressionParser : IOperandExpressionParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, out ExpressionNode? expression)\n\t{\n\t\tif (source[index] != '[')\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// consume {\n\t\tint i = index + 1;\n\t\tvar arr = new JsonArray();\n\n\t\twhile (i < source.Length && source[i] != ']')\n\t\t{\n\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t{\n\t\t\t\texpression = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// read expression\n\t\t\tif (!ExpressionParser.TryParse(source, ref i, out var value))\n\t\t\t\tthrow new SyntaxException(CommonErrors.WrongToken(source[i]));\n\n\t\t\tJsonNode expr = JsonExpression.Create(value!);\n\t\t\tarr.Add(expr);\n\n\t\t\t// read , or ]\n\t\t\tif (source[i] is ',')\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (source[i] is ']')\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (arr.Count == 0 && source[i] == ']')\n\t\t\ti++;\n\n\t\tindex = i;\n\t\texpression = new ArrayExpressionNode(arr);\n\t\treturn true;\n\t}\n}", + "snippet": "using System;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class ArrayExpressionNode : ExpressionNode\n{\n\tpublic JsonArray Valu" + }, + { + "title": "src/JsonE/Expressions/BinaryExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/BinaryExpressionNode.cs#L1-L63", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/BinaryExpressionNode.cs", + "startLine": 1, + "endLine": 63, + "content": "using System.Text;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions.Operators;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class BinaryExpressionNode : ExpressionNode\n{\n\tpublic IBinaryOperator Operator { get; }\n\tpublic ExpressionNode Left { get; }\n\tpublic ExpressionNode Right { get; set; }\n\tpublic int NestLevel { get; }\n\n\tpublic int Precedence => NestLevel * 10 + Operator.Precedence;\n\n\tpublic BinaryExpressionNode(IBinaryOperator op, ExpressionNode left, ExpressionNode right, int nestLevel)\n\t{\n\t\tOperator = op;\n\t\tLeft = left;\n\t\tRight = right;\n\t\tNestLevel = nestLevel;\n\t}\n\n\tpublic override JsonNode? Evaluate(EvaluationContext context)\n\t{\n\t\tif (Operator is IShortcuttingBinaryOperator shortcutter)\n\t\t{\n\t\t\treturn shortcutter.ShouldContinue(Left.Evaluate(context), out var result)\n\t\t\t\t? Operator.Evaluate(result, Right.Evaluate(context))\n\t\t\t\t: result;\n\t\t}\n\n\t\treturn Operator.Evaluate(Left.Evaluate(context), Right.Evaluate(context));\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tvar useGroup = Left is BinaryExpressionNode lBin &&\n\t\t (lBin.Precedence - Precedence) % 10 > 1;\n\n\t\tif (useGroup)\n\t\t\tbuilder.Append('(');\n\t\tLeft.BuildString(builder);\n\t\tif (useGroup)\n\t\t\tbuilder.Append(')');\n\t\n\t\tbuilder.Append(Operator);\n\n\t\tuseGroup = Right is BinaryExpressionNode rBin &&\n\t\t (rBin.Precedence - Precedence) % 10 > 1;\n\t\tif (useGroup)\n\t\t\tbuilder.Append('(');\n\t\tRight.BuildString(builder);\n\t\tif (useGroup)\n\t\t\tbuilder.Append(')');\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn $\"{Left}{Operator}{Right}\";\n\t}\n}", + "snippet": "using System.Text;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions.Operators;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class BinaryExpressionNode : ExpressionNode\n{\n\tpublic IBinaryOperator Operator { get; " + }, + { + "title": "src/JsonE/Expressions/ContextAccessorExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/ContextAccessorExpressionNode.cs#L1-L45", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/ContextAccessorExpressionNode.cs", + "startLine": 1, + "endLine": 45, + "content": "using System;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class ContextAccessorExpressionNode : ExpressionNode\n{\n\tpublic ContextAccessor Accessor { get; }\n\n\tpublic ContextAccessorExpressionNode(ContextAccessor accessor)\n\t{\n\t\tAccessor = accessor;\n\t}\n\n\tpublic override JsonNode? Evaluate(EvaluationContext context)\n\t{\n\t\treturn context.Find(Accessor);\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append(Accessor);\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn Accessor.ToString();\n\t}\n}\n\ninternal class ContextAccessorExpressionParser : IOperandExpressionParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, out ExpressionNode? expression)\n\t{\n\t\tif (!ContextAccessor.TryParse(source, ref index, out var accessor))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\texpression = new ContextAccessorExpressionNode(accessor!);\n\t\treturn true;\n\t}\n}", + "snippet": "using System;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class ContextAccessorExpressionNode : ExpressionNode\n{\n\tpublic ContextAccessor Accessor { get; }\n\n\tpublic Contex" + }, + { + "title": "src/JsonE/Expressions/ExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/ExpressionNode.cs#L1-L10", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/ExpressionNode.cs", + "startLine": 1, + "endLine": 10, + "content": "using System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal abstract class ExpressionNode\n{\n\tpublic abstract JsonNode? Evaluate(EvaluationContext context);\n\tpublic abstract void BuildString(StringBuilder builder);\n}", + "snippet": "using System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal abstract class ExpressionNode\n{\n\tpublic abstract JsonNode? Evaluate(EvaluationContext context);\n\tpublic abstract void BuildStr" + }, + { + "title": "src/JsonE/Expressions/ExpressionParser.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/ExpressionParser.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/ExpressionParser.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing Json.JsonE.Expressions.Operators;\nusing static Json.JsonE.Operators.CommonErrors;\n\nnamespace Json.JsonE.Expressions;\n\ninternal static class ExpressionParser\n{\n\tprivate static readonly IOperandExpressionParser[] _operandParsers =\n\t{\n\t\tnew ObjectExpressionParser(),\n\t\tnew ArrayExpressionParser(),\n\t\tnew UnaryExpressionParser(),\n\t\tnew ContextAccessorExpressionParser(),\n\t\tnew PrimitiveExpressionParser(),\n\t};\n\n\tpublic static ExpressionNode Parse(ReadOnlySpan source)\n\t{\n\t\tint index = 0;\n\t\tif (!TryParse(source, ref index, out var expression) || index != source.Length)\n\t\t\tthrow new TemplateException(\"Expression is not valid\");\n\n\t\treturn expression!;\n\t}\n\n\tpublic static bool TryParse(ReadOnlySpan source, ref int index, out ExpressionNode? expression, bool skipFunctions = false)\n\t{\n\t\tint i = index;\n\t\tvar nestLevel = 0;\n\n\t\tint Precedence(IBinaryOperator op) => nestLevel * 10 + op.Precedence;\n\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tvar isGroup = false;\n\t\twhile (i < source.Length && source[i] == '(')\n\t\t{\n\t\t\tnestLevel++;\n\t\t\ti++;\n\t\t\tisGroup = true;\n\t\t}\n\n\t\tif (i == source.Length)\n\t\t\tthrow new TemplateException(EndOfInput(i));\n\n\t\t// first get an operand\n\t\tExpressionNode? left = null;\n\t\tforeach (var parser in _operandParsers)\n\t\t{\n\t\t\tif (parser.TryParse(source, ref i, out left)) break;\n\t\t}\n\n\t\tif (left == null)\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tbool stillBuildingOperand;\n\t\tValueAccessor? valueAccessor;\n\t\tList? functionArguments;\n\t\tdo\n\t\t{\n\t\t\tstillBuildingOperand = false;\n\t\t\tif (ValueAccessor.TryParse(source, ref i, out valueAccessor))\n\t\t\t{\n\t\t\t\tleft = new ValueAccessorExpressionNode(left, valueAccessor!);\n\t\t\t\tstillBuildingOperand = true;\n\t\t\t}\n\n\t\t\tif (FunctionArgumentParser.TryParse(source, ref i, out functionArguments))\n\t\t\t{\n\t\t\t\tleft = new FunctionExpressionNode(left, functionArguments!);\n\t\t\t\tstillBuildingOperand = true;\n\t\t\t}\n\t\t} while (stillBuildingOperand);\n\n\t\twhile (i < source.Length)\n\t\t{\n\t\t\t// handle )\n\t\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t\t{\n\t\t\t\texpression = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (source[i] == ')' && nestLevel > 0)\n\t\t\t{\n\t\t\t\twhile (i < source.Length && source[i] == ')' && nestLevel > 0)\n\t\t\t\t{\n\t\t\t\t\tnestLevel--;\n\t\t\t\t\ti++;\n\t\t\t\t}\n\n\t\t\t\tif (nestLevel == 0) continue;\n\t\t\t}\n\n\t\t\tvar nextNest = nestLevel;\n\t\t\t// parse operator\n\t\t\tif (!OperatorRepository.TryGetBinary(source, ref i, out var op) || op is not IBinaryOperator binOp)\n\t\t\t\tbreak; // if we don't get a binary op, then we're done\n\n\t\t\t// handle (\n\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t{\n\t\t\t\texpression = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (source[i] == '(')\n\t\t\t{\n\t\t\t\tnextNest++;\n\t\t\t\ti++;\n\t\t\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing Json.JsonE.Expressions.Operators;\nusing static Json.JsonE.Operators.CommonErrors;\n\nnamespace Json.JsonE.Expressions;\n\ninternal static class ExpressionParser\n{\n\tprivat" + }, + { + "title": "src/JsonE/Expressions/ExpressionParser.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/ExpressionParser.cs#L121-L192", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/ExpressionParser.cs", + "startLine": 121, + "endLine": 192, + "content": "// parse right\n\t\t\tExpressionNode? right = null;\n\t\t\tforeach (var parser in _operandParsers)\n\t\t\t{\n\t\t\t\tif (parser.TryParse(source, ref i, out right)) break;\n\t\t\t}\n\n\t\t\tif (right == null)\n\t\t\t{\n\t\t\t\t// if we don't get a value, then the syntax is wrong\n\t\t\t\texpression = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tdo\n\t\t\t{\n\t\t\t\tstillBuildingOperand = false;\n\t\t\t\tif (ValueAccessor.TryParse(source, ref i, out valueAccessor))\n\t\t\t\t{\n\t\t\t\t\tright = new ValueAccessorExpressionNode(right, valueAccessor!);\n\t\t\t\t\tstillBuildingOperand = true;\n\t\t\t\t}\n\n\t\t\t\tif (FunctionArgumentParser.TryParse(source, ref i, out functionArguments))\n\t\t\t\t{\n\t\t\t\t\tright = new FunctionExpressionNode(right, functionArguments!);\n\t\t\t\t\tstillBuildingOperand = true;\n\t\t\t\t}\n\t\t\t} while (stillBuildingOperand);\n\n\t\t\tif (left is BinaryExpressionNode bin)\n\t\t\t{\n\t\t\t\tif (bin.Precedence < Precedence(binOp) || (bin.Operator is ExponentOperator && binOp is ExponentOperator))\n\t\t\t\t{\n\t\t\t\t\twhile (bin.Right is BinaryExpressionNode bRight && (bin.Precedence < Precedence(binOp) || (bin.Operator is ExponentOperator && binOp is ExponentOperator)))\n\t\t\t\t\t{\n\t\t\t\t\t\tbin = bRight;\n\t\t\t\t\t}\n\n\t\t\t\t\tbin.Right = new BinaryExpressionNode(binOp, bin.Right, right, nestLevel);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tleft = new BinaryExpressionNode(binOp, left, right, nestLevel);\n\t\t\t}\n\t\t\telse\n\t\t\t\tleft = new BinaryExpressionNode(binOp, left, right, nestLevel);\n\n\t\t\tnestLevel = nextNest;\n\t\t}\n\n\t\tif (nestLevel > 0)\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (isGroup)\n\t\t{\n\t\t\tif (ValueAccessor.TryParse(source, ref i, out valueAccessor))\n\t\t\t\tleft = new ValueAccessorExpressionNode(left, valueAccessor!);\n\n\t\t\tif (FunctionArgumentParser.TryParse(source, ref i, out functionArguments))\n\t\t\t\tleft = new FunctionExpressionNode(left, functionArguments!);\n\t\t}\n\n\t\tindex = i;\n\t\texpression = left;\n\t\treturn true;\n\t}\n\n}", + "snippet": "// parse right\n\t\t\tExpressionNode? right = null;\n\t\t\tforeach (var parser in _operandParsers)\n\t\t\t{\n\t\t\t\tif (parser.TryParse(source, ref i, out right)) break;\n\t\t\t}\n\n\t\t\tif (right == null)\n\t\t\t{\n\t\t\t\t// if we don't get a value, t" + }, + { + "title": "src/JsonE/Expressions/ExpressionSegment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/ExpressionSegment.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/ExpressionSegment.cs", + "startLine": 1, + "endLine": 32, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class ExpressionSegment : IContextAccessorSegment\n{\n\tprivate readonly ExpressionNode _expression;\n\n\tpublic ExpressionSegment(ExpressionNode expression)\n\t{\n\t\t_expression = expression;\n\t}\n\n\tpublic bool TryFind(JsonNode? contextValue, EvaluationContext fullContext, out JsonNode? value)\n\t{\n\t\tif (_expression.Evaluate(fullContext) is JsonValue evaluated)\n\t\t{\n\t\t\tif (evaluated.TryGetValue(out string? prop))\n\t\t\t\treturn PropertySegment.TryFind(prop, true, contextValue, out value);\n\t\t\tvar number = evaluated.GetNumber();\n\t\t\tif (number.HasValue)\n\t\t\t{\n\t\t\t\tvar index = (int)number;\n\t\t\t\tif (number == index)\n\t\t\t\t\treturn IndexSegment.TryFind(index, contextValue, out value);\n\t\t\t}\n\t\t}\n\n\t\tthrow new InterpreterException(\"object keys must be strings\");\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class ExpressionSegment : IContextAccessorSegment\n{\n\tprivate readonly ExpressionNode _expression;\n\n\tpublic ExpressionSegment(Exp" + }, + { + "title": "src/JsonE/Expressions/FunctionExpressionNode.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/FunctionExpressionNode.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/FunctionExpressionNode.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class FunctionExpressionNode : ExpressionNode\n{\n\tpublic ExpressionNode FunctionExpression { get; }\n\tpublic ExpressionNode[] Parameters { get; }\n\n\tpublic FunctionExpressionNode(ExpressionNode functionExpression, IEnumerable parameters)\n\t{\n\t\tFunctionExpression = functionExpression;\n\t\tParameters = parameters.ToArray();\n\t}\n\n\tpublic override JsonNode? Evaluate(EvaluationContext context)\n\t{\n\t\tif (FunctionExpression.Evaluate(context) is not JsonValue functionNode)\n\t\t\tthrow new InterpreterException($\"unknown context value \\\"{FunctionExpression}\\\"\");\n\t\tif (functionNode.TryGetValue(out string? functionName))\n\t\t\tfunctionNode = context.Find(functionName)!.AsValue();\n\t\tif (!functionNode.TryGetValue(out FunctionDefinition? function))\n\t\t\tthrow new InterpreterException($\"{functionNode} is not callable\");\n\n\t\tvar parameterValues = Parameters.Select(x => x.Evaluate(context)).ToArray();\n\n\t\treturn function.Invoke(parameterValues, context);\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\t//builder.Append(Function.Name);\n\t\tbuilder.Append('(');\n\n\t\tif (Parameters.Any())\n\t\t{\n\t\t\tParameters[0].BuildString(builder);\n\t\t\tfor (int i = 1; i < Parameters.Length; i++)\n\t\t\t{\n\t\t\t\tbuilder.Append(',');\n\t\t\t\tParameters[i].BuildString(builder);\n\t\t\t}\n\t\t}\n\n\t\tbuilder.Append(')');\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\tthrow new NotImplementedException();\n\t\t//var parameterList = string.Join(\", \", Parameters);\n\t\t//return $\"{Function.Name}({parameterList})\";\n\t}\n}\n\ninternal static class FunctionArgumentParser\n{\n\tpublic static bool TryParse(ReadOnlySpan source, ref int index, out List? arguments)\n\t{\n\t\tint i = index;\n\n\t\tif (!source.ConsumeWhitespace(ref i) || i == source.Length)\n\t\t{\n\t\t\targuments = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// consume (\n\t\tif (source[i] != '(')\n\t\t{\n\t\t\targuments = null;\n\t\t\treturn false;\n\t\t}\n\n\t\ti++;\n\n\t\t// parse list of arguments - all expressions\n\t\targuments = [];\n\t\tvar done = false;\n\n\t\twhile (i < source.Length && !done)\n\t\t{\n\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t{\n\t\t\t\targuments = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (source[i] == ')' && arguments.Count == 0)\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (!ExpressionParser.TryParse(source, ref i, out var expr))\n\t\t\t\tthrow new SyntaxException(CommonErrors.WrongToken(source[i]));\n\n\t\t\targuments.Add(expr!);\n\n\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t\tthrow new SyntaxException(CommonErrors.EndOfInput());\n\n\t\t\tswitch (source[i])\n\t\t\t{\n\t\t\t\tcase ')':\n\t\t\t\t\tdone = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase ',':\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\targuments = null;\n\t\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\ti++;", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class FunctionExpressionNode : " + }, + { + "title": "src/JsonE/Expressions/FunctionExpressionNode.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/FunctionExpressionNode.cs#L121-L126", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/FunctionExpressionNode.cs", + "startLine": 121, + "endLine": 126, + "content": "}\n\n\t\tindex = i;\n\t\treturn true;\n\t}\n}", + "snippet": "}\n\n\t\tindex = i;\n\t\treturn true;\n\t}\n}" + }, + { + "title": "src/JsonE/Expressions/Functions/AbsFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/AbsFunction.cs#L1-L21", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/AbsFunction.cs", + "startLine": 1, + "endLine": 21, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class AbsFunction : FunctionDefinition\n{\n\tprivate const string _name = \"abs\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tvar num = (arguments[0] as JsonValue)?.GetNumber();\n\t\tif (!num.HasValue)\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn Math.Abs(num.Value);\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class AbsFunction : FunctionDefinition\n{\n\tprivate const string _name = \"abs\"" + }, + { + "title": "src/JsonE/Expressions/Functions/CeilFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/CeilFunction.cs#L1-L20", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/CeilFunction.cs", + "startLine": 1, + "endLine": 20, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class CeilFunction : FunctionDefinition\n{\n\tprivate const string _name = \"ceil\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tvar num = (arguments[0] as JsonValue)?.GetNumber();\n\t\tif (!num.HasValue)\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn Math.Ceiling(num.Value);\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class CeilFunction : FunctionDefinition\n{\n\tprivate const string _name = \"cei" + }, + { + "title": "src/JsonE/Expressions/Functions/DefinedFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/DefinedFunction.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/DefinedFunction.cs", + "startLine": 1, + "endLine": 23, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class DefinedFunction : FunctionDefinition\n{\n\tprivate const string _name = \"defined\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments[0] is not JsonValue val || !val.TryGetValue(out string? str))\n\t\t\tthrow new InterpreterException(CommonErrors.IncorrectArgType(_name));\n\n\t\tvar i = 0;\n\t\tif (ContextAccessor.TryParse(str.AsSpan(), ref i, out var accessor))\n\t\t\treturn context.IsDefined(accessor!);\n\n\t\tthrow new InterpreterException($\"'{str}' is not a valid context accessor\");\n\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class DefinedFunction : FunctionDefinition\n{\n\tprivate const string _name = \"defined\";\n\n\tinter" + }, + { + "title": "src/JsonE/Expressions/Functions/FloorFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/FloorFunction.cs#L1-L20", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/FloorFunction.cs", + "startLine": 1, + "endLine": 20, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class FloorFunction : FunctionDefinition\n{\n\tprivate const string _name = \"floor\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tvar num = (arguments[0] as JsonValue)?.GetNumber();\n\t\tif (!num.HasValue)\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn Math.Floor(num.Value);\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class FloorFunction : FunctionDefinition\n{\n\tprivate const string _name = \"fl" + }, + { + "title": "src/JsonE/Expressions/Functions/FromNowFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/FromNowFunction.cs#L1-L40", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/FromNowFunction.cs", + "startLine": 1, + "endLine": 40, + "content": "using System;\nusing System.Globalization;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class FromNowFunction : FunctionDefinition\n{\n\tprivate const string _name = \"fromNow\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments[0] is not JsonValue val || !val.TryGetValue(out string? str))\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\tstring? argNowStr = null;\n\t\tif (arguments.Length == 2 && (arguments[1] is not JsonValue argNowNode ||\n\t\t\t\t\t\t\t\t\t !argNowNode.TryGetValue(out argNowStr)))\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\tDateTime now;\n\t\tvar interval = Interval.Parse(str);\n\t\tif (argNowStr != null)\n\t\t{\n\t\t\tif (!DateTime.TryParse(argNowStr, out now))\n\t\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar nowNode = context.Find(ContextAccessor.Now);\n\t\t\tif (nowNode is not JsonValue nowVal ||\n\t\t\t\t!nowVal.TryGetValue(out str) ||\n\t\t\t\t!DateTime.TryParse(str, out now))\n\t\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\t\t}\n\n\t\treturn interval.AddTo(now.ToUniversalTime()).ToString(\"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'FFFFFFFK\", CultureInfo.InvariantCulture);\n\t}\n}", + "snippet": "using System;\nusing System.Globalization;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class FromNowFunction : FunctionDefinition\n{\n\tprivate const strin" + }, + { + "title": "src/JsonE/Expressions/Functions/Interval.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/Interval.cs#L1-L60", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/Interval.cs", + "startLine": 1, + "endLine": 60, + "content": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal struct Interval\n{\n\tprivate static readonly Regex _format =\n\t\tnew(@\"^((?-)|\\+)?\\s*((?\\d+)\\s*(y|yr|years?))?\\s*((?\\d+)\\s*(mo|months?))?\\s*((?\\d+)\\s*(w|wk|weeks?))?\\s*((?\\d+)\\s*(d|days?))?\\s*((?\\d+)\\s*(h|hr|hours?))?\\s*((?\\d+)\\s*(m|min|minutes?))?\\s*((?\\d+)\\s*(s|sec|seconds?))?$\",\n\t\tRegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);\n\n\tpublic static Interval Zero = new();\n\n\tpublic bool IsNegative { get; private set; }\n\tpublic int Years { get; private set; }\n\tpublic int Months { get; private set; }\n\tpublic int Weeks { get; private set; }\n\tpublic int Days { get; private set; }\n\tpublic int Hours { get; private set; }\n\tpublic int Minutes { get; private set; }\n\tpublic int Seconds { get; private set; }\n\n\tpublic static Interval Parse(string source)\n\t{\n\t\tif (string.IsNullOrWhiteSpace(source)) return Zero;\n\n\t\tvar match = _format.Match(source);\n\t\tif (!match.Success)\n\t\t\tthrow new TemplateException(\"$fromNow expects a string\");\n\n\t\tvar interval = new Interval\n\t\t{\n\t\t\tIsNegative = match.Groups[\"neg\"].Captures.Count != 0,\n\t\t\tYears = match.Groups[\"year\"].Success ? int.Parse(match.Groups[\"year\"].Value) : 0,\n\t\t\tMonths = match.Groups[\"month\"].Success ? int.Parse(match.Groups[\"month\"].Value) : 0,\n\t\t\tWeeks = match.Groups[\"week\"].Success ? int.Parse(match.Groups[\"week\"].Value) : 0,\n\t\t\tDays = match.Groups[\"day\"].Success ? int.Parse(match.Groups[\"day\"].Value) : 0,\n\t\t\tHours = match.Groups[\"hour\"].Success ? int.Parse(match.Groups[\"hour\"].Value) : 0,\n\t\t\tMinutes = match.Groups[\"minute\"].Success ? int.Parse(match.Groups[\"minute\"].Value) : 0,\n\t\t\tSeconds = match.Groups[\"second\"].Success ? int.Parse(match.Groups[\"second\"].Value) : 0\n\t\t};\n\n\t\treturn interval;\n\t}\n\n\tpublic DateTime AddTo(DateTime basis)\n\t{\n\t\tvar totalDays = Years * GetYearLength(basis.Year) +\n\t\t\t\t\t\tMonths * 30 + // See https://github.com/json-e/json-e/issues/487\n\t\t\t\t\t\tWeeks * 7 +\n\t\t\t\t\t\tDays;\n\n\t\tvar timeSpan = new TimeSpan(totalDays, Hours, Minutes, Seconds);\n\t\tif (IsNegative) timeSpan = -timeSpan;\n\n\t\treturn basis.Add(timeSpan);\n\t}\n\n\tprivate static int GetYearLength(int year) => year % 4 == 0 && year % 400 != 0 ? 366 : 365;\n}", + "snippet": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal struct Interval\n{\n\tprivate static readonly Regex _format =\n\t\tnew(@\"^((?-)|\\+)?\\s*((?\\d+)\\s*(y|yr|years" + }, + { + "title": "src/JsonE/Expressions/Functions/JoinFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/JoinFunction.cs#L1-L40", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/JoinFunction.cs", + "startLine": 1, + "endLine": 40, + "content": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class JoinFunction : FunctionDefinition\n{\n\tprivate const string _name = \"join\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments[0] is not JsonArray arr)\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\tif (arguments[1] is not JsonValue v)\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\t\tvar separator = v.GetNumber()?.ToString();\n\t\tif (separator == null && !v.TryGetValue(out separator))\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\tvar parts = arr.Select(x =>\n\t\t{\n\t\t\tif (x is not JsonValue val)\n\t\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\t\tvar num = val.GetNumber();\n\t\t\tif (num.HasValue) return num.ToString();\n\n\t\t\tif (val.TryGetValue(out string? str)) return str;\n\n\t\t\tif (val.TryGetValue(out bool b)) return b.ToString().ToLowerInvariant();\n\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\t\t});\n\n\t\treturn string.Join(separator, parts);\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class JoinFunction : FunctionDefinition\n{\n\tprivate const string _name =" + }, + { + "title": "src/JsonE/Expressions/Functions/LenFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/LenFunction.cs#L1-L20", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/LenFunction.cs", + "startLine": 1, + "endLine": 20, + "content": "using System.Globalization;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class LenFunction : FunctionDefinition\n{\n\tprivate const string _name = \"len\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tvar arg = arguments[0];\n\n\t\tif (arg is JsonArray arr) return arr.Count;\n\t\tif (arg is JsonValue val && val.TryGetValue(out string? str)) return new StringInfo(str).LengthInTextElements;\n\n\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\t}\n}", + "snippet": "using System.Globalization;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class LenFunction : FunctionDefinition\n{\n\tprivate const string _name = \"len\";\n\n" + }, + { + "title": "src/JsonE/Expressions/Functions/LowercaseFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/LowercaseFunction.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/LowercaseFunction.cs", + "startLine": 1, + "endLine": 17, + "content": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class LowercaseFunction : FunctionDefinition\n{\n\tprivate const string _name = \"lowercase\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments[0] is not JsonValue val || !val.TryGetValue(out string? str))\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn str.ToLowerInvariant();\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class LowercaseFunction : FunctionDefinition\n{\n\tprivate const string _name = \"lowercase\";\n\n\tinternal overri" + }, + { + "title": "src/JsonE/Expressions/Functions/LStripFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/LStripFunction.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/LStripFunction.cs", + "startLine": 1, + "endLine": 17, + "content": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class LStripFunction : FunctionDefinition\n{\n\tprivate const string _name = \"lstrip\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments[0] is not JsonValue val || !val.TryGetValue(out string? str))\n\t\t\tthrow new InterpreterException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn str.TrimStart();\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class LStripFunction : FunctionDefinition\n{\n\tprivate const string _name = \"lstrip\";\n\n\tinternal override Jso" + }, + { + "title": "src/JsonE/Expressions/Functions/MaxFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/MaxFunction.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/MaxFunction.cs", + "startLine": 1, + "endLine": 23, + "content": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class MaxFunction : FunctionDefinition\n{\n\tprivate const string _name = \"max\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments.Length == 0)\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name, \"expected at least 1 arguments\"));\n\n\t\tvar nums = arguments.Select(x => (x as JsonValue)?.GetNumber()).ToArray();\n\t\tif (nums.Any(x => !x.HasValue))\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn nums.Max();\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class MaxFunction : FunctionDefinition\n{\n\tprivate const string _name = " + }, + { + "title": "src/JsonE/Expressions/Functions/MinFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/MinFunction.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/MinFunction.cs", + "startLine": 1, + "endLine": 23, + "content": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class MinFunction : FunctionDefinition\n{\n\tprivate const string _name = \"min\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments.Length == 0)\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name, \"expected at least 1 arguments\"));\n\n\t\tvar nums = arguments.Select(x => (x as JsonValue)?.GetNumber()).ToArray();\n\t\tif (nums.Any(x => !x.HasValue))\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn nums.Min();\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class MinFunction : FunctionDefinition\n{\n\tprivate const string _name = " + }, + { + "title": "src/JsonE/Expressions/Functions/NumberFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/NumberFunction.cs#L1-L19", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/NumberFunction.cs", + "startLine": 1, + "endLine": 19, + "content": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class NumberFunction : FunctionDefinition\n{\n\tprivate const string _name = \"number\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments[0] is not JsonValue val || !val.TryGetValue(out string? str))\n\t\t\tthrow new InterpreterException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn decimal.TryParse(str, out var d)\n\t\t\t? d\n\t\t\t: throw new TemplateException(\"not a number\");\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class NumberFunction : FunctionDefinition\n{\n\tprivate const string _name = \"number\";\n\n\tinternal override Jso" + }, + { + "title": "src/JsonE/Expressions/Functions/RangeFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/RangeFunction.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/RangeFunction.cs", + "startLine": 1, + "endLine": 38, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class RangeFunction : FunctionDefinition\n{\n\tprivate const string _name = \"range\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\t// we store decimals, but we need to ensure they're also integer values for this function\n\t\tif (arguments[0] is not JsonValue valStart || !valStart.TryGetValue(out decimal? start) ||\n\t\t (int)start.Value != start.Value)\n\t\t\tthrow new InterpreterException(CommonErrors.IncorrectArgType(_name));\n\t\tif (arguments[1] is not JsonValue valEnd || !valEnd.TryGetValue(out decimal? end) ||\n\t\t (int)end.Value != end.Value)\n\t\t\tthrow new InterpreterException(CommonErrors.IncorrectArgType(_name));\n\t\tdecimal? step = null;\n\t\tif (arguments.Length > 2 && (arguments[2] is not JsonValue valStep || !valStep.TryGetValue(out step) ||\n\t\t (int)step.Value != step.Value || step.Value == 0))\n\t\t\tthrow new InterpreterException(CommonErrors.IncorrectArgType(_name));\n\t\tstep ??= 1;\n\t\tvar direction = Math.Sign(step.Value);\n\n\t\tvar values = new List();\n\t\tfor (var i = start.Value * direction; i < end * direction; i += step.Value * direction)\n\t\t{\n\t\t\tvalues.Add(i * direction);\n\t\t}\n\n\t\treturn values.Select(x => (JsonNode)x).ToJsonArray();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class RangeFunction : F" + }, + { + "title": "src/JsonE/Expressions/Functions/RStripFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/RStripFunction.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/RStripFunction.cs", + "startLine": 1, + "endLine": 17, + "content": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class RStripFunction : FunctionDefinition\n{\n\tprivate const string _name = \"rstrip\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments[0] is not JsonValue val || !val.TryGetValue(out string? str))\n\t\t\tthrow new InterpreterException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn str.TrimEnd();\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class RStripFunction : FunctionDefinition\n{\n\tprivate const string _name = \"rstrip\";\n\n\tinternal override Jso" + }, + { + "title": "src/JsonE/Expressions/Functions/SplitFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/SplitFunction.cs#L1-L31", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/SplitFunction.cs", + "startLine": 1, + "endLine": 31, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class SplitFunction : FunctionDefinition\n{\n\tprivate const string _name = \"split\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments[0] is not JsonValue val1 || !val1.TryGetValue(out string? source))\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\t\tif (arguments[1] is not JsonValue val2)\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\t\tstring? split;\n\t\tvar num = val2.GetNumber();\n\t\tif (num.HasValue)\n\t\t\tsplit = num.ToString();\n\t\telse if (!val2.TryGetValue(out split))\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\tif (split is null) return source;\n\t\tif (split == string.Empty) return source.Select(x => (JsonNode?)x).ToJsonArray();\n\n\t\treturn source.Split(new []{split!}, StringSplitOptions.None).Select(x => (JsonNode?)x).ToJsonArray();\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class SplitFunction : FunctionDefinition\n{\n\tprivate const" + }, + { + "title": "src/JsonE/Expressions/Functions/SqrtFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/SqrtFunction.cs#L1-L20", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/SqrtFunction.cs", + "startLine": 1, + "endLine": 20, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class SqrtFunction : FunctionDefinition\n{\n\tprivate const string _name = \"sqrt\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tvar num = (arguments[0] as JsonValue)?.GetNumber();\n\t\tif (!num.HasValue)\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn (decimal)Math.Sqrt((double)num.Value);\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class SqrtFunction : FunctionDefinition\n{\n\tprivate const string _name = \"sqr" + }, + { + "title": "src/JsonE/Expressions/Functions/StrFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/StrFunction.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/StrFunction.cs", + "startLine": 1, + "endLine": 27, + "content": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class StrFunction : FunctionDefinition\n{\n\tprivate const string _name = \"str\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments[0] is null) return \"null\";\n\n\t\tif (arguments[0] is not JsonValue val)\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\tif (val.TryGetValue(out string? str)) return str;\n\t\tif (val.TryGetValue(out bool b)) return b ? \"true\" : \"false\";\n\n\t\tvar num = val.GetNumber();\n\t\tif (!num.HasValue)\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn num.ToString();\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class StrFunction : FunctionDefinition\n{\n\tprivate const string _name = \"str\";\n\n\tinternal o" + }, + { + "title": "src/JsonE/Expressions/Functions/StripFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/StripFunction.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/StripFunction.cs", + "startLine": 1, + "endLine": 17, + "content": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class StripFunction : FunctionDefinition\n{\n\tprivate const string _name = \"strip\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments[0] is not JsonValue val || !val.TryGetValue(out string? str))\n\t\t\tthrow new InterpreterException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn str.Trim();\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class StripFunction : FunctionDefinition\n{\n\tprivate const string _name = \"strip\";\n\n\tinternal override JsonN" + }, + { + "title": "src/JsonE/Expressions/Functions/TypeOfFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/TypeOfFunction.cs#L1-L34", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/TypeOfFunction.cs", + "startLine": 1, + "endLine": 34, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class TypeOfFunction : FunctionDefinition\n{\n\t// I explicitly want this for consistency and code-doc\n\t// ReSharper disable once UnusedMember.Local\n#pragma warning disable IDE0051 // Remove unused private members\n\tprivate const string _name = \"typeof\";\n#pragma warning restore IDE0051 // Remove unused private members\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tswitch (arguments[0])\n\t\t{\n\t\t\tcase null:\n\t\t\t\treturn \"null\";\n\t\t\tcase JsonObject:\n\t\t\t\treturn \"object\";\n\t\t\tcase JsonArray:\n\t\t\t\treturn \"array\";\n\t\t\tcase JsonValue val:\n\t\t\t\tif (val.GetNumber().HasValue) return \"number\";\n\t\t\t\tif (val.TryGetValue(out _)) return \"string\";\n\t\t\t\tif (val.TryGetValue(out _)) return \"boolean\";\n\t\t\t\tif (val.TryGetValue(out _)) return \"function\";\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthrow new InterpreterException(\"this shouldn't happen\");\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class TypeOfFunction : FunctionDefinition\n{\n\t// I explicitly want this for consistency and code-doc\n\t// ReSharper disa" + }, + { + "title": "src/JsonE/Expressions/Functions/UppercaseFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Functions/UppercaseFunction.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Functions/UppercaseFunction.cs", + "startLine": 1, + "endLine": 17, + "content": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class UppercaseFunction : FunctionDefinition\n{\n\tprivate const string _name = \"uppercase\";\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\tif (arguments[0] is not JsonValue val || !val.TryGetValue(out string? str))\n\t\t\tthrow new BuiltInException(CommonErrors.IncorrectArgType(_name));\n\n\t\treturn str.ToUpperInvariant();\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions.Functions;\n\ninternal class UppercaseFunction : FunctionDefinition\n{\n\tprivate const string _name = \"uppercase\";\n\n\tinternal overri" + }, + { + "title": "src/JsonE/Expressions/IContextAccessorSegment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/IContextAccessorSegment.cs#L1-L8", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/IContextAccessorSegment.cs", + "startLine": 1, + "endLine": 8, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal interface IContextAccessorSegment\n{\n\tbool TryFind(JsonNode? contextValue, EvaluationContext fullContext, out JsonNode? value);\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal interface IContextAccessorSegment\n{\n\tbool TryFind(JsonNode? contextValue, EvaluationContext fullContext, out JsonNode? value);\n}" + }, + { + "title": "src/JsonE/Expressions/IndexSegment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/IndexSegment.cs#L1-L73", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/IndexSegment.cs", + "startLine": 1, + "endLine": 73, + "content": "using System.Globalization;\nusing System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class IndexSegment : IContextAccessorSegment\n{\n\tprivate readonly int _index;\n\n\tpublic IndexSegment(int index)\n\t{\n\t\t_index = index;\n\t}\n\n\tpublic bool TryFind(JsonNode? contextValue, EvaluationContext fullContext, out JsonNode? value)\n\t{\n\t\treturn TryFind(_index, contextValue, out value);\n\t}\n\n\tpublic static bool TryFind(int index, JsonNode? contextValue, out JsonNode? value)\n\t{\n\t\tif (contextValue is JsonArray arr)\n\t\t{\n\t\t\tif (index < 0)\n\t\t\t{\n\t\t\t\tif (-index <= arr.Count)\n\t\t\t\t{\n\t\t\t\t\tvalue = arr[arr.Count + index];\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tthrow new InterpreterException(\"index out of bounds\");\n\t\t\t}\n\t\t\t\n\t\t\tif (index < arr.Count)\n\t\t\t{\n\t\t\t\tvalue = arr[index];\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tthrow new InterpreterException(\"index out of bounds\");\n\t\t}\n\t\t\n\t\tif (contextValue is JsonValue val && val.TryGetValue(out string? str))\n\t\t{\n\t\t\tvar stringInfo = new StringInfo(str);\n\n\t\t\tif (index < 0)\n\t\t\t{\n\t\t\t\tif (-index < str.Length)\n\t\t\t\t{\n\t\t\t\t\tvalue = stringInfo.SubstringByTextElements(stringInfo.LengthInTextElements + index, 1);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\n\t\t\t\tthrow new InterpreterException(\"index out of bounds\");\n\t\t\t}\n\t\t\t\n\t\t\tif (index < str.Length)\n\t\t\t{\n\t\t\t\tvalue = stringInfo.SubstringByTextElements(index, 1);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\n\t\t\tthrow new InterpreterException(\"index out of bounds\");\n\t\t}\n\n\t\tif (contextValue is JsonObject)\n\t\t\tthrow new InterpreterException(\"object keys must be strings\");\n\n\t\tthrow new InterpreterException(\"infix: \\\"[..]\\\" expects object, array, or string\");\n\t}\n}", + "snippet": "using System.Globalization;\nusing System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class IndexSegment : IContextAccessorSegment\n{\n\tprivate readonly int _index;\n\n\tpublic IndexSegment(int index)\n\t{\n\t\t_i" + }, + { + "title": "src/JsonE/Expressions/IOperandExpressionParser.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/IOperandExpressionParser.cs#L1-L8", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/IOperandExpressionParser.cs", + "startLine": 1, + "endLine": 8, + "content": "using System;\n\nnamespace Json.JsonE.Expressions;\n\ninternal interface IOperandExpressionParser\n{\n\tbool TryParse(ReadOnlySpan source, ref int index, out ExpressionNode? expression);\n}", + "snippet": "using System;\n\nnamespace Json.JsonE.Expressions;\n\ninternal interface IOperandExpressionParser\n{\n\tbool TryParse(ReadOnlySpan source, ref int index, out ExpressionNode? expression);\n}" + }, + { + "title": "src/JsonE/Expressions/JsonExpression.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/JsonExpression.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/JsonExpression.cs", + "startLine": 1, + "endLine": 23, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class JsonExpression\n{\n\tpublic ExpressionNode Expression { get; }\n\n\tprivate JsonExpression(ExpressionNode expression)\n\t{\n\t\tExpression = expression;\n\t}\n\n\tpublic static JsonExpression Create(ExpressionNode expression)\n\t{\n\t\treturn new JsonExpression(expression);\n\t}\n\n\tpublic static implicit operator JsonValue(JsonExpression expression)\n\t{\n\t\treturn JsonValue.Create(expression, JsonESerializerContext.Default.JsonExpression)!;\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class JsonExpression\n{\n\tpublic ExpressionNode Expression { get; }\n\n\tprivate JsonExpression(ExpressionNode expression)\n\t{\n\t\tExpression = expressio" + }, + { + "title": "src/JsonE/Expressions/ObjectExpressionNode.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/ObjectExpressionNode.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/ObjectExpressionNode.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class ObjectExpressionNode : ExpressionNode\n{\n\tpublic JsonObject Value { get; }\n\n\tpublic ObjectExpressionNode(JsonObject value)\n\t{\n\t\tValue = value;\n\t}\n\n\tpublic override JsonNode? Evaluate(EvaluationContext context)\n\t{\n\t\treturn JsonE.Evaluate(Value, context);\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append(Value.AsJsonString());\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn Value.AsJsonString();\n\t}\n}\n\ninternal class ObjectExpressionParser : IOperandExpressionParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, out ExpressionNode? expression)\n\t{\n\t\tif (source[index] != '{')\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// consume {\n\t\tint i = index + 1;\n\t\tvar obj = new JsonObject();\n\t\tvar done = false;\n\n\t\twhile (i < source.Length)\n\t\t{\n\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t\tthrow new SyntaxException(CommonErrors.EndOfInput());\n\n\t\t\t// read name\n\t\t\tif (!TryParseString(source, ref i, out var key))\n\t\t\t{\n\t\t\t\tif (source[i] is '}')\n\t\t\t\t{\n\t\t\t\t\tdone = true;\n\t\t\t\t\ti++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\texpression = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t\tthrow new SyntaxException(CommonErrors.EndOfInput());\n\n\t\t\t// read :\n\t\t\tif (source[i] != ':')\n\t\t\t{\n\t\t\t\texpression = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\ti++;\n\n\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t\tthrow new SyntaxException(CommonErrors.EndOfInput());\n\n\t\t\t// read expression\n\t\t\tif (!ExpressionParser.TryParse(source, ref i, out var value))\n\t\t\t\tthrow new SyntaxException(CommonErrors.WrongToken(source[i]));\n\n\t\t\tobj[key!] = JsonExpression.Create(value!);\n\n\t\t\t// read , or }\n\t\t\tif (source[i] is ',')\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (source[i] is '}')\n\t\t\t{\n\t\t\t\tdone = true;\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tthrow new SyntaxException(CommonErrors.WrongToken(source[i]));\n\t\t}\n\n\t\tif (!done) throw new SyntaxException(CommonErrors.EndOfInput());\n\n\t\tif (obj.Count == 0 && source[i] == '}')\n\t\t\ti++;\n\n\t\tindex = i;\n\t\texpression = new ObjectExpressionNode(obj);\n\t\treturn true;\n\t}\n\n\tprivate static bool TryParseString(ReadOnlySpan source, ref int index, out string? str)\n\t{\n\t\tvar i = index;\n\t\tchar? quoteChar = source[i] is ('\\'' or '\"') ? source[i] : null;\n\n\t\tif (!quoteChar.HasValue) return source.TryParseName(ref index, out str);", + "snippet": "using System;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class ObjectExpressionNode : ExpressionNode\n{\n\tpublic JsonObject Va" + }, + { + "title": "src/JsonE/Expressions/ObjectExpressionNode.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/ObjectExpressionNode.cs#L121-L139", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/ObjectExpressionNode.cs", + "startLine": 121, + "endLine": 139, + "content": "i++;\n\t\twhile (i < source.Length && source[i] != quoteChar)\n\t\t{\n\t\t\ti++;\n\t\t}\n\n\t\tif (i == source.Length)\n\t\t{\n\t\t\tstr = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tstr = source[(index + 1)..i].ToString();\n\t\tindex = i + 1; // consume quote\n\t\treturn true;\n\n\t}\n}", + "snippet": "i++;\n\t\twhile (i < source.Length && source[i] != quoteChar)\n\t\t{\n\t\t\ti++;\n\t\t}\n\n\t\tif (i == source.Length)\n\t\t{\n\t\t\tstr = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tstr = source[(index + 1)..i].ToString();\n\t\tindex = i + 1; // consume quote\n" + }, + { + "title": "src/JsonE/Expressions/Operators/AddOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/AddOperator.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/AddOperator.cs", + "startLine": 1, + "endLine": 30, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class AddOperator : IBinaryOperator\n{\n\tpublic int Precedence => 5;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\tif (left is not JsonValue lValue ||\n\t\t\tright is not JsonValue rValue)\n\t\t\tthrow new InterpreterException(\"infix: + expects numbers/strings + numbers/strings\");\n\n\t\tif (lValue.TryGetValue(out string? leftString) &&\n\t\t\trValue.TryGetValue(out string? rightString))\n\t\t\treturn leftString + rightString;\n\n\t\tvar lNumber = lValue.GetNumber() ?? throw new InterpreterException(\"infix: + expects numbers/strings + numbers/strings\");\n\t\tvar rNumber = rValue.GetNumber() ?? throw new InterpreterException(\"infix: + expects numbers/strings + numbers/strings\");\n\n\t\treturn lNumber + rNumber;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"+\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class AddOperator : IBinaryOperator\n{\n\tpublic int Precedence => 5;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNod" + }, + { + "title": "src/JsonE/Expressions/Operators/AndOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/AndOperator.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/AndOperator.cs", + "startLine": 1, + "endLine": 26, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class AndOperator : IShortcuttingBinaryOperator\n{\n\tpublic int Precedence => 1;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\treturn left.IsTruthy() && right.IsTruthy();\n\t}\n\n\tpublic bool ShouldContinue(JsonNode? left, out JsonNode? result)\n\t{\n\t\tvar isTruthy = left.IsTruthy();\n\t\tresult = isTruthy;\n\t\t// if result is false, then don't continue\n\t\treturn isTruthy;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"&&\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class AndOperator : IShortcuttingBinaryOperator\n{\n\tpublic int Precedence => 1;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? ri" + }, + { + "title": "src/JsonE/Expressions/Operators/DivideOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/DivideOperator.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/DivideOperator.cs", + "startLine": 1, + "endLine": 28, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class DivideOperator : IBinaryOperator\n{\n\tpublic int Precedence => 6;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\tif (left is not JsonValue lValue ||\n\t\t\tright is not JsonValue rValue)\n\t\t\tthrow new InterpreterException(\"infix: / expects number / number\");\n\n\t\tvar lNumber = lValue.GetNumber() ?? throw new InterpreterException(\"infix: / expects number / number\");\n\t\tvar rNumber = rValue.GetNumber() ?? throw new InterpreterException(\"infix: / expects number / number\");\n\n\t\treturn rNumber == 0\n\t\t\t? throw new InterpreterException(\"divide by zero\")\n\t\t\t: (JsonNode?)(lNumber / rNumber);\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"/\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class DivideOperator : IBinaryOperator\n{\n\tpublic int Precedence => 6;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, Json" + }, + { + "title": "src/JsonE/Expressions/Operators/EqualToOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/EqualToOperator.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/EqualToOperator.cs", + "startLine": 1, + "endLine": 24, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class EqualToOperator : IBinaryOperator\n{\n\tpublic int Precedence => 3;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\tif (left is JsonValue lVal && right is JsonValue rVal &&\n\t\t lVal.TryGetValue(out FunctionDefinition? lFunc) &&\n\t\t rVal.TryGetValue(out FunctionDefinition? rFunc))\n\t\t\treturn ReferenceEquals(lFunc, rFunc);\n\n\t\treturn left.IsEquivalentTo(right);\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"==\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class EqualToOperator : IBinaryOperator\n{\n\tpublic int Precedence => 3;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, Jso" + }, + { + "title": "src/JsonE/Expressions/Operators/ExponentOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/ExponentOperator.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/ExponentOperator.cs", + "startLine": 1, + "endLine": 27, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class ExponentOperator : IBinaryOperator\n{\n\tpublic int Precedence => 7;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\tif (left is not JsonValue lValue ||\n\t\t\tright is not JsonValue rValue)\n\t\t\tthrow new InterpreterException(\"infix: ** expects number ** number\");\n\n\t\tvar lNumber = (double?)lValue.GetNumber() ?? throw new InterpreterException(\"infix: ** expects number ** number\");\n\t\tvar rNumber = (double?)rValue.GetNumber() ?? throw new InterpreterException(\"infix: ** expects number ** number\");\n\n\t\treturn (decimal)Math.Pow(lNumber, rNumber);\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"**\";\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class ExponentOperator : IBinaryOperator\n{\n\tpublic int Precedence => 7;\n\n\tpublic JsonNode? Evaluate(Json" + }, + { + "title": "src/JsonE/Expressions/Operators/GreaterThanOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/GreaterThanOperator.cs#L1-L31", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/GreaterThanOperator.cs", + "startLine": 1, + "endLine": 31, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class GreaterThanOperator : IBinaryOperator\n{\n\tpublic int Precedence => 3;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\tif (left is not JsonValue lValue ||\n\t\t\tright is not JsonValue rValue)\n\t\t\tthrow new InterpreterException(\"infix: > expects numbers/strings > numbers/strings\");\n\n\t\tif (lValue.TryGetValue(out string? leftString) &&\n\t\t\trValue.TryGetValue(out string? rightString))\n\t\t\treturn string.Compare(leftString, rightString, StringComparison.Ordinal) > 0;\n\n\t\tvar lNumber = lValue.GetNumber() ?? throw new InterpreterException(\"infix: > expects numbers/strings > numbers/strings\");\n\t\tvar rNumber = rValue.GetNumber() ?? throw new InterpreterException(\"infix: > expects numbers/strings > numbers/strings\");\n\n\t\treturn lNumber > rNumber;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \">\";\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class GreaterThanOperator : IBinaryOperator\n{\n\tpublic int Precedence => 3;\n\n\tpublic JsonNode? Evaluate(J" + }, + { + "title": "src/JsonE/Expressions/Operators/GreaterThanOrEqualToOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/GreaterThanOrEqualToOperator.cs#L1-L31", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/GreaterThanOrEqualToOperator.cs", + "startLine": 1, + "endLine": 31, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class GreaterThanOrEqualToOperator : IBinaryOperator\n{\n\tpublic int Precedence => 3;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\tif (left is not JsonValue lValue ||\n\t\t\tright is not JsonValue rValue)\n\t\t\tthrow new InterpreterException(\"infix: >= expects numbers/strings >= numbers/strings\");\n\n\t\tif (lValue.TryGetValue(out string? leftString) &&\n\t\t\trValue.TryGetValue(out string? rightString))\n\t\t\treturn string.Compare(leftString, rightString, StringComparison.Ordinal) >= 0;\n\n\t\tvar lNumber = lValue.GetNumber() ?? throw new InterpreterException(\"infix: >= expects numbers/strings >= numbers/strings\");\n\t\tvar rNumber = rValue.GetNumber() ?? throw new InterpreterException(\"infix: >= expects numbers/strings >= numbers/strings\");\n\n\t\treturn lNumber >= rNumber;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \">=\";\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class GreaterThanOrEqualToOperator : IBinaryOperator\n{\n\tpublic int Precedence => 3;\n\n\tpublic JsonNode? E" + }, + { + "title": "src/JsonE/Expressions/Operators/IBinaryOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/IBinaryOperator.cs#L1-L13", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/IBinaryOperator.cs", + "startLine": 1, + "endLine": 13, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal interface IBinaryOperator : IExpressionOperator\n{\n\tJsonNode? Evaluate(JsonNode? left, JsonNode? right);\n}\n\ninternal interface IShortcuttingBinaryOperator : IBinaryOperator\n{\n\tbool ShouldContinue(JsonNode? left, out JsonNode? result);\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal interface IBinaryOperator : IExpressionOperator\n{\n\tJsonNode? Evaluate(JsonNode? left, JsonNode? right);\n}\n\ninternal interface IShortcut" + }, + { + "title": "src/JsonE/Expressions/Operators/IExpressionOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/IExpressionOperator.cs#L1-L6", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/IExpressionOperator.cs", + "startLine": 1, + "endLine": 6, + "content": "namespace Json.JsonE.Expressions.Operators;\n\ninternal interface IExpressionOperator\n{\n\tint Precedence { get; }\n}", + "snippet": "namespace Json.JsonE.Expressions.Operators;\n\ninternal interface IExpressionOperator\n{\n\tint Precedence { get; }\n}" + }, + { + "title": "src/JsonE/Expressions/Operators/InOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/InOperator.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/InOperator.cs", + "startLine": 1, + "endLine": 32, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class InOperator : IBinaryOperator\n{\n\tpublic int Precedence => 4;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\treturn right switch\n\t\t{\n\t\t\tJsonArray arr => arr.Contains(left, JsonNodeEqualityComparer.Instance),\n\t\t\tJsonObject obj => left is JsonValue val && val.TryGetValue(out string? key)\n\t\t\t\t? obj.Any(x => string.Equals(key, x.Key, StringComparison.Ordinal))\n\t\t\t\t: throw new InterpreterException(\"only strings can be found in objects\"),\n\t\t\tJsonValue vRight when vRight.TryGetValue(out string? sRight) &&\n\t\t\t\t\t\t\t\t left is JsonValue vLeft &&\n\t\t\t\t\t\t\t\t vLeft.TryGetValue(out string? sLeft) => sRight.Contains(sLeft),\n\t\t\t_ => throw new BuiltInException(CommonErrors.IncorrectArgType(\"in\"))\n\t\t};\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \" in \";\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class InOperator : IBinaryOperator\n{\n\tpublic int Preceden" + }, + { + "title": "src/JsonE/Expressions/Operators/IUnaryLogicalOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/IUnaryLogicalOperator.cs#L1-L8", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/IUnaryLogicalOperator.cs", + "startLine": 1, + "endLine": 8, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal interface IUnaryOperator : IExpressionOperator\n{\n\tJsonNode? Evaluate(JsonNode? node);\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal interface IUnaryOperator : IExpressionOperator\n{\n\tJsonNode? Evaluate(JsonNode? node);\n}" + }, + { + "title": "src/JsonE/Expressions/Operators/LessThanOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/LessThanOperator.cs#L1-L31", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/LessThanOperator.cs", + "startLine": 1, + "endLine": 31, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class LessThanOperator : IBinaryOperator\n{\n\tpublic int Precedence => 3;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\tif (left is not JsonValue lValue ||\n\t\t\tright is not JsonValue rValue)\n\t\t\tthrow new InterpreterException(\"infix: < expects numbers/strings < numbers/strings\");\n\n\t\tif (lValue.TryGetValue(out string? leftString) &&\n\t\t\trValue.TryGetValue(out string? rightString))\n\t\t\treturn string.Compare(leftString, rightString, StringComparison.Ordinal) < 0;\n\n\t\tvar lNumber = lValue.GetNumber() ?? throw new InterpreterException(\"infix: < expects numbers/strings < numbers/strings\");\n\t\tvar rNumber = rValue.GetNumber() ?? throw new InterpreterException(\"infix: < expects numbers/strings < numbers/strings\");\n\n\t\treturn lNumber < rNumber;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"<\";\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class LessThanOperator : IBinaryOperator\n{\n\tpublic int Precedence => 3;\n\n\tpublic JsonNode? Evaluate(Json" + }, + { + "title": "src/JsonE/Expressions/Operators/LessThanOrEqualToOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/LessThanOrEqualToOperator.cs#L1-L31", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/LessThanOrEqualToOperator.cs", + "startLine": 1, + "endLine": 31, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class LessThanOrEqualToOperator : IBinaryOperator\n{\n\tpublic int Precedence => 3;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\tif (left is not JsonValue lValue ||\n\t\t\tright is not JsonValue rValue)\n\t\t\tthrow new InterpreterException(\"infix: <= expects numbers/strings <= numbers/strings\");\n\n\t\tif (lValue.TryGetValue(out string? leftString) &&\n\t\t\trValue.TryGetValue(out string? rightString))\n\t\t\treturn string.Compare(leftString, rightString, StringComparison.Ordinal) <= 0;\n\n\t\tvar lNumber = lValue.GetNumber() ?? throw new InterpreterException(\"infix: <= expects numbers/strings <= numbers/strings\");\n\t\tvar rNumber = rValue.GetNumber() ?? throw new InterpreterException(\"infix: <= expects numbers/strings <= numbers/strings\");\n\n\t\treturn lNumber <= rNumber;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"<=\";\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class LessThanOrEqualToOperator : IBinaryOperator\n{\n\tpublic int Precedence => 3;\n\n\tpublic JsonNode? Eval" + }, + { + "title": "src/JsonE/Expressions/Operators/MultiplyOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/MultiplyOperator.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/MultiplyOperator.cs", + "startLine": 1, + "endLine": 26, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class MultiplyOperator : IBinaryOperator\n{\n\tpublic int Precedence => 6;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\tif (left is not JsonValue lValue ||\n\t\t\tright is not JsonValue rValue)\n\t\t\tthrow new InterpreterException(\"infix: * expects number * number\");\n\n\t\tvar lNumber = lValue.GetNumber() ?? throw new InterpreterException(\"infix: * expects number * number\");\n\t\tvar rNumber = rValue.GetNumber() ?? throw new InterpreterException(\"infix: * expects number * number\");\n\n\t\treturn lNumber * rNumber;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"*\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class MultiplyOperator : IBinaryOperator\n{\n\tpublic int Precedence => 6;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, Js" + }, + { + "title": "src/JsonE/Expressions/Operators/NegateOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/NegateOperator.cs#L1-L21", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/NegateOperator.cs", + "startLine": 1, + "endLine": 21, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class NegateOperator : IUnaryOperator\n{\n\tpublic int Precedence => 20;\n\n\tpublic JsonNode? Evaluate(JsonNode? value)\n\t{\n\t\tvar num = value is JsonValue val ? val.GetNumber() : null;\n\n\t\treturn num.HasValue ? -num : throw new InterpreterException(\"unary - expects number\");\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"-\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class NegateOperator : IUnaryOperator\n{\n\tpublic int Precedence => 20;\n\n\tpublic JsonNode? Evaluate(JsonNode? value)\n\t{\n" + }, + { + "title": "src/JsonE/Expressions/Operators/NotEqualToOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/NotEqualToOperator.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/NotEqualToOperator.cs", + "startLine": 1, + "endLine": 24, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class NotEqualToOperator : IBinaryOperator\n{\n\tpublic int Precedence => 3;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\tif (left is JsonValue lVal && right is JsonValue rVal &&\n\t\t lVal.TryGetValue(out FunctionDefinition? lFunc) &&\n\t\t rVal.TryGetValue(out FunctionDefinition? rFunc))\n\t\t\treturn !ReferenceEquals(lFunc, rFunc);\n\n\t\treturn !left.IsEquivalentTo(right);\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"!=\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class NotEqualToOperator : IBinaryOperator\n{\n\tpublic int Precedence => 3;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, " + }, + { + "title": "src/JsonE/Expressions/Operators/NotOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/NotOperator.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/NotOperator.cs", + "startLine": 1, + "endLine": 18, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class NotOperator : IUnaryOperator\n{\n\tpublic int Precedence => 20;\n\n\tpublic JsonNode? Evaluate(JsonNode? value)\n\t{\n\t\treturn !value.IsTruthy();\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"!\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class NotOperator : IUnaryOperator\n{\n\tpublic int Precedence => 20;\n\n\tpublic JsonNode? Evaluate(JsonNode? value)\n\t{\n\t\treturn !value.IsTr" + }, + { + "title": "src/JsonE/Expressions/Operators/OperatorRepository.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/OperatorRepository.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/OperatorRepository.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\n#pragma warning disable IDE1006\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal static class OperatorRepository\n{\n\t// ReSharper disable InconsistentNaming\n\tprivate static readonly IBinaryOperator Add = new AddOperator();\n\tprivate static readonly IBinaryOperator Subtract = new SubtractOperator();\n\tprivate static readonly IBinaryOperator Multiply = new MultiplyOperator();\n\tprivate static readonly IBinaryOperator Divide = new DivideOperator();\n\tprivate static readonly IBinaryOperator Exponent = new ExponentOperator();\n\n\tprivate static readonly IBinaryOperator EqualTo = new EqualToOperator();\n\tprivate static readonly IBinaryOperator NotEqualTo = new NotEqualToOperator();\n\tprivate static readonly IBinaryOperator LessThan = new LessThanOperator();\n\tprivate static readonly IBinaryOperator LessThanOrEqualTo = new LessThanOrEqualToOperator();\n\tprivate static readonly IBinaryOperator GreaterThan = new GreaterThanOperator();\n\tprivate static readonly IBinaryOperator GreaterThanOrEqualTo = new GreaterThanOrEqualToOperator();\n\tprivate static readonly IBinaryOperator In = new InOperator();\n\n\tprivate static readonly IBinaryOperator And = new AndOperator();\n\tprivate static readonly IBinaryOperator Or = new OrOperator();\n\n\tprivate static readonly IUnaryOperator Not = new NotOperator();\n\tprivate static readonly IUnaryOperator Negate = new NegateOperator();\n\tprivate static readonly IUnaryOperator Posate = new PosateOperator();\n\t// ReSharper restore InconsistentNaming\n\n\tpublic static bool TryGetBinary(ReadOnlySpan source, ref int index, out IExpressionOperator? op)\n\t{\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t{\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tswitch (source[index])\n\t\t{\n\t\t\tcase '+':\n\t\t\t\top = Add;\n\t\t\t\tindex++;\n\t\t\t\tbreak;\n\t\t\tcase '-':\n\t\t\t\top = Subtract;\n\t\t\t\tindex++;\n\t\t\t\tbreak;\n\t\t\tcase '/':\n\t\t\t\top = Divide;\n\t\t\t\tindex++;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\top = null;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (op != null) return true;\n\n\t\t// comparative operators\n\t\tif (index > source.Length - 2)\n\t\t{\n\t\t\t// no need to check for < or > because there would be no room for an operand\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tvar portion = source[index..(index + 2)];\n\n\t\tif (portion.Equals(\"**\".AsSpan(), StringComparison.Ordinal))\n\t\t{\n\t\t\top = Exponent;\n\t\t\tindex += 2;\n\t\t}\n\t\telse if (source[index] == '*')\n\t\t{\n\t\t\top = Multiply;\n\t\t\tindex++;\n\t\t}\n\t\telse if (portion.Equals(\"==\".AsSpan(), StringComparison.Ordinal))\n\t\t{\n\t\t\top = EqualTo;\n\t\t\tindex += 2;\n\t\t}\n\t\telse if (portion.Equals(\"!=\".AsSpan(), StringComparison.Ordinal))\n\t\t{\n\t\t\top = NotEqualTo;\n\t\t\tindex += 2;\n\t\t}\n\t\telse if (portion.Equals(\"<=\".AsSpan(), StringComparison.Ordinal))\n\t\t{\n\t\t\top = LessThanOrEqualTo;\n\t\t\tindex += 2;\n\t\t}\n\t\telse if (portion.Equals(\">=\".AsSpan(), StringComparison.Ordinal))\n\t\t{\n\t\t\top = GreaterThanOrEqualTo;\n\t\t\tindex += 2;\n\t\t}\n\t\telse if (source[index] == '<')\n\t\t{\n\t\t\top = LessThan;\n\t\t\tindex++;\n\t\t}\n\t\telse if (source[index] == '>')\n\t\t{\n\t\t\top = GreaterThan;\n\t\t\tindex++;\n\t\t}\n\t\telse if (portion.Equals(\"in\".AsSpan(), StringComparison.Ordinal))\n\t\t{\n\t\t\top = In;\n\t\t\tindex += 2;\n\t\t}\n\n\t\t// logical operators\n\t\telse if (portion.Equals(\"&&\".AsSpan(), StringComparison.Ordinal))\n\t\t{\n\t\t\top = And;\n\t\t\tindex += 2;", + "snippet": "using System;\n#pragma warning disable IDE1006\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal static class OperatorRepository\n{\n\t// ReSharper disable InconsistentNaming\n\tprivate static readonly IBinaryOperator Add" + }, + { + "title": "src/JsonE/Expressions/Operators/OperatorRepository.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/OperatorRepository.cs#L121-L167", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/OperatorRepository.cs", + "startLine": 121, + "endLine": 167, + "content": "}\n\t\telse if (portion.Equals(\"||\".AsSpan(), StringComparison.Ordinal))\n\t\t{\n\t\t\top = Or;\n\t\t\tindex += 2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic static bool TryGetUnary(ReadOnlySpan source, ref int index, out IExpressionOperator? op)\n\t{\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t{\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tswitch (source[index])\n\t\t{\n\t\t\tcase '+':\n\t\t\t\top = Posate;\n\t\t\t\tindex++;\n\t\t\t\tbreak;\n\t\t\tcase '-':\n\t\t\t\top = Negate;\n\t\t\t\tindex++;\n\t\t\t\tbreak;\n\t\t\tcase '!':\n\t\t\t\top = Not;\n\t\t\t\tindex++;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\top = null;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn op != null;\n\t}\n\n}", + "snippet": "}\n\t\telse if (portion.Equals(\"||\".AsSpan(), StringComparison.Ordinal))\n\t\t{\n\t\t\top = Or;\n\t\t\tindex += 2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic static bool TryGetUnary(ReadOnlySpan 2;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\treturn left.IsTruthy() || right.IsTruthy();\n\t}\n\n\tpublic bool ShouldContinue(JsonNode? left, out JsonNode? result)\n\t{\n\t\tvar isTruthy = left.IsTruthy();\n\t\tresult = isTruthy;\n\t\t// if result is true, then don't continue\n\t\treturn !isTruthy;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"||\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class OrOperator : IShortcuttingBinaryOperator\n{\n\tpublic int Precedence => 2;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? rig" + }, + { + "title": "src/JsonE/Expressions/Operators/PosateOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/PosateOperator.cs#L1-L21", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/PosateOperator.cs", + "startLine": 1, + "endLine": 21, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class PosateOperator : IUnaryOperator\n{\n\tpublic int Precedence => 20;\n\n\tpublic JsonNode? Evaluate(JsonNode? value)\n\t{\n\t\tvar num = value is JsonValue val ? val.GetNumber() : null;\n\n\t\treturn num ?? throw new InterpreterException(\"unary + expects number\");\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"+\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class PosateOperator : IUnaryOperator\n{\n\tpublic int Precedence => 20;\n\n\tpublic JsonNode? Evaluate(JsonNode? value)\n\t{\n" + }, + { + "title": "src/JsonE/Expressions/Operators/SubtractOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/Operators/SubtractOperator.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/Operators/SubtractOperator.cs", + "startLine": 1, + "endLine": 26, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class SubtractOperator : IBinaryOperator\n{\n\tpublic int Precedence => 5;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, JsonNode? right)\n\t{\n\t\tif (left is not JsonValue lValue ||\n\t\t\tright is not JsonValue rValue)\n\t\t\tthrow new InterpreterException(\"infix: - expects number - number\");\n\n\t\tvar lNumber = lValue.GetNumber() ?? throw new InterpreterException(\"infix: - expects number - number\");\n\t\tvar rNumber = rValue.GetNumber() ?? throw new InterpreterException(\"infix: - expects number - number\");\n\n\t\treturn lNumber - rNumber;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"-\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions.Operators;\n\ninternal class SubtractOperator : IBinaryOperator\n{\n\tpublic int Precedence => 5;\n\n\tpublic JsonNode? Evaluate(JsonNode? left, Js" + }, + { + "title": "src/JsonE/Expressions/PrimitiveExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/PrimitiveExpressionNode.cs#L1-L46", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/PrimitiveExpressionNode.cs", + "startLine": 1, + "endLine": 46, + "content": "using System;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class PrimitiveExpressionNode : ExpressionNode\n{\n\tpublic JsonNode? Value { get; }\n\n\tpublic PrimitiveExpressionNode(JsonNode? value)\n\t{\n\t\tValue = value;\n\t}\n\n\tpublic override JsonNode? Evaluate(EvaluationContext context)\n\t{\n\t\treturn Value;\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append(Value.AsJsonString());\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn Value.AsJsonString();\n\t}\n}\n\ninternal class PrimitiveExpressionParser : IOperandExpressionParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, out ExpressionNode? expression)\n\t{\n\t\tif (!source.TryParsePrimitive(ref index, out var node))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\texpression = new PrimitiveExpressionNode(node);\n\t\treturn true;\n\t}\n}", + "snippet": "using System;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class PrimitiveExpressionNode : ExpressionNode\n{\n\tpublic JsonNode? Value { get; }\n\n\tpublic Prim" + }, + { + "title": "src/JsonE/Expressions/PropertySegment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/PropertySegment.cs#L1-L34", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/PropertySegment.cs", + "startLine": 1, + "endLine": 34, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class PropertySegment : IContextAccessorSegment\n{\n\tprivate readonly bool _isBracketed;\n\n\tpublic string Name { get; }\n\n\tpublic PropertySegment(string name, bool isBracketed)\n\t{\n\t\tName = name;\n\t\t_isBracketed = isBracketed;\n\t}\n\n\tpublic bool TryFind(JsonNode? contextValue, EvaluationContext fullContext, out JsonNode? value)\n\t{\n\t\treturn TryFind(Name, _isBracketed, contextValue, out value);\n\t}\n\n\tpublic static bool TryFind(string name, bool isBracketed, JsonNode? contextValue, out JsonNode? value)\n\t{\n\t\tvalue = null;\n\t\tif (contextValue is JsonObject obj) return obj.TryGetValue(name, out value, out _) || isBracketed;\n\n\t\tif (!isBracketed) throw new InterpreterException(\"infix: . expects objects\");\n\n\t\tthrow new InterpreterException(\"should only use integers to access arrays or strings\");\n\t}\n\n\tpublic override string ToString() => Name;\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class PropertySegment : IContextAccessorSegment\n{\n\tprivate readonly bool _isBracketed;\n\n\tpublic string Name { get; }\n\n\tpublic Pr" + }, + { + "title": "src/JsonE/Expressions/SliceSegment.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/SliceSegment.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/SliceSegment.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Globalization;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class SliceSegment : IContextAccessorSegment\n{\n\tprivate readonly ExpressionNode? _start;\n\tprivate readonly ExpressionNode? _end;\n\tprivate readonly ExpressionNode? _step;\n\n\tpublic SliceSegment(ExpressionNode? start, ExpressionNode? end, ExpressionNode? step)\n\t{\n\t\t_start = start;\n\t\t_end = end;\n\t\t_step = step;\n\t}\n\n\tpublic bool TryFind(JsonNode? contextValue, EvaluationContext fullContext, out JsonNode? value)\n\t{\n\t\tvar (start, end, step) = GetValues(fullContext);\n\t\tvalue = null;\n\t\treturn contextValue switch\n\t\t{\n\t\t\tJsonArray arr => TryFind(start, end, step, arr, out value),\n\t\t\tJsonValue val when val.TryGetValue(out string? str) => TryFind(start, end, step, str, out value),\n\t\t\t_ => false\n\t\t};\n\t}\n\n\tprivate (int?, int?, int?) GetValues(EvaluationContext context)\n\t{\n\t\treturn (\n\t\t\tGetValue(_start, context),\n\t\t\tGetValue(_end, context),\n\t\t\tGetValue(_step, context)\n\t\t);\n\t}\n\n\tprivate static int? GetValue(ExpressionNode? expr, EvaluationContext context)\n\t{\n\t\tif (expr is null) return null;\n\n\t\tvar node = expr.Evaluate(context);\n\t\tif (node is not JsonValue value)\n\t\t\tthrow new InterpreterException(\"cannot perform interval access with non-integers\");\n\t\tvar num = value.GetNumber();\n\t\tvar index = (int?)num;\n\t\tif (num == null || num != index)\n\t\t\tthrow new InterpreterException(\"cannot perform interval access with non-integers\");\n\n\t\treturn index;\n\t}\n\n\tprivate static bool TryFind(int? start, int? end, int? step, JsonArray contextValue, out JsonNode? value)\n\t{\n\t\tif (step == 0)\n\t\t{\n\t\t\tvalue = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tvar result = new JsonArray();\n\n\t\tstep ??= 1;\n\t\tstart ??= step >= 0 ? 0 : contextValue.Count;\n\t\tend ??= step >= 0 ? contextValue.Count : -contextValue.Count - 1;\n\t\tvar (lower, upper) = Bounds(start.Value, end.Value, step.Value, contextValue.Count);\n\n\t\tif (step > 0)\n\t\t{\n\t\t\tvar i = lower;\n\t\t\twhile (i < upper)\n\t\t\t{\n\t\t\t\tresult.Add(contextValue[i].Clone());\n\t\t\t\ti += step.Value;\n\t\t\t\tif (i < 0) break; // overflow\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar i = upper;\n\t\t\twhile (lower < i)\n\t\t\t{\n\t\t\t\tresult.Add(contextValue[i].Clone());\n\t\t\t\ti += step.Value;\n\t\t\t\tif (i < 0) break; // overflow\n\t\t\t}\n\t\t}\n\n\t\tvalue = result;\n\t\treturn true;\n\t}\n\n\tprivate static bool TryFind(int? start, int? end, int? step, string contextValue, out JsonNode? value)\n\t{\n\t\tif (step == 0)\n\t\t{\n\t\t\tvalue = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tvar result = new StringBuilder();\n\t\tvar stringInfo = new StringInfo(contextValue);\n\n\t\tstep ??= 1;\n\t\tstart ??= step >= 0 ? 0 : stringInfo.LengthInTextElements;\n\t\tend ??= step >= 0 ? stringInfo.LengthInTextElements : -stringInfo.LengthInTextElements - 1;\n\t\tvar (lower, upper) = Bounds(start.Value, end.Value, step.Value, stringInfo.LengthInTextElements);\n\n\t\tif (step > 0)\n\t\t{\n\t\t\tvar i = lower;\n\t\t\twhile (i < upper)\n\t\t\t{\n\t\t\t\tresult.Append(stringInfo.SubstringByTextElements(i, 1));\n\t\t\t\ti += step.Value;", + "snippet": "using System;\nusing System.Globalization;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class SliceSegment : IContextAccessorSegment\n{\n\tprivate readonly Ex" + }, + { + "title": "src/JsonE/Expressions/SliceSegment.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/SliceSegment.cs#L121-L164", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/SliceSegment.cs", + "startLine": 121, + "endLine": 164, + "content": "if (i < 0) break; // overflow\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar i = upper;\n\t\t\twhile (lower < i)\n\t\t\t{\n\t\t\t\tresult.Append(stringInfo.SubstringByTextElements(i, 1));\n\t\t\t\ti += step.Value;\n\t\t\t\tif (i < 0) break; // overflow\n\t\t\t}\n\t\t}\n\n\t\tvalue = result.ToString();\n\t\treturn true;\n\t}\n\n\tprivate static int Normalize(int i, int length)\n\t{\n\t\treturn i >= 0 ? i : length + i;\n\t}\n\n\tprivate static (int lower, int upper) Bounds(int start, int end, int step, int length)\n\t{\n\t\tstart = Normalize(start, length);\n\t\tend = Normalize(end, length);\n\n\t\tint lower, upper;\n\n\t\tif (step >= 0)\n\t\t{\n\t\t\tlower = Math.Min(Math.Max(start, 0), length);\n\t\t\tupper = Math.Min(Math.Max(end, 0), length);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tupper = Math.Min(Math.Max(start, -1), length - 1);\n\t\t\tlower = Math.Min(Math.Max(end, -1), length - 1);\n\t\t}\n\n\t\treturn (lower, upper);\n\t}\n}", + "snippet": "if (i < 0) break; // overflow\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar i = upper;\n\t\t\twhile (lower < i)\n\t\t\t{\n\t\t\t\tresult.Append(stringInfo.SubstringByTextElements(i, 1));\n\t\t\t\ti += step.Value;\n\t\t\t\tif (i < 0) break; // overflow\n\t\t\t}\n\t\t}\n\n" + }, + { + "title": "src/JsonE/Expressions/SpanExtensions.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/SpanExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/SpanExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal static class SpanExtensions\n{\n\tpublic static bool ConsumeWhitespace(this ReadOnlySpan span, ref int i)\n\t{\n\t\twhile (i < span.Length && char.IsWhiteSpace(span[i]))\n\t\t{\n\t\t\ti++;\n\t\t}\n\t\treturn i != span.Length;\n\t}\n\n\tpublic static bool EnsureValidNameCharacter(this ReadOnlySpan span, int i)\n\t{\n\t\treturn span[i] >= 0x20;\n\t\t//throw new PathParseException(i, \"Characters in the range U+0000..U+001F are disallowed\");\n\t}\n\n\tpublic static bool TryGetInt(this ReadOnlySpan span, ref int index, out int value)\n\t{\n\t\tvar negative = false;\n\t\tvar i = index;\n\t\tif (span[i] == '-')\n\t\t{\n\t\t\tnegative = true;\n\t\t\ti++;\n\t\t}\n\n\t\t// Now move past digits\n\t\tvar foundNumber = false;\n\t\tvar zeroStart = false;\n\t\tlong parsedValue = 0;\n\t\tvar overflowed = false;\n\t\tvalue = 0;\n\t\twhile (i < span.Length && char.IsDigit(span[i]))\n\t\t{\n\t\t\tif (zeroStart) return false;\n\n\t\t\tif (!foundNumber && span[i] == '0')\n\t\t\t\tzeroStart = true;\n\n\t\t\tfoundNumber = true;\n\t\t\tif (!overflowed)\n\t\t\t{\n\t\t\t\tparsedValue = parsedValue * 10 + span[i] - '0';\n\t\t\t\toverflowed = parsedValue is <= -2L << 53 or >= 2L << 53;\n\t\t\t}\n\n\t\t\ti++;\n\t\t}\n\n\t\tif (overflowed) return false;\n\n\t\tif (negative) parsedValue = -parsedValue;\n\n\t\tindex = i;\n\t\tvalue = (int)Math.Min(int.MaxValue, Math.Max(int.MinValue, parsedValue));\n\t\treturn foundNumber;\n\t}\n\n\tpublic static bool TryParsePrimitive(this ReadOnlySpan span, ref int i, out JsonNode? node)\n\t{\n\t\tif (!span.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\tnode = null;\n\t\t\treturn false;\n\t\t}\n\n\t\ttry\n\t\t{\n\t\t\tint end = i;\n\t\t\tswitch (span[i])\n\t\t\t{\n\t\t\t\tcase 'f':\n\t\t\t\t\tend += 5;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 't':\n\t\t\t\tcase 'n':\n\t\t\t\t\tend += 4;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '.':\n\t\t\t\tcase '-':\n\t\t\t\tcase '0':\n\t\t\t\tcase '1':\n\t\t\t\tcase '2':\n\t\t\t\tcase '3':\n\t\t\t\tcase '4':\n\t\t\t\tcase '5':\n\t\t\t\tcase '6':\n\t\t\t\tcase '7':\n\t\t\t\tcase '8':\n\t\t\t\tcase '9':\n\t\t\t\t\tend = i;\n\t\t\t\t\tvar allowDash = true;\n\t\t\t\t\twhile (end < span.Length && (span[end].In('0'..('9' + 1)) ||\n\t\t\t\t\t span[end].In('e', '.', '-', '+')))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!allowDash && span[end] is '-' or '+') break;\n\t\t\t\t\t\tallowDash = span[end] == 'e';\n\t\t\t\t\t\tend++;\n\t\t\t\t\t}\n\t\t\t\t\tnode = decimal.Parse(span[i..end].ToString());\n\t\t\t\t\ti = end;\n\t\t\t\t\treturn true;\n\t\t\t\tcase '\\'':\n\t\t\t\tcase '\"':\n\t\t\t\t\tend = i + 1;\n\t\t\t\t\tvar endChar = span[i];\n\t\t\t\t\twhile (end < span.Length && span[end] != endChar)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (span[end] == '\\\\')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tend++;\n\t\t\t\t\t\t\tif (end >= span.Length) break;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tend++;", + "snippet": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal static class SpanExtensions\n{\n\tpublic static bool ConsumeWhitespace(this ReadOnlySpan span, ref int i)\n\t{\n\t\twhile (i < span.L" + }, + { + "title": "src/JsonE/Expressions/SpanExtensions.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/SpanExtensions.cs#L121-L189", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/SpanExtensions.cs", + "startLine": 121, + "endLine": 189, + "content": "}\n\n\t\t\t\t\tnode = span[(i + 1)..end].ToString();\n\t\t\t\t\ti = end+1;\n\t\t\t\t\treturn true;\n\t\t\t\tdefault:\n\t\t\t\t\tnode = default;\n\t\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tvar block = span[i..end];\n\t\t\tnode = JsonNode.Parse(block.ToString());\n\t\t\ti = end;\n\t\t\treturn true;\n\t\t}\n\t\tcatch\n\t\t{\n\t\t\tnode = default;\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic static bool TryParseName(this ReadOnlySpan source, ref int index, out string? name)\n\t{\n\t\tvar i = index;\n\n\t\tif (!source.ConsumeWhitespace(ref i) || i == source.Length)\n\t\t{\n\t\t\tname = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (i < source.Length && source[i].IsValidForPropertyNameStart())\n\t\t{\n\t\t\ti++;\n\t\t\twhile (i < source.Length && source[i].IsValidForPropertyName())\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\n\t\tif (index == i)\n\t\t{\n\t\t\tname = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tname = source[index..i].ToString();\n\t\tindex = i;\n\t\treturn true;\n\t}\n\n\tprivate static bool IsValidForPropertyName(this char ch)\n\t{\n\t\treturn ch.In('a'..('z' + 1)) ||\n\t\t ch.In('A'..('Z' + 1)) ||\n\t\t ch.In('0'..('9' + 1)) ||\n\t\t ch.In('_') ||\n\t\t ch.In(0x80..0x10FFFF);\n\t}\n\n\tprivate static bool IsValidForPropertyNameStart(this char ch)\n\t{\n\t\treturn ch.In('a'..('z' + 1)) ||\n\t\t ch.In('A'..('Z' + 1)) ||\n\t\t ch.In('_') ||\n\t\t ch.In(0x80..0x10FFFF);\n\t}\n}", + "snippet": "}\n\n\t\t\t\t\tnode = span[(i + 1)..end].ToString();\n\t\t\t\t\ti = end+1;\n\t\t\t\t\treturn true;\n\t\t\t\tdefault:\n\t\t\t\t\tnode = default;\n\t\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tvar block = span[i..end];\n\t\t\tnode = JsonNode.Parse(block.ToString());\n\t\t\ti = e" + }, + { + "title": "src/JsonE/Expressions/UnaryExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/UnaryExpressionNode.cs#L1-L103", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/UnaryExpressionNode.cs", + "startLine": 1, + "endLine": 103, + "content": "using System;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions.Operators;\nusing static Json.JsonE.Operators.CommonErrors;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class UnaryExpressionNode : ExpressionNode\n{\n\tpublic IUnaryOperator Operator { get; }\n\tpublic ExpressionNode Value { get; }\n\n\tpublic UnaryExpressionNode(IUnaryOperator op, ExpressionNode value)\n\t{\n\t\tOperator = op;\n\t\tValue = value;\n\t}\n\n\tpublic override JsonNode? Evaluate(EvaluationContext context)\n\t{\n\t\treturn Operator.Evaluate(Value.Evaluate(context));\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tvar useGroup = Value is BinaryExpressionNode;\n\n\t\tbuilder.Append(Operator);\n\t\tif (useGroup)\n\t\t\tbuilder.Append('(');\n\t\tValue.BuildString(builder);\n\t\tif (useGroup)\n\t\t\tbuilder.Append(')');\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn $\"{Operator}{Value}\";\n\t}\n}\n\ninternal class UnaryExpressionParser : IOperandExpressionParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, out ExpressionNode? expression)\n\t{\n\t\t// currently only the \"not\" operator is known\n\t\t// it expects a ! then either a comparison or logical expression\n\n\t\tvar i = index;\n\t\tvar nestLevel = 0;\n\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\twhile (i < source.Length && source[i] == '(')\n\t\t{\n\t\t\tnestLevel++;\n\t\t\ti++;\n\t\t}\n\t\tif (i == source.Length)\n\t\t\tthrow new TemplateException(EndOfInput(i));\n\n\t\t// parse operator\n\t\tif (!OperatorRepository.TryGetUnary(source, ref i, out var op) || op is not IUnaryOperator unOp)\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// parse comparison\n\t\tif (!ExpressionParser.TryParse(source, ref i, out var right))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\twhile (i < source.Length && source[i] == ')' && nestLevel > 0)\n\t\t{\n\t\t\tnestLevel--;\n\t\t\ti++;\n\t\t}\n\n\t\tif (nestLevel != 0)\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\texpression = new UnaryExpressionNode(unOp, right!);\n\t\tindex = i;\n\t\treturn true;\n\t}\n}", + "snippet": "using System;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions.Operators;\nusing static Json.JsonE.Operators.CommonErrors;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class UnaryExpressionNod" + }, + { + "title": "src/JsonE/Expressions/UtilityExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/UtilityExtensions.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/UtilityExtensions.cs", + "startLine": 1, + "endLine": 24, + "content": "using System;\nusing System.Linq;\n\nnamespace Json.JsonE.Expressions;\n\ninternal static class UtilityExtensions\n{\n\tpublic static bool In(this T value, params T[] range)\n\t{\n\t\treturn range.Contains(value);\n\t}\n\n#if NET9_0_OR_GREATER\n\tpublic static bool In(this T value, params ReadOnlySpan range) where T : IEquatable\n\t{\n\t\treturn range.Contains(value);\n\t}\n#endif\n\n\tpublic static bool In(this char value, Range range)\n\t{\n\t\treturn range.Start.Value <= value && value < range.End.Value;\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\n\nnamespace Json.JsonE.Expressions;\n\ninternal static class UtilityExtensions\n{\n\tpublic static bool In(this T value, params T[] range)\n\t{\n\t\treturn range.Contains(value);\n\t}\n\n#if NET9_0_O" + }, + { + "title": "src/JsonE/Expressions/ValueAccessor.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/ValueAccessor.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/ValueAccessor.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class ValueAccessor\n{\n\tprivate readonly IContextAccessorSegment[] _segments;\n\tprivate readonly string _asString;\n\n\tprivate ValueAccessor(IEnumerable segments, string asString)\n\t{\n\t\t_segments = segments.ToArray();\n\t\t_asString = asString;\n\t}\n\n\tinternal static bool TryParse(ReadOnlySpan source, ref int index, out ValueAccessor? accessor)\n\t{\n\t\tvar i = index;\n\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\taccessor = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tvar segments = new List();\n\n\t\twhile (i < source.Length)\n\t\t{\n\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t{\n\t\t\t\taccessor = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tswitch (source[i])\n\t\t\t{\n\t\t\t\tcase '.':\n\t\t\t\t\ti++;\n\t\t\t\t\tif (!source.TryParseName(ref i, out var name))\n\t\t\t\t\t\tthrow new SyntaxException(CommonErrors.WrongToken(source[i], \"identifier\"));\n\n\t\t\t\t\tsegments.Add(new PropertySegment(name!, false));\n\t\t\t\t\tcontinue;\n\t\t\t\tcase '[':\n\t\t\t\t\ti++;\n\n\t\t\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t\t\t{\n\t\t\t\t\t\taccessor = null;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!TryParseQuotedName(source, ref i, out var segment) &&\n\t\t\t\t\t !TryParseSlice(source, ref i, out segment) &&\n\t\t\t\t\t !TryParseIndex(source, ref i, out segment) &&\n\t\t\t\t\t !TryParseExpression(source, ref i, out segment))\n\t\t\t\t\t\tthrow new SyntaxException(CommonErrors.WrongToken(source[i]));\n\n\t\t\t\t\tsegments.Add(segment!);\n\n\t\t\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t\t\t\tthrow new SyntaxException(\"Missing closing ]\");\n\t\t\t\t\tif (source[i] != ']')\n\t\t\t\t\t\tthrow new SyntaxException(CommonErrors.WrongToken(source[i], \"]\"));\n\n\t\t\t\t\ti++;\n\n\t\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tif (segments.Count == 0)\n\t\t{\n\t\t\taccessor = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tvar asString = source[index..i].ToString();\n\t\tindex = i;\n\t\taccessor = new ValueAccessor(segments, asString);\n\t\treturn true;\n\t}\n\n\tprivate static bool TryParseQuotedName(ReadOnlySpan source, ref int index, out IContextAccessorSegment? segment)\n\t{\n\t\tchar quoteChar;\n\t\tvar i = index;\n\t\tswitch (source[index])\n\t\t{\n\t\t\tcase '\"':\n\t\t\t\tquoteChar = '\"';\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase '\\'':\n\t\t\t\tquoteChar = '\\'';\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tsegment = null;\n\t\t\t\treturn false;\n\t\t}\n\n\t\tvar done = false;\n\t\tvar sb = new StringBuilder();\n\t\twhile (i < source.Length && !done)\n\t\t{\n\t\t\tif (source[i] == quoteChar)\n\t\t\t{\n\t\t\t\tdone = true;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse\n\t\t\t{", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Operators;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class ValueAccessor\n{\n\tprivate " + }, + { + "title": "src/JsonE/Expressions/ValueAccessor.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/ValueAccessor.cs#L121-L231", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/ValueAccessor.cs", + "startLine": 121, + "endLine": 231, + "content": "if (!source.EnsureValidNameCharacter(i))\n\t\t\t\t{\n\t\t\t\t\tsegment = null;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tsb.Append(source[i]);\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\n\t\tif (!done)\n\t\t{\n\t\t\tsegment = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tindex = i;\n\t\tsegment = new PropertySegment(sb.ToString(), true);\n\t\treturn true;\n\n\t}\n\n\tprivate static bool TryParseIndex(ReadOnlySpan source, ref int index, out IContextAccessorSegment? segment)\n\t{\n\t\tif (!source.TryGetInt(ref index, out var i))\n\t\t{\n\t\t\tsegment = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tsegment = new IndexSegment(i);\n\t\treturn true;\n\t}\n\n\tprivate static bool TryParseSlice(ReadOnlySpan source, ref int index, out IContextAccessorSegment? segment)\n\t{\n\t\tvar i = index;\n\n\t\tExpressionParser.TryParse(source, ref i, out var start);\n\n\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\tsegment = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (source[i] != ':')\n\t\t{\n\t\t\tsegment = null;\n\t\t\treturn false;\n\t\t}\n\n\t\ti++; // consume :\n\n\t\tExpressionNode? step = null;\n\t\tExpressionNode? end = null;\n\t\tif (source.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\tExpressionParser.TryParse(source, ref i, out end);\n\n\t\t\tif (source.ConsumeWhitespace(ref i))\n\t\t\t{\n\t\t\t\tif (source[i] == ':')\n\t\t\t\t{\n\t\t\t\t\ti++; // consume :\n\n\t\t\t\t\tif (source.ConsumeWhitespace(ref i))\n\t\t\t\t\t{\n\t\t\t\t\t\tExpressionParser.TryParse(source, ref i, out step);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tindex = i;\n\t\tsegment = new SliceSegment(start, end, step);\n\t\treturn true;\n\t}\n\n\tprivate static bool TryParseExpression(ReadOnlySpan source, ref int i, out IContextAccessorSegment? segment)\n\t{\n\t\tif (!ExpressionParser.TryParse(source, ref i, out var expression))\n\t\t{\n\t\t\tsegment = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tsegment = new ExpressionSegment(expression!);\n\t\treturn true;\n\t}\n\n\tinternal JsonNode? Find(JsonNode? localContext, EvaluationContext fullContext)\n\t{\n\t\tvar current = localContext;\n\t\tforeach (var segment in _segments)\n\t\t{\n\t\t\tif (!segment.TryFind(current, fullContext, out var value))\n\t\t\t{\n\t\t\t\tif (current is JsonObject)\n\t\t\t\t\tthrow new InterpreterException($\"object has no property \\\"{segment}\\\"\");\n\t\t\t\tthrow new InterpreterException($\"unknown context value \\\"{segment}\\\"\");\n\t\t\t}\n\n\t\t\tcurrent = value;\n\t\t}\n\n\t\treturn current;\n\t}\n\n\tpublic override string ToString() => _asString;\n}", + "snippet": "if (!source.EnsureValidNameCharacter(i))\n\t\t\t\t{\n\t\t\t\t\tsegment = null;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tsb.Append(source[i]);\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\n\t\tif (!done)\n\t\t{\n\t\t\tsegment = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tindex = i;\n\t\tsegment =" + }, + { + "title": "src/JsonE/Expressions/ValueAccessorExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Expressions/ValueAccessorExpressionNode.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Expressions/ValueAccessorExpressionNode.cs", + "startLine": 1, + "endLine": 32, + "content": "using System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class ValueAccessorExpressionNode : ExpressionNode\n{\n\tpublic ExpressionNode TargetExpression { get; }\n\tpublic ValueAccessor Accessor { get; }\n\n\tpublic ValueAccessorExpressionNode(ExpressionNode target, ValueAccessor accessor)\n\t{\n\t\tTargetExpression = target;\n\t\tAccessor = accessor;\n\t}\n\n\tpublic override JsonNode? Evaluate(EvaluationContext context)\n\t{\n\t\tvar target = TargetExpression.Evaluate(context);\n\t\treturn Accessor.Find(target, context);\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append(Accessor);\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn Accessor.ToString();\n\t}\n}", + "snippet": "using System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Expressions;\n\ninternal class ValueAccessorExpressionNode : ExpressionNode\n{\n\tpublic ExpressionNode TargetExpression { get; }\n\tpublic ValueAccessor Ac" + }, + { + "title": "src/JsonE/FunctionDefinition.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/FunctionDefinition.cs#L1-L21", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/FunctionDefinition.cs", + "startLine": 1, + "endLine": 21, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Serves as a base type for JSON-e functions. Use to create custom functions.\n/// \npublic abstract class FunctionDefinition\n{\n\tinternal abstract JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context);\n\n\t/// \n\t/// Implicitly converts a into a .\n\t/// \n\t/// The function.\n\tpublic static implicit operator JsonNode?(FunctionDefinition func)\n\t{\n\t\treturn JsonValue.Create(func, JsonESerializerContext.Default.FunctionDefinition);\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Serves as a base type for JSON-e functions. Use to create custom functions.\n/// \npublic abstract class Functio" + }, + { + "title": "src/JsonE/InterpreterException.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/InterpreterException.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/InterpreterException.cs", + "startLine": 1, + "endLine": 15, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Thrown from when a template cannot be evaluated.\n/// \npublic class InterpreterException : JsonEException\n{\n\t/// \n\t/// Creates a new instance of .\n\t/// \n\t/// The error message.\n\tpublic InterpreterException(string message) : base(message){}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Thrown from when a template cannot be evaluated.\n/// \npublic class InterpreterException " + }, + { + "title": "src/JsonE/IOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/IOperator.cs#L1-L8", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/IOperator.cs", + "startLine": 1, + "endLine": 8, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\ninternal interface IOperator\n{\n\tJsonNode? Evaluate(JsonNode? template, EvaluationContext context);\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\ninternal interface IOperator\n{\n\tJsonNode? Evaluate(JsonNode? template, EvaluationContext context);\n}" + }, + { + "title": "src/JsonE/JsonE.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/JsonE.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/JsonE.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.JsonE.Expressions;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE;\n\n/// \n/// Models a JSON-e template.\n/// \npublic static class JsonE\n{\n\tinternal static readonly JsonNode DeleteMarker = \"delete_marker\"!;\n\n\t/// \n\t/// Evaluates the template against a JSON value context.\n\t/// \n\t/// \n\t/// The JSON value context\n\t/// A new JSON value result.\n\tpublic static JsonNode? Evaluate(JsonNode? template, JsonNode? context = null)\n\t{\n\t\tcontext ??= new JsonObject();\n\n\t\tcontext.ValidateAsContext();\n\t\tvar evalContext = new EvaluationContext((JsonObject)context);\n\t\t\n\t\tvar result = Evaluate(template, evalContext);\n\t\tresult.ValidateNotReturningFunction();\n\t\treturn ReferenceEquals(result, DeleteMarker) ? null : result;\n\t}\n\n\tinternal static JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar op = OperatorRepository.Get(template);\n\n\t\tJsonNode? result;\n\n\t\tif (op == null)\n\t\t\tresult = MaybeEvaluateChildren(template, context);\n\t\telse\n\t\t\tresult = op.Evaluate(template, context);\n\n\t\treturn HandleStringInterpolation(result, context);\n\t}\n\n\tprivate static JsonNode? MaybeEvaluateChildren(JsonNode? node, EvaluationContext context)\n\t{\n\t\tswitch (node)\n\t\t{\n\t\t\tcase JsonObject obj:\n\t\t\t{\n\t\t\t\tvar result = new JsonObject();\n\t\t\t\tforeach (var kvp in obj)\n\t\t\t\t{\n\t\t\t\t\tvar local = kvp.Value is JsonValue val &&\n\t\t\t\t\t val.TryGetValue(out JsonExpression? json)\n\t\t\t\t\t\t? json.Expression.Evaluate(context)\n\t\t\t\t\t\t: Evaluate(kvp.Value, context);\n\t\t\t\t\tif (!ReferenceEquals(local, DeleteMarker))\n\t\t\t\t\t\tresult[HandleEscapedKey(kvp.Key)] = local.Clone();\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tcase JsonArray arr:\n\t\t\t{\n\t\t\t\tvar result = new JsonArray();\n\t\t\t\tforeach (var item in arr)\n\t\t\t\t{\n\t\t\t\t\tvar local = item is JsonValue val &&\n\t\t\t\t\t val.TryGetValue(out JsonExpression? json)\n\t\t\t\t\t\t? json.Expression.Evaluate(context)\n\t\t\t\t\t\t: Evaluate(item, context);\n\t\t\t\t\tif (!ReferenceEquals(local, DeleteMarker))\n\t\t\t\t\t{\n\t\t\t\t\t\tvar copy = local.Clone();\n\t\t\t\t\t\tresult.Add(copy);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn node;\n\t\t}\n\t}\n\n\tprivate static string HandleEscapedKey(string key)\n\t{\n\t\tif (key.StartsWith(\"$$\")) return key[1..];\n\t\treturn key;\n\t}\n\n\tprivate static JsonNode? HandleStringInterpolation(JsonNode? value, EvaluationContext context)\n\t{\n\t\tif (ReferenceEquals(value, DeleteMarker)) return value;\n\n\t\tswitch (value)\n\t\t{\n\t\t\tcase JsonObject obj:\n\t\t\t\tforeach (var kvp in obj.ToArray())\n\t\t\t\t{\n\t\t\t\t\tobj.Remove(kvp.Key);\n\t\t\t\t\tobj[Interpolate(kvp.Key, context)] = kvp.Value;\n\t\t\t\t}\n\t\t\t\treturn obj;\n\t\t\tcase JsonValue val when val.TryGetValue(out string? str):\n\t\t\t\treturn Interpolate(str, context);\n\t\t\tdefault:\n\t\t\t\treturn value;\n\t\t}\n\t}\n\n\tprivate static string Interpolate(string value, EvaluationContext context)\n\t{", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.JsonE.Expressions;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace" + }, + { + "title": "src/JsonE/JsonE.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/JsonE.cs#L121-L213", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/JsonE.cs", + "startLine": 121, + "endLine": 213, + "content": "if (value.Length <= 2) return value;\n\n\t\tvar interpolated = value;\n\t\tvar starts = Enumerable.Range(0, value.Length - 2 + 1).Where(index => \"${\".Equals(value.Substring(index, 2)));\n\n\t\tvar source = value.AsSpan();\n\t\tforeach (var start in starts)\n\t\t{\n\t\t\tchar? stringStartChar = null;\n\t\t\tvar end = start + 2;\n\t\t\tvar nest = 1;\n\t\t\twhile (nest != 0 && end < source.Length)\n\t\t\t{\n\t\t\t\tswitch (source[end])\n\t\t\t\t{\n\t\t\t\t\tcase '\\'':\n\t\t\t\t\tcase '\"':\n\t\t\t\t\t\tif (!stringStartChar.HasValue)\n\t\t\t\t\t\t\tstringStartChar = source[end];\n\t\t\t\t\t\telse if (stringStartChar.Value == source[end])\n\t\t\t\t\t\t\tstringStartChar = null;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '{':\n\t\t\t\t\t\tif (!stringStartChar.HasValue)\n\t\t\t\t\t\t\tnest++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '}':\n\t\t\t\t\t\tif (!stringStartChar.HasValue)\n\t\t\t\t\t\t\tnest--;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tend++;\n\t\t\t}\n\n\t\t\tif (end > source.Length)\n\t\t\t\tthrow new TemplateException(\"invalid expression inside string interpolation\");\n\n\t\t\tvar textToReplace = source[start..end].ToString();\n\t\t\tif (start != 0 && source[start - 1] == '$')\n\t\t\t{\n\t\t\t\tvar unescaped = source[(start + 1)..end].ToString();\n\t\t\t\tinterpolated = interpolated.Replace(textToReplace, unescaped);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar exprText = source[(start + 2)..(end - 1)];\n\t\t\tvar index = 0;\n\t\t\tif (!ExpressionParser.TryParse(exprText, ref index, out var expr))\n\t\t\t\tthrow new TemplateException(\"invalid expression inside string interpolation\");\n\n\t\t\tvar evaluated = expr!.Evaluate(context);\n\t\t\tif (evaluated is null)\n\t\t\t{\n\t\t\t\tinterpolated = interpolated.Replace(textToReplace, string.Empty);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (evaluated is JsonValue val)\n\t\t\t{\n\t\t\t\tvar n = val.GetNumber();\n\t\t\t\tif (n.HasValue)\n\t\t\t\t{\n\t\t\t\t\tinterpolated = interpolated.Replace(textToReplace, n.ToString());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (val.TryGetValue(out string? s))\n\t\t\t\t{\n\t\t\t\t\tinterpolated = interpolated.Replace(textToReplace, s);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (val.TryGetValue(out bool b))\n\t\t\t\t{\n\t\t\t\t\tinterpolated = interpolated.Replace(textToReplace, b ? \"true\" : \"false\");\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthrow new TemplateException($\"interpolation of '{exprText.ToString()}' produced an array or object\");\n\t\t}\n\n\t\treturn interpolated;\n\t}\n\n}\n\n[JsonSerializable(typeof(FunctionDefinition))]\n[JsonSerializable(typeof(SortedDictionary))]\n[JsonSerializable(typeof(JsonExpression))]\n[JsonSerializable(typeof(decimal))]\n[JsonSerializable(typeof(string))]\n[JsonSerializable(typeof(JsonNode))]\ninternal partial class JsonESerializerContext : JsonSerializerContext;", + "snippet": "if (value.Length <= 2) return value;\n\n\t\tvar interpolated = value;\n\t\tvar starts = Enumerable.Range(0, value.Length - 2 + 1).Where(index => \"${\".Equals(value.Substring(index, 2)));\n\n\t\tvar source = value.AsSpan();\n\t\tforeach" + }, + { + "title": "src/JsonE/JsonEException.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/JsonEException.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/JsonEException.cs", + "startLine": 1, + "endLine": 15, + "content": "using System;\n\nnamespace Json.JsonE;\n\n/// \n/// Thrown when something goes wrong during a JSON-e evaluation.\n/// \npublic abstract class JsonEException : Exception\n{\n\t/// \n\t/// Initializes a new .\n\t/// \n\t/// The message that describes the error.\n\tprotected JsonEException(string message) : base(message) {}\n}", + "snippet": "using System;\n\nnamespace Json.JsonE;\n\n/// \n/// Thrown when something goes wrong during a JSON-e evaluation.\n/// \npublic abstract class JsonEException : Exception\n{\n\t/// \n\t/// Initializes a new" + }, + { + "title": "src/JsonE/JsonFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/JsonFunction.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/JsonFunction.cs", + "startLine": 1, + "endLine": 39, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Defines a signature for custom JSON-e functions.\n/// \n/// \n/// \n/// \npublic delegate JsonNode? JsonFunctionDelegate(JsonNode?[] arguments, EvaluationContext context);\n\n/// \n/// Serves as a -compatible wrapper for a custom JSON-e function.\n/// \npublic class JsonFunction : FunctionDefinition\n{\n\tprivate readonly JsonFunctionDelegate _function;\n\n\tprivate JsonFunction(JsonFunctionDelegate function)\n\t{\n\t\t_function = function;\n\t}\n\n\t/// \n\t/// Creates a new .\n\t/// \n\t/// \n\t/// \n\tpublic static JsonFunction Create(JsonFunctionDelegate function)\n\t{\n\t\treturn new JsonFunction(function);\n\t}\n\n\tinternal override JsonNode? Invoke(JsonNode?[] arguments, EvaluationContext context)\n\t{\n\t\treturn _function(arguments, context);\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Defines a signature for custom JSON-e functions.\n/// \n/// \n/// \n/// Exact = a;\n\t\tpublic Stringish(Regex b) => Pattern = b;\n\n\t\tpublic bool Matches(string content)\n\t\t{\n\t\t\treturn Exact is not null\n\t\t\t\t? content == Exact\n\t\t\t\t: Pattern!.IsMatch(content);\n\t\t}\n\n\t\tpublic static implicit operator Stringish(string exact) => new(exact);\n\t\tpublic static implicit operator Stringish(Regex pattern) => new(pattern);\n\t}\n\n\tprivate static readonly JsonNode? _emptyString = string.Empty;\n\tprivate static readonly JsonNode? _zero = 0;\n\tprivate static readonly JsonNode? _false = false;\n\n\tpublic static bool IsTruthy(this JsonNode? node)\n\t{\n\t\tif (node is null) return false;\n\t\tif (node is JsonObject { Count: 0 }) return false;\n\t\tif (node is JsonArray { Count: 0 }) return false;\n\t\tif (node.IsEquivalentTo(_false)) return false;\n\t\tif (node.IsEquivalentTo(_zero)) return false;\n\t\tif (node.IsEquivalentTo(_emptyString)) return false;\n\n\t\treturn true;\n\t}\n\n\tpublic static void ValidateAsContext(this JsonNode? context, string? location = null)\n\t{\n\t\tif (context is not JsonObject obj)\n\t\t\tthrow new TemplateException($\"{(location != null ? location + \" value\" : \"context\")} must be an object\");\n\n\t\tif (obj.Any(x => !Regex.IsMatch(x.Key, \"^[a-zA-Z_][a-zA-Z0-9_]*$\")))\n\t\t\tthrow new TemplateException($\"top level keys of {location ?? \"context\"} must follow /[a-zA-Z_][a-zA-Z0-9_]*/\");\n\t}\n\n\tpublic static bool IsTemplateOr(this JsonNode? node)\n\t{\n\t\treturn node switch\n\t\t{\n\t\t\tT => true,\n\t\t\tJsonObject when OperatorRepository.Get(node) != null => true,\n\t\t\tJsonValue value when value.TryGetValue(out _) => true,\n\t\t\t_ => false\n\t\t};\n\t}\n\n\tpublic static void VerifyNoUndefinedProperties(this JsonObject obj, string op, params Stringish[] additionalKeys)\n\t{\n\t\tvar undefinedKeys = obj.Select(x => x.Key).Where(x => x != op && !additionalKeys.Any(y => y.Matches(x))).ToArray();\n\t\tif (undefinedKeys.Length != 0)\n\t\t\tthrow new TemplateException(CommonErrors.UndefinedProperties(op, undefinedKeys));\n\t}\n\n\tpublic static void VerifyPropertyCount(this JsonObject obj, string op, int expectedCount)\n\t{\n\t\tif (obj.Count != expectedCount)\n\t\t\tthrow new TemplateException(CommonErrors.IncorrectOperatorArgCount(op, expectedCount));\n\t}\n\n\tpublic static void ValidateNotReturningFunction(this JsonNode? result)\n\t{\n\t\tvar queue = new Queue();\n\t\tqueue.Enqueue(result);\n\t\twhile (queue.Count != 0)\n\t\t{\n\t\t\tvar current = queue.Dequeue();\n\t\t\tswitch (current)\n\t\t\t{\n\t\t\t\tcase JsonObject obj:\n\t\t\t\t\tforeach (var kvp in obj)\n\t\t\t\t\t{\n\t\t\t\t\t\tqueue.Enqueue(kvp.Value);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase JsonArray arr:\n\t\t\t\t\tforeach (var item in arr)\n\t\t\t\t\t{\n\t\t\t\t\t\tqueue.Enqueue(item);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase JsonValue val:\n\t\t\t\t\tif (val.TryGetValue(out _))\n\t\t\t\t\t\tthrow new TemplateException(\"evaluated template contained uncalled functions\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static JsonNode? Clone(this JsonNode? source)\n\t{\n\t\tJsonNode CopyObject(JsonObject obj)\n\t\t{\n\t\t\tvar newObj = new JsonObject(obj.Options);\n\t\t\tforeach (var kvp in obj)\n\t\t\t{\n\t\t\t\tnewObj[kvp.Key] = kvp.Value.Clone();\n\t\t\t}\n\n\t\t\treturn newObj;", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\nusing Json.JsonE.Operators;\nusing Json.More;\n\nnamespace Json.JsonE;\n\ninternal static " + }, + { + "title": "src/JsonE/JsonNodeExtensions.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/JsonNodeExtensions.cs#L121-L151", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/JsonNodeExtensions.cs", + "startLine": 121, + "endLine": 151, + "content": "}\n\n\t\tJsonNode CopyArray(JsonArray arr)\n\t\t{\n\t\t\tvar newArr = new JsonArray(arr.Options);\n\t\t\tforeach (var item in arr)\n\t\t\t{\n\t\t\t\tnewArr.Add(item.Clone());\n\t\t\t}\n\n\t\t\treturn newArr;\n\t\t}\n\n\t\tJsonNode? CopyValue(JsonValue val)\n\t\t{\n\t\t\tif (val.TryGetValue(out FunctionDefinition? func))\n\t\t\t\treturn JsonValue.Create(func, JsonESerializerContext.Default.FunctionDefinition);\n\n\t\t\treturn val.DeepClone();\n\t\t}\n\n\t\treturn source switch\n\t\t{\n\t\t\tnull => null,\n\t\t\tJsonObject obj => CopyObject(obj),\n\t\t\tJsonArray arr => CopyArray(arr),\n\t\t\tJsonValue val => CopyValue(val),\n\t\t\t_ => throw new ArgumentOutOfRangeException(nameof(source))\n\t\t};\n\t}\n}", + "snippet": "}\n\n\t\tJsonNode CopyArray(JsonArray arr)\n\t\t{\n\t\t\tvar newArr = new JsonArray(arr.Options);\n\t\t\tforeach (var item in arr)\n\t\t\t{\n\t\t\t\tnewArr.Add(item.Clone());\n\t\t\t}\n\n\t\t\treturn newArr;\n\t\t}\n\n\t\tJsonNode? CopyValue(JsonValue val)\n\t\t{" + }, + { + "title": "src/JsonE/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonE/obj/Debug/net10.0/JsonE.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Debug/net10.0/JsonE.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Debug/net10.0/JsonE.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON-e built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonE/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonE/obj/Debug/net8.0/JsonE.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Debug/net8.0/JsonE.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Debug/net8.0/JsonE.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON-e built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonE/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonE/obj/Debug/net9.0/JsonE.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Debug/net9.0/JsonE.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Debug/net9.0/JsonE.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON-e built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonE/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonE/obj/Debug/netstandard2.0/JsonE.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Debug/netstandard2.0/JsonE.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Debug/netstandard2.0/JsonE.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON-e built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonE/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonE/obj/Release/net10.0/JsonE.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Release/net10.0/JsonE.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Release/net10.0/JsonE.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON-e built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonE/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonE/obj/Release/net8.0/JsonE.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Release/net8.0/JsonE.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Release/net8.0/JsonE.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON-e built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonE/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonE/obj/Release/net9.0/JsonE.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Release/net9.0/JsonE.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Release/net9.0/JsonE.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON-e built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonE/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonE/obj/Release/netstandard2.0/JsonE.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/obj/Release/netstandard2.0/JsonE.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/obj/Release/netstandard2.0/JsonE.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON-e built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonE.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonE/Operators/CommonErrors.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/CommonErrors.cs#L1-L42", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/CommonErrors.cs", + "startLine": 1, + "endLine": 42, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.JsonE.Operators;\n\ninternal static class CommonErrors\n{\n\tpublic static string UndefinedProperties(string op, IEnumerable extraProperties) => \n\t\t$\"{op} has undefined properties: {string.Join(\" \", extraProperties.OrderBy(x => x, StringComparer.InvariantCultureIgnoreCase))}\";\n\n\tpublic static string IncorrectOperatorArgCount(string op, int expectedCount) => \n\t\t$\"{op} must have exactly {expectedCount.ToWords()} properties\";\n\n\tpublic static string IncorrectValueType(string op, string expectedType) =>\n\t\t$\"{op} value must evaluate to {expectedType}\";\n\n\tpublic static string IncorrectArgType(string op) => $\"invalid arguments to builtin: {op}\";\n\n\tpublic static string IncorrectArgType(string op, string explanation) => $\"invalid arguments to builtin: {op}: {explanation}\";\n\n\tpublic static string EndOfInput(int i) => $\"Unexpected end of input at index {i}\";\n\n\tpublic static string SortSameType() => \"$sorted values to be sorted must have the same type\";\n\n\tpublic static string WrongToken(string token) => $\"Found: {token} token, expected one of: !, (, +, -, [, false, identifier, null, number, string, true, {{\";\n\n\tpublic static string WrongToken(char token) => $\"Found: {token} token, expected one of: !, (, +, -, [, false, identifier, null, number, string, true, {{\";\n\n\tpublic static string WrongToken(string token, params string[] expected) => $\"Found: {token} token, expected one of: {string.Join(\",\", expected)}\";\n\n#if NET9_0_OR_GREATER\n\tpublic static string WrongToken(char token, params ReadOnlySpan expected) => $\"Found: {token} token, expected one of: {string.Join(\",\", expected)}\";\n#else\n\tpublic static string WrongToken(char token, params string[] expected) => $\"Found: {token} token, expected one of: {string.Join(\",\", expected)}\";\n#endif\n\n\tpublic static string EndOfInput() => \"Unexpected end of input\";\n\n\tprivate static readonly List _words = [\"zero\", \"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\"]; // probably shouldn't need more than this.\n\tprivate static string ToWords(this int count) => _words[count];\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.JsonE.Operators;\n\ninternal static class CommonErrors\n{\n\tpublic static string UndefinedProperties(string op, IEnumerable extraProp" + }, + { + "title": "src/JsonE/Operators/EvalOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/EvalOperator.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/EvalOperator.cs", + "startLine": 1, + "endLine": 25, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions;\n\nnamespace Json.JsonE.Operators;\n\ninternal class EvalOperator : IOperator\n{\n\tpublic const string Name = \"$eval\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyNoUndefinedProperties(Name);\n\n\t\tvar parameter = obj[Name];\n\t\tif (parameter is not JsonValue value || !value.TryGetValue(out string? source))\n\t\t\tthrow new TemplateException(\"$eval must be given a string expression\");\n\n\t\tvar expression = ExpressionParser.Parse(source.AsSpan());\n\n\t\tvar jsonNode = expression.Evaluate(context);\n\t\treturn jsonNode;\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions;\n\nnamespace Json.JsonE.Operators;\n\ninternal class EvalOperator : IOperator\n{\n\tpublic const string Name = \"$eval\";\n\n\tpublic JsonNode? Evaluate(JsonN" + }, + { + "title": "src/JsonE/Operators/FindOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/FindOperator.cs#L1-L75", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/FindOperator.cs", + "startLine": 1, + "endLine": 75, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\nusing Json.JsonE.Expressions;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class FindOperator : IOperator\n{\n\tprivate static readonly Regex _eachForm = new(@\"^each\\(\\s*(?[a-zA-Z_][a-zA-Z0-9_]*)\\s*(,\\s*(?[a-zA-Z_][a-zA-Z0-9_]*))?\\s*\\)\");\n\n\tpublic const string Name = \"$find\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyPropertyCount(Name, 2);\n\t\tobj.VerifyNoUndefinedProperties(Name, _eachForm);\n\t\n\t\tvar value = JsonE.Evaluate(obj[Name], context);\n\n\t\tvar eachEntry = obj.FirstOrDefault(x => x.Key != Name);\n\t\tif (eachEntry.Value is not JsonValue eachValue)\n\t\t\tthrow new TemplateException(\"each can evaluate string expressions only\");\n\t\tvar eachTemplate = eachValue.GetString();\n\t\tif (eachTemplate is null)\n\t\t\tthrow new TemplateException(\"each can evaluate string expressions only\");\n\n\t\tif (value is not JsonArray array)\n\t\t\tthrow new TemplateException(CommonErrors.IncorrectValueType(Name, \"an array\"));\n\n\t\treturn EvaluateAsArray(array, eachEntry.Key, eachTemplate, context);\n\t}\n\n\tprivate static JsonNode? EvaluateAsArray(JsonArray value, string each, string template, EvaluationContext context)\n\t{\n\t\tvar match = _eachForm.Match(each);\n\t\tvar itemVar = match.Groups[\"var1\"].Value;\n\t\tvar indexVar = match.Groups[\"var2\"].Success ? match.Groups[\"var2\"].Value : null;\n\n\t\tvar itemContext = new JsonObject\n\t\t{\n\t\t\t[itemVar] = null\n\t\t};\n\t\tif (indexVar != null)\n\t\t\titemContext[indexVar] = 0;\n\t\tcontext.Push(itemContext);\n\n\t\tvar found = false;\n\t\tJsonNode? result = null;\n\t\tfor (int i = 0; i < value.Count; i++)\n\t\t{\n\t\t\titemContext[itemVar] = value[i].Clone();\n\t\t\tif (indexVar != null)\n\t\t\t\titemContext[indexVar] = i;\n\n\t\t\tint index = 0;\n\t\t\tif (!ExpressionParser.TryParse(template.AsSpan(), ref index, out var expr))\n\t\t\t\tthrow new TemplateException(\"$match keys must be valid expressions\");\n\n\t\t\tvar localResult = expr!.Evaluate(context);\n\t\t\tif (localResult.IsEquivalentTo(true))\n\t\t\t{\n\t\t\t\tfound = true;\n\t\t\t\tresult = itemContext[itemVar];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tcontext.Pop();\n\t\treturn found ? result : JsonE.DeleteMarker;\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\nusing Json.JsonE.Expressions;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class FindOperator : IOperato" + }, + { + "title": "src/JsonE/Operators/FlattenDeepOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/FlattenDeepOperator.cs#L1-L41", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/FlattenDeepOperator.cs", + "startLine": 1, + "endLine": 41, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class FlattenDeepOperator : IOperator\n{ \n\tpublic const string Name = \"$flattenDeep\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\n\t\tobj.VerifyNoUndefinedProperties(Name);\n\n\t\tvar value = obj[Name];\n\t\tvar array = JsonE.Evaluate(value, context) as JsonArray ??\n\t\t throw new TemplateException(CommonErrors.IncorrectValueType(Name, \"an array\"));\n\n\t\treturn array.SelectMany(Flatten).ToJsonArray();\n\t}\n\n\tprivate static IEnumerable Flatten(JsonNode? node)\n\t{\n\t\tif (node is not JsonArray arr)\n\t\t{\n\t\t\tyield return node;\n\t\t\tyield break;\n\t\t}\n\n\t\tforeach (var item in arr)\n\t\t{\n\t\t\tforeach (var child in Flatten(item))\n\t\t\t{\n\t\t\t\tyield return child;\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class FlattenDeepOperator : IOperator\n{ \n\tpublic const string Name = \"$flatte" + }, + { + "title": "src/JsonE/Operators/FlattenOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/FlattenOperator.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/FlattenOperator.cs", + "startLine": 1, + "endLine": 38, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing static Json.JsonE.Operators.CommonErrors;\n\nnamespace Json.JsonE.Operators;\n\ninternal class FlattenOperator : IOperator\n{ \n\tpublic const string Name = \"$flatten\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyNoUndefinedProperties(Name);\n\t\t\n\t\tvar value = obj[Name];\n\t\tvar array = JsonE.Evaluate(value, context) as JsonArray ??\n\t\t throw new TemplateException(IncorrectValueType(Name, \"an array\"));\n\n\t\treturn array.SelectMany(Flatten).ToJsonArray();\n\t}\n\n\tprivate static IEnumerable Flatten(JsonNode? node)\n\t{\n\t\tif (node is not JsonArray arr)\n\t\t{\n\t\t\tyield return node;\n\t\t\tyield break;\n\t\t}\n\n\t\tforeach (var item in arr)\n\t\t{\n\t\t\tyield return item;\n\t\t}\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing static Json.JsonE.Operators.CommonErrors;\n\nnamespace Json.JsonE.Operators;\n\ninternal class FlattenOperator : IOper" + }, + { + "title": "src/JsonE/Operators/FromNowOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/FromNowOperator.cs#L1-L53", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/FromNowOperator.cs", + "startLine": 1, + "endLine": 53, + "content": "using System;\nusing System.Globalization;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions.Functions;\n\nnamespace Json.JsonE.Operators;\n\ninternal class FromNowOperator : IOperator\n{\n\tpublic const string Name = \"$fromNow\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyNoUndefinedProperties(Name, \"from\");\n\n\t\tvar value = obj[Name];\n\t\tvar intervalStr = JsonE.Evaluate(value, context) as JsonValue ??\n\t\t throw new TemplateException(CommonErrors.IncorrectValueType(Name, \"a string\"));\n\n\t\tif (!intervalStr.TryGetValue(out string? str))\n\t\t\tthrow new TemplateException(\"$fromNow expects a string\");\n\n\t\tstring? argFromStr = null;\n\t\tif (obj.Count == 2)\n\t\t{\n\t\t\tvalue = obj[\"from\"];\n\t\t\tvar fromStr = JsonE.Evaluate(value, context) as JsonValue ??\n\t\t\t throw new TemplateException(CommonErrors.IncorrectValueType(Name, \"a string\"));\n\n\t\t\tif (!fromStr.TryGetValue(out argFromStr))\n\t\t\t\tthrow new TemplateException(\"$fromNow expects a string\");\n\t\t}\n\n\t\tDateTime now;\n\t\tvar interval = Interval.Parse(str);\n\t\tif (argFromStr != null)\n\t\t{\n\t\t\tif (!DateTime.TryParse(argFromStr, out now))\n\t\t\t\tthrow new InterpreterException(CommonErrors.IncorrectArgType(Name));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar nowNode = context.Find(ContextAccessor.Now);\n\t\t\tif (nowNode is not JsonValue nowVal ||\n\t\t\t !nowVal.TryGetValue(out str) ||\n\t\t\t !DateTime.TryParse(str, out now))\n\t\t\t\tthrow new InterpreterException(CommonErrors.IncorrectArgType(Name));\n\t\t}\n\n\t\treturn interval.AddTo(now.ToUniversalTime()).ToString(\"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'FFFFFFFK\", CultureInfo.InvariantCulture);\n\t}\n}", + "snippet": "using System;\nusing System.Globalization;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions.Functions;\n\nnamespace Json.JsonE.Operators;\n\ninternal class FromNowOperator : IOperator\n{\n\tpublic const string Name = \"" + }, + { + "title": "src/JsonE/Operators/IfThenElseOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/IfThenElseOperator.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/IfThenElseOperator.cs", + "startLine": 1, + "endLine": 33, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class IfThenElseOperator : IOperator\n{\n\tpublic const string Name = \"$if\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyNoUndefinedProperties(Name, \"then\", \"else\");\n\n\t\tvar parameter = obj[Name];\n\t\tif (parameter is not JsonValue value || !value.TryGetValue(out string? source))\n\t\t\tthrow new TemplateException(\"$eval must be given a string expression\");\n\n\t\tint index = 0;\n\t\tif (!ExpressionParser.TryParse(source.AsSpan(), ref index, out var expression))\n\t\t\tthrow new TemplateException(\"Expression is not valid\");\n\n\t\tvar cond = expression!.Evaluate(context);\n\t\tvar thenPresent = obj.TryGetValue(\"then\", out var thenValue, out _);\n\t\tvar elsePresent = obj.TryGetValue(\"else\", out var elseValue, out _);\n\n\t\treturn cond.IsTruthy()\n\t\t\t? thenPresent ? JsonE.Evaluate(thenValue, context) : JsonE.DeleteMarker\n\t\t\t: elsePresent ? JsonE.Evaluate(elseValue, context) : JsonE.DeleteMarker;\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class IfThenElseOperator : IOperator\n{\n\tpublic const string Name = \"$if\";\n\n\tpublic Jso" + }, + { + "title": "src/JsonE/Operators/JsonOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/JsonOperator.cs#L1-L46", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/JsonOperator.cs", + "startLine": 1, + "endLine": 46, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class JsonOperator : IOperator\n{\n\tprivate static readonly JsonSerializerOptions _serializerOptions =\n\t\tnew()\n\t\t{\n\t\t\tTypeInfoResolverChain = { JsonESerializerContext.Default },\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t\t};\n\n\tpublic const string Name = \"$json\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyNoUndefinedProperties(Name);\n\t\n\t\tvar value = obj[Name];\n\n\t\tvar evaluated = Sort(JsonE.Evaluate(value, context));\n\t\tevaluated.ValidateNotReturningFunction();\n\n\t\treturn evaluated.AsJsonString(_serializerOptions);\n\t}\n\n\tprivate static JsonNode? Sort(JsonNode? node)\n\t{\n\t\tif (node is not JsonObject obj) return node;\n\n\t\tvar dict = new SortedDictionary(StringComparer.Ordinal);\n\t\tforeach (var kvp in obj)\n\t\t{\n\t\t\tdict[kvp.Key] = Sort(kvp.Value);\n\t\t}\n\t\t\n\t\treturn JsonSerializer.SerializeToNode(dict!, JsonESerializerContext.Default.SortedDictionaryStringJsonNode);\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class JsonOperator : IOpe" + }, + { + "title": "src/JsonE/Operators/LetOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/LetOperator.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/LetOperator.cs", + "startLine": 1, + "endLine": 28, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Operators;\n\ninternal class LetOperator : IOperator\n{\n\tpublic const string Name = \"$let\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyNoUndefinedProperties(Name, \"in\");\n\n\t\tif (obj.Count != 2)\n\t\t\tthrow new TemplateException(\"$let operator requires an `in` clause\");\n\t\n\t\tvar value = obj[Name];\n\n\t\tvar additionalContext = JsonE.Evaluate(value, context);\n\t\tadditionalContext.ValidateAsContext(Name);\n\n\t\tcontext.Push((JsonObject)additionalContext!);\n\t\tvar result = JsonE.Evaluate(obj[\"in\"], context);\n\t\tcontext.Pop();\n\n\t\treturn result;\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Operators;\n\ninternal class LetOperator : IOperator\n{\n\tpublic const string Name = \"$let\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t" + }, + { + "title": "src/JsonE/Operators/MapOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/MapOperator.cs#L1-L105", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/MapOperator.cs", + "startLine": 1, + "endLine": 105, + "content": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\n\nnamespace Json.JsonE.Operators;\n\ninternal class MapOperator : IOperator\n{\n\tprivate static readonly Regex _byForm = new(@\"^each\\(\\s*(?[a-zA-Z_][a-zA-Z0-9_]*)\\s*(,\\s*(?[a-zA-Z_][a-zA-Z0-9_]*))?\\s*\\)\");\n\n\tpublic const string Name = \"$map\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyPropertyCount(Name, 2);\n\t\tobj.VerifyNoUndefinedProperties(Name, _byForm);\n\t\n\t\tvar value = JsonE.Evaluate(obj[Name], context);\n\n\t\tvar eachEntry = obj.FirstOrDefault(x => x.Key != Name);\n\t\tvar eachTemplate = eachEntry.Value;\n\n\t\treturn value switch\n\t\t{\n\t\t\tJsonArray a => EvaluateAsArray(a, eachEntry.Key, eachTemplate, context),\n\t\t\tJsonObject o => EvaluateAsObject(o, eachEntry.Key, eachTemplate, context),\n\t\t\t_ => throw new TemplateException(CommonErrors.IncorrectValueType(Name, \"an array or object\"))\n\t\t};\n\t}\n\n\tprivate static JsonNode? EvaluateAsArray(JsonArray value, string each, JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar match = _byForm.Match(each);\n\t\tvar itemVar = match.Groups[\"var1\"].Value;\n\t\tvar indexVar = match.Groups[\"var2\"].Success ? match.Groups[\"var2\"].Value : null;\n\n\t\tvar itemContext = new JsonObject\n\t\t{\n\t\t\t[itemVar] = null\n\t\t};\n\t\tif (indexVar != null)\n\t\t\titemContext[indexVar] = 0;\n\t\tcontext.Push(itemContext);\n\n\t\tvar array = new JsonArray();\n\t\tfor (int i = 0; i < value.Count; i++)\n\t\t{\n\t\t\titemContext[itemVar] = value[i].Clone();\n\t\t\tif (indexVar != null)\n\t\t\t\titemContext[indexVar] = i;\n\n\t\t\tvar localResult = JsonE.Evaluate(template, context);\n\t\t\tif (!ReferenceEquals(localResult, JsonE.DeleteMarker))\n\t\t\t\tarray.Add(localResult.Clone());\n\t\t}\n\n\t\tcontext.Pop();\n\t\treturn array;\n\t}\n\n\tprivate static JsonNode? EvaluateAsObject(JsonObject value, string each, JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar match = _byForm.Match(each);\n\t\tvar valueVar = match.Groups[\"var1\"].Value;\n\t\tvar keyVar = match.Groups[\"var2\"].Success ? match.Groups[\"var2\"].Value : null;\n\n\t\tvar itemContext = new JsonObject();\n\t\tif (keyVar != null)\n\t\t{\n\t\t\titemContext[valueVar] = null;\n\t\t\titemContext[keyVar] = 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\titemContext[valueVar] = new JsonObject\n\t\t\t{\n\t\t\t\t[\"key\"] = null,\n\t\t\t\t[\"val\"] = null\n\t\t\t};\n\t\t}\n\t\tcontext.Push(itemContext);\n\n\t\tvar obj = new JsonObject();\n\t\tforeach (var kvp in value)\n\t\t{\n\t\t\tif (keyVar != null)\n\t\t\t{\n\t\t\t\titemContext[valueVar] = kvp.Value.Clone();\n\t\t\t\titemContext[keyVar] = kvp.Key;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\titemContext[valueVar]![\"val\"] = kvp.Value.Clone();\n\t\t\t\titemContext[valueVar]![\"key\"] = kvp.Key;\n\t\t\t}\n\n\t\t\tvar evaluated = JsonE.Evaluate(template, context) as JsonObject ?? throw new TemplateException(\"$map on objects expects each(x) to evaluate to an object\");\n\t\t\tMergeOperator.Merge(obj, evaluated);\n\t\t}\n\n\t\tcontext.Pop();\n\t\treturn obj;\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\n\nnamespace Json.JsonE.Operators;\n\ninternal class MapOperator : IOperator\n{\n\tprivate static readonly Regex _byForm = new(@\"^each\\(\\s*(" + }, + { + "title": "src/JsonE/Operators/MatchOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/MatchOperator.cs#L1-L36", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/MatchOperator.cs", + "startLine": 1, + "endLine": 36, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions;\n\nnamespace Json.JsonE.Operators;\n\ninternal class MatchOperator : IOperator\n{\n\tpublic const string Name = \"$match\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyNoUndefinedProperties(Name);\n\t\n\t\tvar value = JsonE.Evaluate(obj[Name], context) as JsonObject ??\n\t\t\tthrow new TemplateException(\"$match can evaluate objects only\");\n\n\t\tvar array = new JsonArray();\n\t\tforeach (var kvp in value.OrderBy(x => x.Key, StringComparer.Ordinal))\n\t\t{\n\t\t\tint index = 0;\n\t\t\tif (!ExpressionParser.TryParse(kvp.Key.AsSpan(), ref index, out var expr))\n\t\t\t\tthrow new TemplateException(\"$match keys must be valid expressions\");\n\n\t\t\tvar result = expr!.Evaluate(context);\n\t\t\tif (result is not JsonValue val || !val.TryGetValue(out bool b))\n\t\t\t\tthrow new InterpreterException(\"$match keys must evaluate to a boolean\");\n\n\t\t\tif (b) array.Add(kvp.Value.Clone());\n\t\t}\n\n\t\treturn array;\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions;\n\nnamespace Json.JsonE.Operators;\n\ninternal class MatchOperator : IOperator\n{\n\tpublic const string Name = \"$match\";\n\n\tpublic Jso" + }, + { + "title": "src/JsonE/Operators/MergeDeepOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/MergeDeepOperator.cs#L1-L40", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/MergeDeepOperator.cs", + "startLine": 1, + "endLine": 40, + "content": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class MergeDeepOperator : IOperator\n{ \n\tpublic const string Name = \"$mergeDeep\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyNoUndefinedProperties(Name);\n\n\t\tvar value = obj[Name]!;\n\t\tvar array = JsonE.Evaluate(value, context) as JsonArray ??\n\t\t throw new TemplateException(CommonErrors.IncorrectValueType(Name, \"an array of objects\"));\n\n\t\treturn array.Aggregate(new JsonObject(), Merge);\n\t}\n\n\tprivate static JsonObject Merge(JsonObject result, JsonNode? current)\n\t{\n\t\tvar obj = current as JsonObject ?? throw new TemplateException(CommonErrors.IncorrectValueType(Name, \"an array of objects\"));\n\n\t\tforeach (var kvp in obj)\n\t\t{\n\t\t\tvar local = result[kvp.Key];\n\t\t\tif (local is JsonArray localArr && kvp.Value is JsonArray objArray) \n\t\t\t\tresult[kvp.Key] = localArr.Concat(objArray).ToJsonArray();\n\t\t\telse if (local is JsonObject localObj && kvp.Value is JsonObject objObj)\n\t\t\t\tresult[kvp.Key] = Merge(localObj, objObj);\n\t\t\telse\n\t\t\t\tresult[kvp.Key] = kvp.Value.Clone();\n\t\t}\n\n\t\treturn result;\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class MergeDeepOperator : IOperator\n{ \n\tpublic const string Name = \"$mergeDeep\";\n\n\tpublic JsonNode? Evaluate(Js" + }, + { + "title": "src/JsonE/Operators/MergeOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/MergeOperator.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/MergeOperator.cs", + "startLine": 1, + "endLine": 33, + "content": "using System.Linq;\nusing System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Operators;\n\ninternal class MergeOperator : IOperator\n{ \n\tpublic const string Name = \"$merge\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyNoUndefinedProperties(Name);\n\n\t\tvar value = obj[Name]!;\n\t\tvar array = JsonE.Evaluate(value, context) as JsonArray ??\n\t\t throw new TemplateException(CommonErrors.IncorrectValueType(Name, \"an array of objects\"));\n\n\t\treturn array.Aggregate(new JsonObject(), Merge);\n\t}\n\n\tpublic static JsonObject Merge(JsonObject result, JsonNode? current)\n\t{\n\t\tvar obj = current as JsonObject ?? throw new TemplateException(CommonErrors.IncorrectValueType(Name, \"an array of objects\"));\n\n\t\tforeach (var kvp in obj)\n\t\t{\n\t\t\tresult[kvp.Key] = kvp.Value.Clone();\n\t\t}\n\n\t\treturn result;\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json.Nodes;\n\nnamespace Json.JsonE.Operators;\n\ninternal class MergeOperator : IOperator\n{ \n\tpublic const string Name = \"$merge\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, Evaluat" + }, + { + "title": "src/JsonE/Operators/OperatorRepository.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/OperatorRepository.cs#L1-L52", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/OperatorRepository.cs", + "startLine": 1, + "endLine": 52, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\n\nnamespace Json.JsonE.Operators;\n\ninternal static class OperatorRepository\n{\n\tprivate static readonly Dictionary _operators = new()\n\t{\n\t\t[EvalOperator.Name] = new EvalOperator(),\n\t\t[FindOperator.Name] = new FindOperator(),\n\t\t[FlattenOperator.Name] = new FlattenOperator(),\n\t\t[FlattenDeepOperator.Name] = new FlattenDeepOperator(),\n\t\t[FromNowOperator.Name] = new FromNowOperator(),\n\t\t[IfThenElseOperator.Name] = new IfThenElseOperator(),\n\t\t[JsonOperator.Name] = new JsonOperator(),\n\t\t[LetOperator.Name] = new LetOperator(),\n\t\t[MapOperator.Name] = new MapOperator(),\n\t\t[MatchOperator.Name] = new MatchOperator(),\n\t\t[MergeOperator.Name] = new MergeOperator(),\n\t\t[MergeDeepOperator.Name] = new MergeDeepOperator(),\n\t\t[ReduceOperator.Name] = new ReduceOperator(),\n\t\t[ReverseOperator.Name] = new ReverseOperator(),\n\t\t[SortOperator.Name] = new SortOperator(),\n\t\t[SwitchOperator.Name] = new SwitchOperator(),\n\t\t[\"$default\"] = null!\n\t};\n\n\tpublic static IOperator? Get(JsonNode? node)\n\t{\n\t\tif (node is not JsonObject obj) return null;\n\n\t\tvar operatorKeys = obj.Select(x => x.Key).Intersect(_operators.Keys).ToArray();\n\t\tvar op = operatorKeys.Length switch\n\t\t{\n\t\t\t> 1 => throw new TemplateException(\"only one operator allowed\"),\n\t\t\t0 => HasReservedWords(obj)\n\t\t\t\t? throw new TemplateException(\"$ is reserved; use $$\")\n\t\t\t\t: null,\n\t\t\t_ => _operators[operatorKeys[0]]\n\t\t};\n\n\t\treturn op;\n\t}\n\n\tprivate static bool HasReservedWords(JsonObject obj)\n\t{\n\t\treturn obj.Any(x => Regex.IsMatch(x.Key, @\"^\\$[^${]\"));\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\n\nnamespace Json.JsonE.Operators;\n\ninternal static class OperatorRepository\n{\n\tprivate static readon" + }, + { + "title": "src/JsonE/Operators/ReduceOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/ReduceOperator.cs#L1-L63", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/ReduceOperator.cs", + "startLine": 1, + "endLine": 63, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\n\nnamespace Json.JsonE.Operators;\n\ninternal class ReduceOperator : IOperator\n{ \n\tprivate static readonly Regex _byForm = new(@\"^each\\(\\s*(?[a-zA-Z_][a-zA-Z0-9_]*)\\s*(,\\s*(?[a-zA-Z_][a-zA-Z0-9_]*))?(,\\s*(?[a-zA-Z_][a-zA-Z0-9_]*))?\\s*\\)\");\n\n\tpublic const string Name = \"$reduce\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyPropertyCount(Name, 3);\n\t\tobj.VerifyNoUndefinedProperties(Name, \"initial\", _byForm);\n\n\t\tvar value = JsonE.Evaluate(obj[Name], context);\n\t\tif (value is not JsonArray items)\n\t\t\tthrow new TemplateException(CommonErrors.IncorrectValueType(Name, \"an array\"));\n\n\t\tvar initial = JsonE.Evaluate(obj[\"initial\"], context);\n\n\t\tvar eachEntry = obj.FirstOrDefault(x => x.Key is not (Name or \"initial\"));\n\t\tvar eachTemplate = eachEntry.Value;\n\n\t\treturn EvaluateAsArray(items, initial, eachEntry.Key, eachTemplate, context);\n\t}\n\n\tprivate static JsonNode? EvaluateAsArray(JsonArray value, JsonNode? initial, string each, JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar match = _byForm.Match(each);\n\t\tvar accVar = match.Groups[\"var1\"].Value;\n\t\tvar itemVar = match.Groups[\"var2\"].Value;\n\t\tvar indexVar = match.Groups[\"var3\"].Success ? match.Groups[\"var3\"].Value : null;\n\n\t\tvar itemContext = new JsonObject\n\t\t{\n\t\t\t[accVar] = initial?.Clone(),\n\t\t\t[itemVar] = null\n\t\t};\n\t\tif (indexVar != null)\n\t\t\titemContext[indexVar] = 0;\n\n\t\tcontext.Push(itemContext);\n\n\t\tfor (var i = 0; i < value.Count; i++)\n\t\t{\n\t\t\titemContext[itemVar] = value[i].Clone();\n\t\t\tif (indexVar != null)\n\t\t\t\titemContext[indexVar] = i;\n\n\t\t\tvar localResult = JsonE.Evaluate(template, context);\n\t\t\tif (!ReferenceEquals(localResult, JsonE.DeleteMarker))\n\t\t\t\titemContext[accVar] = localResult.Clone();\n\t\t}\n\n\t\tcontext.Pop();\n\t\treturn itemContext[accVar];\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\n\nnamespace Json.JsonE.Operators;\n\ninternal class ReduceOperator : IOperator\n{ \n\tprivate static readonly Regex _byForm =" + }, + { + "title": "src/JsonE/Operators/ReverseOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/ReverseOperator.cs#L1-L22", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/ReverseOperator.cs", + "startLine": 1, + "endLine": 22, + "content": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class ReverseOperator : IOperator\n{ \n\tpublic const string Name = \"$reverse\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyNoUndefinedProperties(Name);\n\n\t\tvar value = obj[Name]!;\n\t\tvar array = JsonE.Evaluate(value, context) as JsonArray ??\n\t\t throw new TemplateException(CommonErrors.IncorrectValueType(Name, \"an array of objects\"));\n\n\t\treturn array.Reverse().ToJsonArray();\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class ReverseOperator : IOperator\n{ \n\tpublic const string Name = \"$reverse\";\n\n\tpublic JsonNode? Evaluate(JsonNo" + }, + { + "title": "src/JsonE/Operators/SortOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/SortOperator.cs#L1-L119", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/SortOperator.cs", + "startLine": 1, + "endLine": 119, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\nusing Json.JsonE.Expressions;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninternal class SortOperator : IOperator\n{\n\tprivate static readonly Regex _byForm = new(@\"^by\\(\\s*(?[a-zA-Z_][a-zA-Z0-9_]*)\\s*\\)\");\n\n\tpublic const string Name = \"$sort\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyNoUndefinedProperties(Name, _byForm);\n\n\t\tif (obj.Count > 2)\n\t\t\tthrow new TemplateException(\"Expected no more than two keys\");\n\n\t\tvar parameter = obj[Name];\n\t\tif (!parameter.IsTemplateOr())\n\t\t\tthrow new TemplateException(CommonErrors.SortSameType());\n\n\t\tvar value = JsonE.Evaluate(parameter, context)!.AsArray();\n\t\tif (value.Count == 0) return value;\n\n\t\tvar sortExpression = ExpressionParser.Parse(\"x\".AsSpan());\n\t\tvar variableName = \"x\";\n\n\t\tvar accessorEntry = obj.FirstOrDefault(x => x.Key != Name);\n\t\tif (accessorEntry.Key != null)\n\t\t{\n\t\t\tsortExpression = ExpressionParser.Parse(accessorEntry.Value!.GetValue().AsSpan());\n\t\t\tvariableName = _byForm.Match(accessorEntry.Key).Groups[\"var\"].Value;\n\t\t}\n\n\t\tvar itemContext = new JsonObject\n\t\t{\n\t\t\t[variableName] = value[0].Clone()\n\t\t};\n\t\tcontext.Push(itemContext);\n\t\tvar firstSortValue = sortExpression.Evaluate(context);\n\t\tvar comparer = firstSortValue switch\n\t\t{\n\t\t\tJsonValue v when v.TryGetValue(out _) => JsonNodeCharComparer.Instance,\n\t\t\tJsonValue v when v.TryGetValue(out _) => JsonNodeStringComparer.Instance,\n\t\t\tJsonValue v when v.GetNumber() != null => JsonNodeNumberComparer.Instance,\n\t\t\t_ => (IComparer?)null\n\t\t} ?? throw new TemplateException(CommonErrors.SortSameType());\n\n\t\ttry\n\t\t{\n\t\t\tvar sorted = value.OrderBy(x =>\n\t\t\t{\n\t\t\t\titemContext[variableName] = x.Clone();\n\t\t\t\treturn sortExpression.Evaluate(context);\n\t\t\t}, comparer!).ToJsonArray();\n\n\t\t\tcontext.Pop();\n\t\t\treturn sorted;\n\t\t}\n\t\tcatch (InvalidOperationException e)\n\t\t{\n\t\t\t// .OrderBy() seems to have its own try/catch which wraps any exceptions.\n\t\t\t// I hate doing this, but I really want the exception thrown by the comparer.\n\t\t\tthrow e.InnerException!;\n\t\t}\n\t}\n}\n\ninternal class JsonNodeCharComparer : IComparer\n{\n\tpublic static JsonNodeCharComparer Instance { get; } = new();\n\n\tprivate JsonNodeCharComparer(){}\n\n\tpublic int Compare(JsonNode? x, JsonNode? y)\n\t{\n\t\tvar sX = (x as JsonValue)?.GetValue() ?? throw new TemplateException(CommonErrors.SortSameType());\n\t\tvar sY = (y as JsonValue)?.GetValue() ?? throw new TemplateException(CommonErrors.SortSameType());\n\n\t\treturn sX < sY ? -1 : 1;\n\t}\n}\n\ninternal class JsonNodeStringComparer : IComparer\n{\n\tpublic static JsonNodeStringComparer Instance { get; } = new();\n\n\tprivate JsonNodeStringComparer(){}\n\n\tpublic int Compare(JsonNode? x, JsonNode? y)\n\t{\n\t\tvar sX = (x as JsonValue)?.GetValue() ?? throw new TemplateException(CommonErrors.SortSameType());\n\t\tvar sY = (y as JsonValue)?.GetValue() ?? throw new TemplateException(CommonErrors.SortSameType());\n\n\t\treturn string.CompareOrdinal(sX, sY);\n\t}\n}\n\ninternal class JsonNodeNumberComparer : IComparer\n{\n\tpublic static JsonNodeNumberComparer Instance { get; } = new();\n\n\tprivate JsonNodeNumberComparer(){}\n\n\tpublic int Compare(JsonNode? x, JsonNode? y)\n\t{\n\t\tvar nX = (x as JsonValue)?.GetNumber() ?? throw new TemplateException(CommonErrors.SortSameType());\n\t\tvar nY = (y as JsonValue)?.GetNumber() ?? throw new TemplateException(CommonErrors.SortSameType());\n\n\t\treturn nX <= nY ? -1 : 1;\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\nusing Json.JsonE.Expressions;\nusing Json.More;\n\nnamespace Json.JsonE.Operators;\n\ninte" + }, + { + "title": "src/JsonE/Operators/SwitchOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/Operators/SwitchOperator.cs#L1-L56", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/Operators/SwitchOperator.cs", + "startLine": 1, + "endLine": 56, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions;\n\nnamespace Json.JsonE.Operators;\n\ninternal class SwitchOperator : IOperator\n{\n\tpublic const string Name = \"$switch\";\n\n\tpublic JsonNode? Evaluate(JsonNode? template, EvaluationContext context)\n\t{\n\t\tvar obj = template!.AsObject();\n\t\tobj.VerifyNoUndefinedProperties(Name);\n\n\t\tvar parameter = obj[Name];\n\t\tif (!parameter.IsTemplateOr())\n\t\t\tthrow new TemplateException(\"$switch can evaluate objects only\");\n\n\t\tvar valuesToCheck = parameter!.AsObject();\n\n\t\t// $default may be present but null-valued\n\t\tvar def = valuesToCheck.FirstOrDefault(x => x.Key == \"$default\");\n\n\t\tvar array = new JsonArray();\n\t\tforeach (var kvp in valuesToCheck.Where(x => x.Key != \"$default\").OrderBy(x => x.Key, StringComparer.Ordinal))\n\t\t{\n\t\t\tint index = 0;\n\t\t\tif (!ExpressionParser.TryParse(kvp.Key.AsSpan(), ref index, out var expr))\n\t\t\t\tthrow new TemplateException(\"$switch keys must be valid expressions\");\n\n\t\t\tvar result = expr!.Evaluate(context);\n\t\t\tif (result is not JsonValue val || !val.TryGetValue(out bool b))\n\t\t\t\tthrow new InterpreterException(\"$switch keys must evaluate to a boolean\");\n\n\t\t\tif (b)\n\t\t\t{\n\t\t\t\tvar value = JsonE.Evaluate(kvp.Value, context);\n\t\t\t\tarray.Add(value.Clone());\n\t\t\t}\n\t\t}\n\n\t\tif (array.Count > 1)\n\t\t\tthrow new TemplateException(\"$switch can only have one truthy condition\");\n\n\t\tif (array.Count == 0)\n\t\t{\n\t\t\tif (def.Key == \"$default\") return JsonE.Evaluate(def.Value, context);\n\n\t\t\treturn JsonE.DeleteMarker;\n\t\t}\n\n\t\treturn array[0];\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.JsonE.Expressions;\n\nnamespace Json.JsonE.Operators;\n\ninternal class SwitchOperator : IOperator\n{\n\tpublic const string Name = \"$switch\";\n\n\tpublic J" + }, + { + "title": "src/JsonE/SyntaxException.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/SyntaxException.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/SyntaxException.cs", + "startLine": 1, + "endLine": 15, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Thrown from when an expression contains invalid syntax.\n/// \npublic class SyntaxException : JsonEException\n{\n\t/// \n\t/// Creates a new instance of .\n\t/// \n\t/// The error message.\n\tpublic SyntaxException(string message) : base(message) {}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Thrown from when an expression contains invalid syntax.\n/// \npublic class SyntaxExcepti" + }, + { + "title": "src/JsonE/TemplateException.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/TemplateException.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/TemplateException.cs", + "startLine": 1, + "endLine": 15, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Thrown from when a template is invalid.\n/// \npublic class TemplateException : JsonEException\n{\n\t/// \n\t/// Creates a new instance of .\n\t/// \n\t/// The error message.\n\tpublic TemplateException(string message) : base(message){}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Thrown from when a template is invalid.\n/// \npublic class TemplateException : JsonEExcep" + }, + { + "title": "src/JsonE/TypeException.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonE/TypeException.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonE/TypeException.cs", + "startLine": 1, + "endLine": 15, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Thrown from when ???.\n/// \npublic class TypeException : JsonEException\n{\n\t/// \n\t/// Creates a new instance of .\n\t/// \n\t/// The error message.\n\tpublic TypeException(string message) : base(message){}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.JsonE;\n\n/// \n/// Thrown from when ???.\n/// \npublic class TypeException : JsonEException\n{\n\t/// " + }, + { + "title": "src/JsonLogic.Tests/AddTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/AddTests.cs#L1-L59", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/AddTests.cs", + "startLine": 1, + "endLine": 59, + "content": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class AddTests\n{\n\t[Test]\n\tpublic void AddNumbersReturnsSum()\n\t{\n\t\tvar rule = JsonLogic.Add(4, 5);\n\n\t\tvar actual = rule.Apply();\n\t\tJsonAssert.AreEquivalent(9, actual);\n\t}\n\n\t[Test]\n\tpublic void AddSingleNumberDoesNothing()\n\t{\n\t\tvar rule = JsonLogic.Add(3.14);\n\n\t\tvar actual = rule.Apply();\n\t\tJsonAssert.AreEquivalent(3.14, actual);\n\t}\n\n\t[Test]\n\tpublic void AddSingleStringWithNumberCasts()\n\t{\n\t\tvar rule = JsonLogic.Add(\"3.14\");\n\n\t\tvar actual = rule.Apply();\n\t\tJsonAssert.AreEquivalent(3.14, actual);\n\t}\n\n\t[Test]\n\tpublic void AddSingleTrueThrowsError()\n\t{\n\t\tvar rule = JsonLogic.Add(true);\n\n\t\tJsonAssert.AreEquivalent(1, rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void AddSingleFalseThrowsError()\n\t{\n\t\tvar rule = JsonLogic.Add(false);\n\n\t\tJsonAssert.AreEquivalent(0, rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void AddSingleNullReturns0()\n\t{\n\t\tvar rule = JsonLogic.Add(LiteralRule.Null);\n\n\t\tJsonAssert.AreEquivalent(0, rule.Apply());\n\t}\n}", + "snippet": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class AddTests\n{\n\t[Test]\n\tpublic void AddNumbersReturnsSum()\n\t{\n\t\tvar rule = JsonLogic.Add(4, 5);\n\n\t\tvar actual = rul" + }, + { + "title": "src/JsonLogic.Tests/AllTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/AllTests.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/AllTests.cs", + "startLine": 1, + "endLine": 27, + "content": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class AllTests\n{\n\t[Test]\n\tpublic void AllMatchCondition()\n\t{\n\t\tvar rule = new AllRule(JsonNode.Parse(\"[1,2,3]\"),\n\t\t\tnew MoreThanRule(new VariableRule(\"\"), 0));\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void AllDoNotMatchCondition()\n\t{\n\t\tvar rule = new AllRule(JsonNode.Parse(\"[1,-2,3]\"),\n\t\t\tnew MoreThanRule(new VariableRule(\"\"), 0));\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class AllTests\n{\n\t[Test]\n\tpublic void AllMatchCondition()\n\t{\n\t\tvar rule = new AllRule(J" + }, + { + "title": "src/JsonLogic.Tests/BooleanCastTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/BooleanCastTests.cs#L1-L97", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/BooleanCastTests.cs", + "startLine": 1, + "endLine": 97, + "content": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class BooleanCastTests\n{\n\t[Test]\n\tpublic void EmptyArrayIsFalse()\n\t{\n\t\tvar rule = new BooleanCastRule(JsonNode.Parse(\"[]\"));\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void NonEmptyArrayIsTrue()\n\t{\n\t\tvar rule = new BooleanCastRule(JsonNode.Parse(\"[1]\"));\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void EmptyStringIsFalse()\n\t{\n\t\tvar rule = new BooleanCastRule(\"\");\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void NonEmptyStringIsTrue()\n\t{\n\t\tvar rule = new BooleanCastRule(\"foo\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void ZeroIsFalse()\n\t{\n\t\tvar rule = new BooleanCastRule(0);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void NonZeroIsTrue()\n\t{\n\t\tvar rule = new BooleanCastRule(1);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void FalseIsFalse()\n\t{\n\t\tvar rule = new BooleanCastRule(false);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void TrueIsTrue()\n\t{\n\t\tvar rule = new BooleanCastRule(true);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void NullIsFalse()\n\t{\n\t\tvar rule = new BooleanCastRule(JsonNode.Parse(\"null\"));\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void EmptyObjectIsFalse()\n\t{\n\t\tvar rule = new BooleanCastRule(JsonNode.Parse(\"{}\"));\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void NonEmptyObjectIsTrue()\n\t{\n\t\tvar rule = new BooleanCastRule(JsonNode.Parse(\"{\\\"foo\\\":1}\"));\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class BooleanCastTests\n{\n\t[Test]\n\tpublic void EmptyArrayIsFalse()\n\t{\n\t\tvar rule = new B" + }, + { + "title": "src/JsonLogic.Tests/CatTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/CatTests.cs#L1-L68", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/CatTests.cs", + "startLine": 1, + "endLine": 68, + "content": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class CatTests\n{\n\t[Test]\n\tpublic void CatTwoStringsConcatsValues()\n\t{\n\t\tvar rule = JsonLogic.Cat(\"foo\", \"bar\");\n\n\t\tJsonAssert.AreEquivalent(\"foobar\", rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void CatStringAndNullConcatsValues()\n\t{\n\t\tvar rule = JsonLogic.Cat(\"foo\", LiteralRule.Null);\n\n\t\tJsonAssert.AreEquivalent(\"foo\", rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void CatStringAndNumberConcatsValues()\n\t{\n\t\tvar rule = JsonLogic.Cat(\"foo\", 1);\n\n\t\tJsonAssert.AreEquivalent(\"foo1\", rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void CatStringAndBooleanConcatsValues()\n\t{\n\t\tvar rule = JsonLogic.Cat(\"foo\", true);\n\n\t\tJsonAssert.AreEquivalent(\"footrue\", rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void CatStringAndArrayConcatsValues()\n\t{\n\t\tvar array = new JsonArray(1, 2, 3);\n\t\tvar rule = JsonLogic.Cat(\"foo\", array);\n\n\t\tJsonAssert.AreEquivalent(\"foo1,2,3\", rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void CatStringAndNestedArrayConcatsValues()\n\t{\n\t\tvar array = new JsonArray(1, 2, 3);\n\t\tvar nestedArray = new JsonArray(1, array, 3);\n\t\tvar rule = JsonLogic.Cat(\"foo\", nestedArray);\n\n\t\tJsonAssert.AreEquivalent(\"foo1,1,2,3,3\", rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void CatStringAndObjectConcatsValues()\n\t{\n\t\tvar rule = JsonLogic.Cat(\"foo\", JsonNode.Parse(\"{}\")!);\n\n\t\tAssert.Throws(() => rule.Apply());\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class CatTests\n{\n\t[Test]\n\tpublic void CatTwoStringsConcatsValues()\n\t{\n\t\tvar rule = Json" + }, + { + "title": "src/JsonLogic.Tests/DevTest.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/DevTest.cs#L1-L11", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/DevTest.cs", + "startLine": 1, + "endLine": 11, + "content": "using NUnit.Framework;\n\nnamespace Json.Logic.Tests;\n\npublic class DevTest\n{\n\t[Test]\n\tpublic void Check()\n\t{\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nnamespace Json.Logic.Tests;\n\npublic class DevTest\n{\n\t[Test]\n\tpublic void Check()\n\t{\n\t}\n}" + }, + { + "title": "src/JsonLogic.Tests/DivideTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/DivideTests.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/DivideTests.cs", + "startLine": 1, + "endLine": 17, + "content": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class DivideTests\n{\n\t[Test]\n\tpublic void DivideNumbersReturnsSum()\n\t{\n\t\tvar rule = new DivideRule(4, 5);\n\n\t\tvar actual = rule.Apply();\n\t\tJsonAssert.AreEquivalent(.8, actual);\n\t}\n}", + "snippet": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class DivideTests\n{\n\t[Test]\n\tpublic void DivideNumbersReturnsSum()\n\t{\n\t\tvar rule = new DivideRule(4, 5);\n\n\t\tvar actua" + }, + { + "title": "src/JsonLogic.Tests/ExtensionTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/ExtensionTests.cs#L1-L22", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/ExtensionTests.cs", + "startLine": 1, + "endLine": 22, + "content": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.Logic.Tests;\n\npublic class ExtensionTests\n{\n\t[TestCase(\"0\", false)]\n\t[TestCase(\"1\", true)]\n\t[TestCase(\"-1\", true)]\n\t[TestCase(\"[]\", false)]\n\t[TestCase(\"[1,2]\", true)]\n\t[TestCase(\"\\\"\\\"\", false)]\n\t[TestCase(\"\\\"anything\\\"\", true)]\n\t[TestCase(\"null\", false)]\n\tpublic void Truthiness(string text, bool expected)\n\t{\n\t\tvar json = JsonNode.Parse(text);\n\n\t\tAssert.That(json.IsTruthy(), Is.EqualTo(expected));\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.Logic.Tests;\n\npublic class ExtensionTests\n{\n\t[TestCase(\"0\", false)]\n\t[TestCase(\"1\", true)]\n\t[TestCase(\"-1\", true)]\n\t[TestCase(\"[]\", false)]\n\t[TestCase(" + }, + { + "title": "src/JsonLogic.Tests/GithubTests.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/GithubTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/GithubTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Globalization;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\nusing static Json.Logic.JsonLogic;\n\nnamespace Json.Logic.Tests;\n\npublic class GithubTests\n{\n\t[Test]\n\tpublic void Issue183_RuleEvaluatesWrong_Truthy()\n\t{\n\t\tvar logic = If(\n\t\t\tVariable(\"data.sub\"),\n\t\t\tStrictEquals(\n\t\t\t\tVariable(\"data.sub.0.element\"),\n\t\t\t\t\"12345\"\n\t\t\t),\n\t\t\ttrue\n\t\t);\n\t\tvar json = JsonNode.Parse(@\"{\n \"\"data\"\": {\n\t\"\"sub\"\": [\n\t {\n\t\t\"\"element\"\": \"\"12345\"\"\n\t }\n\t]\n }\n}\");\n\n\t\tvar result = logic.Apply(json);\n\n\t\tJsonAssert.AreEquivalent(true, result);\n\t}\n\t[Test]\n\tpublic void Issue183_RuleEvaluatesWrong_Falsy()\n\t{\n\t\tvar logic = If(\n\t\t\tVariable(\"data.sub\"),\n\t\t\tStrictEquals(\n\t\t\t\tVariable(\"data.sub.0.element\"),\n\t\t\t\t\"12345\"\n\t\t\t),\n\t\t\ttrue\n\t\t);\n\t\tvar json = JsonNode.Parse(@\"{\n \"\"data\"\": {\n\t\"\"sub\"\": [\n\t {\n\t\t\"\"element\"\": \"\"12346\"\"\n\t }\n\t]\n }\n}\");\n\n\t\tvar result = logic.Apply(json);\n\n\t\tJsonAssert.AreEquivalent(false, result);\n\t}\n\n\t[Test]\n\tpublic void Issue183_RuleEvaluatesWrong2_Falsy()\n\t{\n\t\tvar jsonRule = \"{\\\"and\\\":[{\\\"if\\\":[{\\\"var\\\":\\\"data.r.0\\\"},{\\\"in\\\":[{\\\"var\\\":\\\"data.r.0.tg\\\"},[\\\"140539006\\\"]]},true]},{\\\"if\\\":[{\\\"var\\\":\\\"data.t.0\\\"},{\\\"in\\\":[{\\\"var\\\":\\\"data.t.0.tg\\\"},[\\\"140539006\\\"]]},true]},{\\\"if\\\":[{\\\"var\\\":\\\"data.v.0\\\"},{\\\"in\\\":[{\\\"var\\\":\\\"data.v.0.tg\\\"},[\\\"140539006\\\"]]},true]}]}\";\n\t\tvar rule = JsonSerializer.Deserialize(jsonRule, TestSerializerContext.Default.Rule);\n\n\t\tvar data = JsonNode.Parse(\"{\\\"data\\\":{\\\"r\\\":[{\\\"tg\\\":\\\"140539006\\\"}],\\\"t\\\":[{\\\"tg\\\":\\\"140539006\\\"}],\\\"v\\\":[{\\\"tg\\\":\\\"Test\\\"}]}}\");\n\n\t\tvar result = rule!.Apply(data);\n\n\t\tJsonAssert.AreEquivalent(false, result);\n\t}\n\n\t[Test]\n\tpublic void Issue183_RuleEvaluatesWrong3_Falsy()\n\t{\n\t\tvar jsonRule = \"{\\\"===\\\":[{\\\"reduce\\\":[[{\\\"var\\\":\\\"data.r\\\"},{\\\"var\\\":\\\"data.t\\\"},{\\\"var\\\":\\\"data.v\\\"}],{\\\"\\\\u002B\\\":[{\\\"var\\\":\\\"accumulator\\\"},{\\\"if\\\":[{\\\"var\\\":\\\"current.0\\\"},1,0]}]},0]},1]}\";\n\t\tvar rule = JsonSerializer.Deserialize(jsonRule, TestSerializerContext.Default.Rule);\n\n\n\t\tvar data = JsonNode.Parse(\"{\\\"data\\\":{\\\"r\\\":[{\\\"tg\\\":\\\"140539006\\\"},{\\\"tg\\\":\\\"140539006\\\"}]}}\");\n\n\t\tvar result = rule!.Apply(data);\n\n\t\tJsonAssert.AreEquivalent(true, result);\n\t}\n\n\t[Test]\n\t[Ignore(\"some changes the resolution of var\")]\n\tpublic void Issue263_SomeInTest()\n\t{\n\t\tvar rule = Some(\n\t\t\tVariable(\"x\"),\n\t\t\tIn(\n\t\t\t\tVariable(\"\"),\n\t\t\t\tVariable(\"y\")\n\t\t\t)\n\t\t);\n\n\t\tvar data = JsonNode.Parse(\"{\\\"x\\\":[-1, 0, 1],\\\"y\\\":[2, 3, 1]}\");\n\n\t\tJsonAssert.IsTrue(rule.Apply(data));\n\t}\n\n\t[Test]\n\tpublic void Issue286_InShouldReturnFalseForNonArray()\n\t{\n\t\tvar rule = JsonSerializer.Deserialize(\"{ \\\"in\\\" : [ {\\\"var\\\": \\\"item\\\"}, {\\\"var\\\": \\\"list\\\"} ] }\", TestSerializerContext.Default.Rule);\n\t\tvar result = rule!.Apply(new JsonObject { [\"some_item\"] = 123 });\n\n\t\tJsonAssert.IsFalse(result);\n\t}\n\n\t[Test]\n\tpublic void Pull303_CustomConverters()", + "snippet": "using System;\nusing System.Globalization;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\nusing static Json.Logic.JsonLogic;\n\nnames" + }, + { + "title": "src/JsonLogic.Tests/GithubTests.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/GithubTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/GithubTests.cs", + "startLine": 121, + "endLine": 240, + "content": "{\n\t\tvar rule = JsonSerializer.Deserialize(\"{ \\\"+\\\" : [ 1, 2 ] }\", TestSerializerContext.Default.Rule);\n\n\t\tAssert.That(rule, Is.InstanceOf());\n\t\tAssert.That(rule!.Apply().IsEquivalentTo(3), Is.True);\n\t}\n\n\t[Test]\n\tpublic void Issue313_VarEqualsNull()\n\t{\n\t\tvar node = JsonNode.Parse(@\"{\n \"\"==\"\": [\n\t{\"\"var\"\": \"\"value\"\"},\n\tnull\n ]\n}\");\n\n\t\tvar rule = node.Deserialize(TestSerializerContext.Default.Rule);\n\t\tvar result = rule!.Apply(JsonNode.Parse(\"{\\\"value\\\": null}\"));\n\n\t\tJsonAssert.IsTrue(result);\n\t}\n\n\t[Test]\n\tpublic void Issue318_CanParseStringAsFloatingPointNumberInAnyCulture()\n\t{\n\t\tvar culture = CultureInfo.CurrentCulture;\n\n\t\ttry\n\t\t{\n\t\t\tCultureInfo.CurrentCulture = new CultureInfo(\"de-AT\");\n\t\t\tvar number = JsonValue.Create(\"3.14\").Numberify();\n\n\t\t\tAssert.That(number, Is.EqualTo(3.14d));\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tCultureInfo.CurrentCulture = culture;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void Issue383_NoneUsesLocalValueForVarResolution()\n\t{\n\t\tvar rule = None(\n\t\t\tVariable(\"additionalDrivers\"),\n\t\t\tStrictEquals(\n\t\t\t\tVariable(\"relationshipToProposer.dataCode\"),\n\t\t\t\t\"J\"\n\t\t\t)\n\t\t);\n\n\t\tvar data = JsonNode.Parse(@\"{\n\t\"\"hasAdditionalDrivers\"\": true,\n\t\"\"additionalDrivers\"\": [\n\t\t{}\n\t],\n\t\"\"relationshipToProposer\"\": {\n\t\t\"\"dataCode\"\": \"\"J\"\",\n\t\t\"\"displayText\"\": null\n\t}\n}\");\n\n\t\tvar result = rule.Apply(data);\n\n\t\tTestConsole.WriteLine(result.AsJsonString());\n\n\t\tJsonAssert.IsTrue(result);\n\t}\n\n\t[Test]\n\tpublic void Issue807_NestedVar()\n\t{\n\t\tvar rule =\n\t\t\tMultiply(\n\t\t\t\tVariable(\"amount\"),\n\t\t\t\tVariable(Variable(\"target_currency\")),\n\t\t\t\tDivide(1,\n\t\t\t\t\tVariable(Variable(\"source_currency\"))));\n\n\t\tvar data = JsonNode.Parse(@\"{\n\t\"\"amount\"\": \"\"100\"\",\n\t\"\"source_currency\"\": \"\"GBP\"\",\n\t\"\"target_currency\"\": \"\"EUR\"\",\n\t\"\"GBP\"\": \"\"1.1\"\",\n\t\"\"EUR\"\": \"\"0.8\"\"\n}\");\n\n\t\tvar result = rule.Apply(data);\n\n\t\tTestConsole.WriteLine(result.AsJsonString());\n\n\t\tvar actual = Math.Round(result!.GetValue(), 6);\n\n\t\tAssert.That(actual, Is.EqualTo(72.727273m));\n\t}\n\n\t[Test]\n\tpublic void Issue807_NestedVar_Parsed()\n\t{\n\t\tvar rule = JsonSerializer.Deserialize(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"*\": [{\n\t\t\t \"var\": \"amount\"\n\t\t\t }, {\n\t\t\t \"var\": {\n\t\t\t \"var\": \"target_currency\"\n\t\t\t }\n\t\t\t }, {\n\t\t\t \"/\": [\"1\", {\n\t\t\t \"var\": {\n\t\t\t \"var\": \"source_currency\"\n\t\t\t }\n\t\t\t }\n\t\t\t ]\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\", TestEnvironment.SerializerOptions);", + "snippet": "{\n\t\tvar rule = JsonSerializer.Deserialize(\"{ \\\"+\\\" : [ 1, 2 ] }\", TestSerializerContext.Default.Rule);\n\n\t\tAssert.That(rule, Is.InstanceOf());\n\t\tAssert.That(rule!.Apply().IsEquivalentTo(3), Is.True);\n\t}\n\n\t[Test]\n" + }, + { + "title": "src/JsonLogic.Tests/GithubTests.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/GithubTests.cs#L241-L284", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/GithubTests.cs", + "startLine": 241, + "endLine": 284, + "content": "var data = JsonNode.Parse(@\"{\n\t\"\"amount\"\": \"\"100\"\",\n\t\"\"source_currency\"\": \"\"GBP\"\",\n\t\"\"target_currency\"\": \"\"EUR\"\",\n\t\"\"GBP\"\": \"\"1.1\"\",\n\t\"\"EUR\"\": \"\"0.8\"\"\n}\");\n\n\t\tvar result = rule!.Apply(data);\n\n\t\tTestConsole.WriteLine(result.AsJsonString());\n\n\t\tvar actual = Math.Round(result!.GetValue(), 6);\n\n\t\tAssert.That(actual, Is.EqualTo(72.727273m));\n\t}\n\n\t[Test]\n\tpublic void Issue820_NotArrayWithMultipleValues()\n\t{\n\t\tvar rule = JsonNode.Parse(\"{ \\\"!\\\": [{ \\\"var\\\": \\\"a\\\" }, false] }\");\n\t\tvar data = new JsonObject();\n\n\t\tvar result = Apply(rule, data);\n\n\t\tTestConsole.WriteLine(result.AsJsonString());\n\n\t\tJsonAssert.IsFalse(result);\n\t}\n\n\t[Test]\n\tpublic void Issue1019_ArrayCoercion()\n\t{\n\t\tvar rule = JsonNode.Parse(\"\"\"{\"==\":[{\"var\":\"features.group1\"}, \"feat1\"]}\"\"\");\n\t\tvar data = JsonNode.Parse(\"\"\"{\"features\":{\"group1\":[\"feat1\"]}}\"\"\");\n\n\t\tvar result = Apply(rule, data);\n\n\t\tTestConsole.WriteLine(result.AsJsonString());\n\n\t\tJsonAssert.IsTrue(result);\n\t}\n}", + "snippet": "var data = JsonNode.Parse(@\"{\n\t\"\"amount\"\": \"\"100\"\",\n\t\"\"source_currency\"\": \"\"GBP\"\",\n\t\"\"target_currency\"\": \"\"EUR\"\",\n\t\"\"GBP\"\": \"\"1.1\"\",\n\t\"\"EUR\"\": \"\"0.8\"\"\n}\");\n\n\t\tvar result = rule!.Apply(data);\n\n\t\tTestConsole.WriteLine(resu" + }, + { + "title": "src/JsonLogic.Tests/IfTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/IfTests.cs#L1-L47", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/IfTests.cs", + "startLine": 1, + "endLine": 47, + "content": "using NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class IfTests\n{\n\t[Test]\n\tpublic void IfStandardReturnsTrueResult()\n\t{\n\t\tvar rule = JsonLogic.If(true, 1, 2);\n\n\t\tJsonAssert.AreEquivalent(1, rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void IfStandardReturnsFalseResult()\n\t{\n\t\tvar rule = JsonLogic.If(false, 1, 2);\n\n\t\tJsonAssert.AreEquivalent(2, rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void IfNullReturnsFalseResult()\n\t{\n\t\tvar rule = JsonLogic.If(null!, 1, 2);\n\n\t\tJsonAssert.AreEquivalent(2, rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void IfStandardReturnsSecondTrueResult()\n\t{\n\t\tvar rule = JsonLogic.If(false, 1, true, 2, 3);\n\n\t\tJsonAssert.AreEquivalent(2, rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void IfStandardReturnsSecondFalseResult()\n\t{\n\t\tvar rule = JsonLogic.If(false, 1, false, 2, 3);\n\n\t\tJsonAssert.AreEquivalent(3, rule.Apply());\n\t}\n}", + "snippet": "using NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class IfTests\n{\n\t[Test]\n\tpublic void IfStandardReturnsTrueResult()\n\t{\n\t\tvar rule = JsonLogic.If(true, 1, 2);\n\n\t\tJsonAssert.AreEquivalent(1, r" + }, + { + "title": "src/JsonLogic.Tests/InTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/InTests.cs#L1-L107", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/InTests.cs", + "startLine": 1, + "endLine": 107, + "content": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class InTests\n{\n\t[Test]\n\tpublic void InTwoStringsSecondContainsFirstReturnsTrue()\n\t{\n\t\tvar rule = new InRule(\"foo\", \"food\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void InTwoStringsNoMatchReturnsFalse()\n\t{\n\t\tvar rule = new InRule(\"foo\", \"bar\");\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void InStringContainsNumberReturnsTrue()\n\t{\n\t\tvar rule = new InRule(4, \"foo4bar\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void InStringContainsBooleanReturnsTrue()\n\t{\n\t\tvar rule = new InRule(true, \"footruebar\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void InStringContainsNullReturnsFalse()\n\t{\n\t\tvar rule = new InRule(true, \"foo\");\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void InStringContainsObjectThrowsError()\n\t{\n\t\tvar rule = new InRule(JsonNode.Parse(\"{}\"), \"foo\");\n\n\t\tAssert.Throws(() => rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void InArrayContainsFirstReturnsTrue()\n\t{\n\t\tvar array = new JsonArray(1, 2, 3);\n\t\tvar rule = new InRule(2, array);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void InArrayDoesNotContainFirstReturnsFalse()\n\t{\n\t\tvar array = new JsonArray(1, 2, 3);\n\t\tvar rule = new InRule(5, array);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void InObjectThrowsError()\n\t{\n\t\tvar rule = new InRule(1, JsonNode.Parse(\"{}\"));\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void InNullThrowsError()\n\t{\n\t\tvar rule = new InRule(1, LiteralRule.Null);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void InBooleanThrowsError()\n\t{\n\t\tvar rule = new InRule(1, false);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void InNumberThrowsError()\n\t{\n\t\tvar rule = new InRule(1, 4);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class InTests\n{\n\t[Test]\n\tpublic void InTwoStringsSecondContainsFirstReturnsTrue()\n\t{\n\t\t" + }, + { + "title": "src/JsonLogic.Tests/LessThanEqualTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/LessThanEqualTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/LessThanEqualTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class LessThanEqualTests\n{\n\t[Test]\n\tpublic void LessThanTwoNumbersReturnsTrue()\n\t{\n\t\tvar rule = new LessThanEqualRule(1, 2);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void EqualTwoNumbersReturnsTrue()\n\t{\n\t\tvar rule = new LessThanEqualRule(2, 2);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void LessThanEqualTwoNumbersReturnsFalse()\n\t{\n\t\tvar rule = new LessThanEqualRule(3, 2);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void LessThanEqualNullCastsNullToZero()\n\t{\n\t\tvar rule = new LessThanEqualRule(LiteralRule.Null, 2);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void LessThanEqualNumberAndStringNumberReturnsTrue()\n\t{\n\t\tvar rule = new LessThanEqualRule(1, \"2\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void LessThanEqualStringNumberAndNumberReturnsTrue()\n\t{\n\t\tvar rule = new LessThanEqualRule(\"1\", 1);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void LessThanEqualTwoStringNumbersReturnsTrue()\n\t{\n\t\tvar rule = new LessThanEqualRule(\"1\", \"2\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void BetweenValueInRangeReturnsTrue()\n\t{\n\t\tvar rule = new LessThanEqualRule(1, 2, 3);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenValueAtLowEndReturnsTrue()\n\t{\n\t\tvar rule = new LessThanEqualRule(1, 1, 3);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenValueUnderLowEndReturnsFalse()\n\t{\n\t\tvar rule = new LessThanEqualRule(1, 0, 3);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenValueAtHighEndReturnsTrue()\n\t{\n\t\tvar rule = new LessThanEqualRule(1, 3, 3);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenValueOverHighEndReturnsFalse()\n\t{\n\t\tvar rule = new LessThanEqualRule(1, 4, 3);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenLowEndNotNumberReturnsFalse()\n\t{\n\t\tvar rule = new LessThanEqualRule(false, 4, 3);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenValueNotNumberReturnsFalse()\n\t{\n\t\tvar rule = new LessThanEqualRule(1, false, 3);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}", + "snippet": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class LessThanEqualTests\n{\n\t[Test]\n\tpublic void LessThanTwoNumbersReturnsTrue()\n\t{\n\t\tvar rule = new LessThanEqualRule" + }, + { + "title": "src/JsonLogic.Tests/LessThanEqualTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/LessThanEqualTests.cs#L121-L152", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/LessThanEqualTests.cs", + "startLine": 121, + "endLine": 152, + "content": "[Test]\n\tpublic void BetweenHighEndNotNumberReturnsFalse()\n\t{\n\t\tvar rule = new LessThanEqualRule(1, 2, false);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void BetweenLowEndStringNumberReturnsTrue()\n\t{\n\t\tvar rule = new LessThanEqualRule(\"1\", 1, 3);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void BetweenValueStringNumberReturnsTrue()\n\t{\n\t\tvar rule = new LessThanEqualRule(1, \"2\", 3);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void BetweenHighEndStringNumberReturnsTrue()\n\t{\n\t\tvar rule = new LessThanEqualRule(1, 2, \"3\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n}", + "snippet": "[Test]\n\tpublic void BetweenHighEndNotNumberReturnsFalse()\n\t{\n\t\tvar rule = new LessThanEqualRule(1, 2, false);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void BetweenLowEndStringNumberReturnsTrue()\n\t{\n\t\tvar" + }, + { + "title": "src/JsonLogic.Tests/LessThanTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/LessThanTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/LessThanTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class LessThanTests\n{\n\t[Test]\n\tpublic void LessThanTwoNumbersReturnsTrue()\n\t{\n\t\tvar rule = new LessThanRule(1, 2);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void EqualTwoNumbersReturnsFalse()\n\t{\n\t\tvar rule = new LessThanRule(1, 1);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void LessThanTwoNumbersReturnsFalse()\n\t{\n\t\tvar rule = new LessThanRule(3, 2);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void LessThanBooleanReturnsTrue()\n\t{\n\t\tvar rule = new LessThanRule(false, 2);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void LessThanNullCastsNullToZero()\n\t{\n\t\tvar rule = new LessThanRule(LiteralRule.Null, 2);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void LessThanNumberAndStringNumberReturnsTrue()\n\t{\n\t\tvar rule = new LessThanRule(1, \"2\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void LessThanStringNumberAndNumberReturnsTrue()\n\t{\n\t\tvar rule = new LessThanRule(\"1\", 2);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void LessThanTwoStringNumbersReturnsTrue()\n\t{\n\t\tvar rule = new LessThanRule(\"1\", \"2\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenValueInRangeReturnsTrue()\n\t{\n\t\tvar rule = new LessThanRule(1, 2, 3);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenValueAtLowEndReturnsFalse()\n\t{\n\t\tvar rule = new LessThanRule(1, 1, 3);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenValueUnderLowEndReturnsFalse()\n\t{\n\t\tvar rule = new LessThanRule(1, 0, 3);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenValueAtHighEndReturnsFalse()\n\t{\n\t\tvar rule = new LessThanRule(1, 3, 3);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenValueOverHighEndReturnsFalse()\n\t{\n\t\tvar rule = new LessThanRule(1, 4, 3);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenLowEndNotNumberReturnsFalse()\n\t{\n\t\tvar rule = new LessThanRule(false, 4, 3);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}", + "snippet": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class LessThanTests\n{\n\t[Test]\n\tpublic void LessThanTwoNumbersReturnsTrue()\n\t{\n\t\tvar rule = new LessThanRule(1, 2);\n\n\t" + }, + { + "title": "src/JsonLogic.Tests/LessThanTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/LessThanTests.cs#L121-L168", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/LessThanTests.cs", + "startLine": 121, + "endLine": 168, + "content": "[Test]\n\tpublic void BetweenValueNotNumberReturnsFalse()\n\t{\n\t\tvar rule = new LessThanRule(1, false, 3);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenHighEndNotNumberReturnsFalse()\n\t{\n\t\tvar rule = new LessThanRule(1, 2, false);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void BetweenStringNumbersInRangeReturnsTrue()\n\t{\n\t\tvar rule = new LessThanRule(\"1\", \"2\", \"3\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void BetweenLowEndStringNumberReturnsTrue()\n\t{\n\t\tvar rule = new LessThanRule(\"1\", 2, 3);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void BetweenValueStringNumberReturnsTrue()\n\t{\n\t\tvar rule = new LessThanRule(1, \"2\", 3);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\t\n\t[Test]\n\tpublic void BetweenHighEndStringNumberReturnsTrue()\n\t{\n\t\tvar rule = new LessThanRule(1, 2, \"3\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n}", + "snippet": "[Test]\n\tpublic void BetweenValueNotNumberReturnsFalse()\n\t{\n\t\tvar rule = new LessThanRule(1, false, 3);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void BetweenHighEndNotNumberReturnsFalse()\n\t{\n\t\tvar rule = n" + }, + { + "title": "src/JsonLogic.Tests/ModTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/ModTests.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/ModTests.cs", + "startLine": 1, + "endLine": 17, + "content": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class ModTests\n{\n\t[Test]\n\tpublic void ModNumbersReturnsSum()\n\t{\n\t\tvar rule = new ModRule(4, 5);\n\n\t\tvar actual = rule.Apply();\n\t\tJsonAssert.AreEquivalent(4, actual);\n\t}\n}", + "snippet": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class ModTests\n{\n\t[Test]\n\tpublic void ModNumbersReturnsSum()\n\t{\n\t\tvar rule = new ModRule(4, 5);\n\n\t\tvar actual = rule." + }, + { + "title": "src/JsonLogic.Tests/MoreThanEqualTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/MoreThanEqualTests.cs#L1-L48", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/MoreThanEqualTests.cs", + "startLine": 1, + "endLine": 48, + "content": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class MoreThanEqualTests\n{\n\t[Test]\n\tpublic void MoreThanEqualTwoNumbersReturnsTrue()\n\t{\n\t\tvar rule = new MoreThanEqualRule(2, 1);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void EqualTwoNumbersReturnsTrue()\n\t{\n\t\tvar rule = new MoreThanEqualRule(1, 1);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void MoreThanEqualTwoNumbersReturnsFalse()\n\t{\n\t\tvar rule = new MoreThanEqualRule(2, 3);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void MoreThanEqualBooleanThrowsError()\n\t{\n\t\tvar rule = new MoreThanEqualRule(false, 2);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void MoreThanEqualNullCastsNullToZero()\n\t{\n\t\tvar rule = new MoreThanEqualRule(LiteralRule.Null, 2);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n}", + "snippet": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class MoreThanEqualTests\n{\n\t[Test]\n\tpublic void MoreThanEqualTwoNumbersReturnsTrue()\n\t{\n\t\tvar rule = new MoreThanEqua" + }, + { + "title": "src/JsonLogic.Tests/MoreThanTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/MoreThanTests.cs#L1-L48", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/MoreThanTests.cs", + "startLine": 1, + "endLine": 48, + "content": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class MoreThanTests\n{\n\t[Test]\n\tpublic void MoreThanTwoNumbersReturnsTrue()\n\t{\n\t\tvar rule = new MoreThanRule(2, 1);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void EqualTwoNumbersReturnsFalse()\n\t{\n\t\tvar rule = new MoreThanRule(1, 1);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void MoreThanTwoNumbersReturnsFalse()\n\t{\n\t\tvar rule = new MoreThanRule(1, 2);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void MoreThanBooleanThrowsError()\n\t{\n\t\tvar rule = new MoreThanRule(false, 2);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void MoreThanNullCastsNullToZero()\n\t{\n\t\tvar rule = new MoreThanRule(LiteralRule.Null, 2);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n}", + "snippet": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class MoreThanTests\n{\n\t[Test]\n\tpublic void MoreThanTwoNumbersReturnsTrue()\n\t{\n\t\tvar rule = new MoreThanRule(2, 1);\n\n\t" + }, + { + "title": "src/JsonLogic.Tests/MultiplyTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/MultiplyTests.cs#L1-L16", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/MultiplyTests.cs", + "startLine": 1, + "endLine": 16, + "content": "using NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class MultiplyTests\n{\n\t[Test]\n\tpublic void MultiplyNumbersReturnsSum()\n\t{\n\t\tvar rule = JsonLogic.Multiply(4, 5);\n\n\t\tvar actual = rule.Apply();\n\t\tJsonAssert.AreEquivalent(20, actual);\n\t}\n}", + "snippet": "using NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class MultiplyTests\n{\n\t[Test]\n\tpublic void MultiplyNumbersReturnsSum()\n\t{\n\t\tvar rule = JsonLogic.Multiply(4, 5);\n\n\t\tvar actual = rule.Apply()" + }, + { + "title": "src/JsonLogic.Tests/NoneTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/NoneTests.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/NoneTests.cs", + "startLine": 1, + "endLine": 27, + "content": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class NoneTests\n{\n\t[Test]\n\tpublic void NoneMatchCondition()\n\t{\n\t\tvar rule = new NoneRule(JsonNode.Parse(\"[1,2,3]\"),\n\t\t\tnew StrictEqualsRule(new VariableRule(\"\"), 2));\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void SomeDoNotMatchCondition()\n\t{\n\t\tvar rule = new NoneRule(JsonNode.Parse(\"[1,2,3]\"),\n\t\t\tnew StrictEqualsRule(new VariableRule(\"\"), 0));\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class NoneTests\n{\n\t[Test]\n\tpublic void NoneMatchCondition()\n\t{\n\t\tvar rule = new NoneRul" + }, + { + "title": "src/JsonLogic.Tests/NotTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/NotTests.cs#L1-L97", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/NotTests.cs", + "startLine": 1, + "endLine": 97, + "content": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class NotTests\n{\n\t[Test]\n\tpublic void EmptyArrayIsTrue()\n\t{\n\t\tvar rule = new NotRule(JsonNode.Parse(\"[]\"));\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void NonEmptyArrayIsFalse()\n\t{\n\t\tvar rule = new NotRule(JsonNode.Parse(\"[1]\"));\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void EmptyStringIsTrue()\n\t{\n\t\tvar rule = new NotRule(\"\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void NonEmptyStringIsFalse()\n\t{\n\t\tvar rule = new NotRule(\"foo\");\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void ZeroIsTrue()\n\t{\n\t\tvar rule = new NotRule(0);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void NonZeroIsFalse()\n\t{\n\t\tvar rule = new NotRule(1);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void FalseIsTrue()\n\t{\n\t\tvar rule = new NotRule(false);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void TrueIsFalse()\n\t{\n\t\tvar rule = new NotRule(true);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void NullIsTrue()\n\t{\n\t\tvar rule = new NotRule(JsonNode.Parse(\"null\"));\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void EmptyObjectIsTrue()\n\t{\n\t\tvar rule = new NotRule(JsonNode.Parse(\"{}\"));\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void NonEmptyObjectIsFalse()\n\t{\n\t\tvar rule = new NotRule(JsonNode.Parse(\"{\\\"foo\\\":5}\"));\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class NotTests\n{\n\t[Test]\n\tpublic void EmptyArrayIsTrue()\n\t{\n\t\tvar rule = new NotRule(Js" + }, + { + "title": "src/JsonLogic.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonLogic.Tests/obj/Debug/net10.0/JsonLogic.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/obj/Debug/net10.0/JsonLogic.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/obj/Debug/net10.0/JsonLogic.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonLogic.Tests/obj/Debug/net8.0/JsonLogic.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/obj/Debug/net8.0/JsonLogic.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/obj/Debug/net8.0/JsonLogic.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonLogic.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonLogic.Tests/obj/Debug/net9.0/JsonLogic.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/obj/Debug/net9.0/JsonLogic.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/obj/Debug/net9.0/JsonLogic.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonLogic.Tests/obj/Release/net10.0/JsonLogic.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/obj/Release/net10.0/JsonLogic.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/obj/Release/net10.0/JsonLogic.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonLogic.Tests/obj/Release/net8.0/JsonLogic.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/obj/Release/net8.0/JsonLogic.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/obj/Release/net8.0/JsonLogic.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonLogic.Tests/obj/Release/net9.0/JsonLogic.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/obj/Release/net9.0/JsonLogic.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/obj/Release/net9.0/JsonLogic.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic.Tests/SomeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/SomeTests.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/SomeTests.cs", + "startLine": 1, + "endLine": 27, + "content": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class SomeTests\n{\n\t[Test]\n\tpublic void SomeMatchCondition()\n\t{\n\t\tvar rule = new SomeRule(JsonNode.Parse(\"[1,2,3]\"),\n\t\t\tnew StrictEqualsRule(new VariableRule(\"\"), 2));\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void SomeDoNotMatchCondition()\n\t{\n\t\tvar rule = new SomeRule(JsonNode.Parse(\"[1,2,3]\"),\n\t\t\tnew StrictEqualsRule(new VariableRule(\"\"), 0));\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class SomeTests\n{\n\t[Test]\n\tpublic void SomeMatchCondition()\n\t{\n\t\tvar rule = new SomeRul" + }, + { + "title": "src/JsonLogic.Tests/StrictEqualsTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/StrictEqualsTests.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/StrictEqualsTests.cs", + "startLine": 1, + "endLine": 32, + "content": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class StrictEqualsTests\n{\n\t[Test]\n\tpublic void NotEqualReturnsFalse()\n\t{\n\t\tvar rule = new StrictEqualsRule(1, 2);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void EqualsReturnsTrue()\n\t{\n\t\tvar rule = new StrictEqualsRule(1, 1);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void LooseEqualsReturnsFalse()\n\t{\n\t\tvar rule = new StrictEqualsRule(1, \"1\");\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n}", + "snippet": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class StrictEqualsTests\n{\n\t[Test]\n\tpublic void NotEqualReturnsFalse()\n\t{\n\t\tvar rule = new StrictEqualsRule(1, 2);\n\n\t\t" + }, + { + "title": "src/JsonLogic.Tests/StrictNotEqualsTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/StrictNotEqualsTests.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/StrictNotEqualsTests.cs", + "startLine": 1, + "endLine": 32, + "content": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class StrictNotEqualsTests\n{\n\t[Test]\n\tpublic void NotEqualReturnsTrue()\n\t{\n\t\tvar rule = new StrictNotEqualsRule(1, 2);\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void EqualsReturnsFalse()\n\t{\n\t\tvar rule = new StrictNotEqualsRule(1, 1);\n\n\t\tJsonAssert.IsFalse(rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void LooseNotEqualsReturnsTrue()\n\t{\n\t\tvar rule = new StrictNotEqualsRule(1, \"1\");\n\n\t\tJsonAssert.IsTrue(rule.Apply());\n\t}\n}", + "snippet": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class StrictNotEqualsTests\n{\n\t[Test]\n\tpublic void NotEqualReturnsTrue()\n\t{\n\t\tvar rule = new StrictNotEqualsRule(1, 2)" + }, + { + "title": "src/JsonLogic.Tests/SubstrTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/SubstrTests.cs#L1-L72", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/SubstrTests.cs", + "startLine": 1, + "endLine": 72, + "content": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class SubstrTests\n{\n\t[Test]\n\tpublic void SubstrStartNoCount()\n\t{\n\t\tvar rule = new SubstrRule(\"foobar\", 3);\n\n\t\tJsonAssert.AreEquivalent(\"bar\", rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void SubstrStartBeyondLengthNoCount()\n\t{\n\t\tvar rule = new SubstrRule(\"foobar\", 10);\n\n\t\tJsonAssert.AreEquivalent(string.Empty, rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void SubstrNegativeStartNoCount()\n\t{\n\t\tvar rule = new SubstrRule(\"foobar\", -2);\n\n\t\tJsonAssert.AreEquivalent(\"ar\", rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void SubstrNegativeStartBeyondLengthNoCount()\n\t{\n\t\tvar rule = new SubstrRule(\"foobar\", -10);\n\n\t\tJsonAssert.AreEquivalent(\"foobar\", rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void SubstrStartCount()\n\t{\n\t\tvar rule = new SubstrRule(\"foobar\", 3, 2);\n\n\t\tJsonAssert.AreEquivalent(\"ba\", rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void SubstrStartCountBeyondLength()\n\t{\n\t\tvar rule = new SubstrRule(\"foobar\", 3, 5);\n\n\t\tJsonAssert.AreEquivalent(\"bar\", rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void SubstrStartNegativeCount()\n\t{\n\t\tvar rule = new SubstrRule(\"foobar\", 2, -1);\n\n\t\tJsonAssert.AreEquivalent(\"oba\", rule.Apply());\n\t}\n\n\t[Test]\n\tpublic void SubstrStartNegativeCountBeyondLength()\n\t{\n\t\tvar rule = new SubstrRule(\"foobar\", 2, -10);\n\n\t\tJsonAssert.AreEquivalent(string.Empty, rule.Apply());\n\t}\n}", + "snippet": "using Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class SubstrTests\n{\n\t[Test]\n\tpublic void SubstrStartNoCount()\n\t{\n\t\tvar rule = new SubstrRule(\"foobar\", 3);\n\n\t\tJsonAss" + }, + { + "title": "src/JsonLogic.Tests/SubtractTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/SubtractTests.cs#L1-L16", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/SubtractTests.cs", + "startLine": 1, + "endLine": 16, + "content": "using NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class SubtractTests\n{\n\t[Test]\n\tpublic void SubtractNumbersReturnsSum()\n\t{\n\t\tvar rule = JsonLogic.Subtract(4, 5);\n\n\t\tvar actual = rule.Apply();\n\t\tJsonAssert.AreEquivalent(-1, actual);\n\t}\n}", + "snippet": "using NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class SubtractTests\n{\n\t[Test]\n\tpublic void SubtractNumbersReturnsSum()\n\t{\n\t\tvar rule = JsonLogic.Subtract(4, 5);\n\n\t\tvar actual = rule.Apply()" + }, + { + "title": "src/JsonLogic.Tests/Suite/MoreTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/Suite/MoreTests.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/Suite/MoreTests.cs", + "startLine": 1, + "endLine": 37, + "content": "using System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests.Suite;\n\npublic class MoreTests\n{\n\tpublic static IEnumerable Suite()\n\t{\n\t\tvar testsPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, \"Files\\\\more-tests.json\").AdjustForPlatform();\n\n\t\tvar content = File.ReadAllText(testsPath);\n\n\t\tvar testSuite = JsonSerializer.Deserialize(content, TestSerializerContext.Default.TestSuite);\n\n\t\treturn testSuite!.Tests.Select(t => new TestCaseData(t) { TestName = $\"{t.Logic} | {t.Data.AsJsonString()} | {t.Expected.AsJsonString()}\" });\n\t}\n\n\t[TestCaseSource(nameof(Suite))]\n\tpublic void Run(Test test)\n\t{\n\t\tvar rule = JsonSerializer.Deserialize(test.Logic, TestSerializerContext.Default.Rule);\n\n\t\tif (rule == null)\n\t\t{\n\t\t\tAssert.That(test.Expected, Is.Null);\n\t\t\treturn;\n\t\t}\n\n\t\tJsonAssert.AreEquivalent(test.Expected, rule.Apply(test.Data));\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests.Suite;\n\npublic class MoreTests\n{\n\tpubli" + }, + { + "title": "src/JsonLogic.Tests/Suite/NewMoreTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/Suite/NewMoreTests.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/Suite/NewMoreTests.cs", + "startLine": 1, + "endLine": 33, + "content": "using System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests.Suite;\n\npublic class NewMoreTests\n{\n\tpublic static IEnumerable Suite()\n\t{\n\t\tvar testsPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, \"Files\\\\more-tests.json\").AdjustForPlatform();\n\n\t\tvar content = File.ReadAllText(testsPath);\n\n\t\tvar testSuite = JsonSerializer.Deserialize(content, TestSerializerContext.Default.TestSuite);\n\n\t\treturn testSuite!.Tests.Select(t => new TestCaseData(t) { TestName = $\"{t.Logic} | {More.JsonNodeExtensions.AsJsonString(t.Data)} | {More.JsonNodeExtensions.AsJsonString(t.Expected)}\" });\n\t}\n\n\t[TestCaseSource(nameof(Suite))]\n\tpublic void Run(Test test)\n\t{\n\t\tvar rule = JsonNode.Parse(test.Logic);\n\n\t\tvar result = JsonLogic.Apply(rule, test.Data);\n\n\t\tJsonAssert.AreEquivalent(test.Expected, result);\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests.Suite;\n\npublic class NewMo" + }, + { + "title": "src/JsonLogic.Tests/Suite/NewSuiteRunner.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/Suite/NewSuiteRunner.cs#L1-L57", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/Suite/NewSuiteRunner.cs", + "startLine": 1, + "endLine": 57, + "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Threading.Tasks;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests.Suite;\n\npublic class NewSuiteRunner\n{\n\tpublic static IEnumerable Suite()\n\t{\n\t\tvar text = Task.Run(async () =>\n\t\t{\n\t\t\tvar testsPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, \"Files\\\\tests.json\").AdjustForPlatform();\n\n\t\t\tstring? content = null;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tusing var client = new HttpClient();\n\t\t\t\tusing var request = new HttpRequestMessage(HttpMethod.Get, \"https://jsonlogic.com/tests.json\");\n\t\t\t\tusing var response = await client.SendAsync(request);\n\n\t\t\t\tcontent = await response.Content.ReadAsStringAsync();\n\n\t\t\t\tFile.WriteAllText(testsPath, content);\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tcontent ??= File.ReadAllText(testsPath);\n\n\t\t\t\tTestConsole.WriteLine(e);\n\t\t\t}\n\t\t\treturn content;\n\n\t\t}).Result;\n\n\t\tvar testSuite = JsonSerializer.Deserialize(text, TestSerializerContext.Default.TestSuite);\n\n\t\treturn testSuite!.Tests.Select(t => new TestCaseData(t) { TestName = $\"{t.Logic} | {More.JsonNodeExtensions.AsJsonString(t.Data)} | {More.JsonNodeExtensions.AsJsonString(t.Expected)}\" });\n\t}\n\n\t[TestCaseSource(nameof(Suite))]\n\tpublic void Run(Test test)\n\t{\n\t\tvar rule = JsonNode.Parse(test.Logic);\n\n\t\tvar result = JsonLogic.Apply(rule, test.Data);\n\n\t\tJsonAssert.AreEquivalent(test.Expected, result);\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Threading.Tasks;\nusing NUnit.Framework;\nusing " + }, + { + "title": "src/JsonLogic.Tests/Suite/Spelling.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/Suite/Spelling.cs#L1-L63", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/Suite/Spelling.cs", + "startLine": 1, + "endLine": 63, + "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Threading.Tasks;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests.Suite;\n\npublic class Spelling\n{\n\tpublic static IEnumerable Suite()\n\t{\n\t\tvar text = Task.Run(async () =>\n\t\t{\n\t\t\tvar testsPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, \"Files\\\\tests.json\").AdjustForPlatform();\n\n\t\t\tstring? content = null;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tusing var client = new HttpClient();\n\t\t\t\tusing var request = new HttpRequestMessage(HttpMethod.Get, \"https://jsonlogic.com/tests.json\");\n\t\t\t\tusing var response = await client.SendAsync(request);\n\n\t\t\t\tcontent = await response.Content.ReadAsStringAsync();\n\n\t\t\t\tFile.WriteAllText(testsPath, content);\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tcontent ??= File.ReadAllText(testsPath);\n\n\t\t\t\tTestConsole.WriteLine(e);\n\t\t\t}\n\t\t\treturn content;\n\n\t\t}).Result;\n\n\t\tvar testSuite = JsonSerializer.Deserialize(text, TestSerializerContext.Default.TestSuite);\n\n\t\treturn testSuite!.Tests.Select(t => new TestCaseData(t) { TestName = $\"{t.Logic} | {t.Data.AsJsonString()} | {t.Expected.AsJsonString()}\" });\n\t}\n\n\t[TestCaseSource(nameof(Suite))]\n\tpublic void Run(Test test)\n\t{\n\t\tvar node = JsonNode.Parse(test.Logic);\n\t\tvar rule = JsonSerializer.Deserialize(test.Logic, TestSerializerContext.Default.Rule);\n\n\t\tvar serialized = JsonSerializer.SerializeToNode(rule, TestSerializerContext.Default.Rule!);\n\n\t\tif (node.IsEquivalentTo(serialized)) return;\n\n\t\tTestConsole.WriteLine($\"Expected: {node.AsJsonString(TestSerializerContext.Default.Options)}\");\n\t\tTestConsole.WriteLine($\"Actual: {serialized.AsJsonString(TestSerializerContext.Default.Options)}\");\n\t\tAssert.Inconclusive();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Threading.Tasks;\nusing Json.More;\nusing NUnit." + }, + { + "title": "src/JsonLogic.Tests/Suite/SuiteRunner.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/Suite/SuiteRunner.cs#L1-L61", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/Suite/SuiteRunner.cs", + "startLine": 1, + "endLine": 61, + "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Text.Json;\nusing System.Threading.Tasks;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests.Suite;\n\npublic class SuiteRunner\n{\n\tpublic static IEnumerable Suite()\n\t{\n\t\tvar text = Task.Run(async () =>\n\t\t{\n\t\t\tvar testsPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, \"Files\\\\tests.json\").AdjustForPlatform();\n\n\t\t\tstring? content = null;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tusing var client = new HttpClient();\n\t\t\t\tusing var request = new HttpRequestMessage(HttpMethod.Get, \"https://jsonlogic.com/tests.json\");\n\t\t\t\tusing var response = await client.SendAsync(request);\n\n\t\t\t\tcontent = await response.Content.ReadAsStringAsync();\n\n\t\t\t\tFile.WriteAllText(testsPath, content);\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tcontent ??= File.ReadAllText(testsPath);\n\n\t\t\t\tTestConsole.WriteLine(e);\n\t\t\t}\n\t\t\treturn content;\n\n\t\t}).Result;\n\n\t\tvar testSuite = JsonSerializer.Deserialize(text, TestSerializerContext.Default.TestSuite);\n\n\t\treturn testSuite!.Tests.Select(t => new TestCaseData(t) { TestName = $\"{t.Logic} | {t.Data.AsJsonString()} | {t.Expected.AsJsonString()}\" });\n\t}\n\n\t[TestCaseSource(nameof(Suite))]\n\tpublic void Run(Test test)\n\t{\n\t\tvar rule = JsonSerializer.Deserialize(test.Logic, TestSerializerContext.Default.Rule);\n\n\t\tif (rule == null)\n\t\t{\n\t\t\tAssert.That(test.Expected, Is.Null);\n\t\t\treturn;\n\t\t}\n\n\t\tJsonAssert.AreEquivalent(test.Expected, rule.Apply(test.Data));\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Text.Json;\nusing System.Threading.Tasks;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n" + }, + { + "title": "src/JsonLogic.Tests/Suite/Test.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/Suite/Test.cs#L1-L42", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/Suite/Test.cs", + "startLine": 1, + "endLine": 42, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Tests.Suite;\n\n[JsonConverter(typeof(TestConverter))]\npublic class Test\n{\n#pragma warning disable CS8618\n\tpublic string Logic { get; set; }\n\tpublic JsonNode? Data { get; set; }\n\tpublic JsonNode? Expected { get; set; }\n#pragma warning restore CS8618\n}\n\npublic class TestConverter : JsonConverter\n{\n\tpublic override Test? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar node = options.Read(ref reader, TestSerializerContext.Default.JsonNode);\n\t\tif (node is not JsonArray arr) return null;\n\n\t\tvar logic = JsonSerializer.Serialize(arr[0], TestEnvironment.SerializerOptions);\n\t\tvar data = arr[1];\n\t\tvar expected = arr[2];\n\n\t\treturn new Test\n\t\t{\n\t\t\tLogic = logic,\n\t\t\tData = data,\n\t\t\tExpected = expected\n\t\t};\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, Test? value, JsonSerializerOptions options)\n\t{\n\t\tthrow new NotImplementedException();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Tests.Suite;\n\n[JsonConverter(typeof(TestConverter))]\npublic class Test\n{\n#p" + }, + { + "title": "src/JsonLogic.Tests/Suite/TestSuite.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/Suite/TestSuite.cs#L1-L36", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/Suite/TestSuite.cs", + "startLine": 1, + "endLine": 36, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Tests.Suite;\n\n[JsonConverter(typeof(TestSuiteConverter))]\npublic class TestSuite\n{\n#pragma warning disable CS8618\n\tpublic Test[] Tests { get; set; }\n#pragma warning restore CS8618\n}\n\npublic class TestSuiteConverter : JsonConverter\n{\n\tpublic override TestSuite? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tif (reader.TokenType != JsonTokenType.StartArray)\n\t\t\tthrow new JsonException(\"Test suite must be an array of tests.\");\n\n\t\tvar tests = options.Read(ref reader, TestSerializerContext.Default.TestArray)!\n\t\t\t.Where(t => t != null!)\n\t\t\t.ToArray();\n\n\t\treturn new TestSuite { Tests = tests };\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, TestSuite? value, JsonSerializerOptions options)\n\t{\n\t\tthrow new NotImplementedException();\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Tests.Suite;\n\n[JsonConverter(typeof(TestSuiteConverter))]\npublic class TestSuite\n{\n#pr" + }, + { + "title": "src/JsonLogic.Tests/TestEnvironment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/TestEnvironment.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/TestEnvironment.cs", + "startLine": 1, + "endLine": 33, + "content": "using System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Logic.Tests.Suite;\nusing NUnit.Framework;\n\nnamespace Json.Logic.Tests;\n\n[SetUpFixture]\npublic class TestEnvironment\n{\n\tpublic static readonly JsonSerializerOptions SerializerOptions =\n\t\tnew()\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t\t};\n\n\n\t[OneTimeSetUp]\n\tpublic void Setup()\n\t{\n\t}\n}\n\n[JsonSerializable(typeof(TestSuite))]\n[JsonSerializable(typeof(Test))]\n[JsonSerializable(typeof(Test[]))]\n[JsonSerializable(typeof(Rule))]\n[JsonSerializable(typeof(string))]\n[JsonSerializable(typeof(JsonNode))]\ninternal partial class TestSerializerContext : JsonSerializerContext;", + "snippet": "using System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Logic.Tests.Suite;\nusing NUnit.Framework;\n\nnamespace Json.Logic.Tests;\n\n[SetUpFixtur" + }, + { + "title": "src/JsonLogic.Tests/VariableTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic.Tests/VariableTests.cs#L1-L54", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic.Tests/VariableTests.cs", + "startLine": 1, + "endLine": 54, + "content": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class VariableTests\n{\n\t[Test]\n\tpublic void VariableWithValidPathAndNoDefaultFetchesData()\n\t{\n\t\tvar rule = new VariableRule(\"foo\");\n\t\tvar data = new JsonObject { [\"foo\"] = 5, [\"bar\"] = 10 };\n\n\t\tJsonAssert.AreEquivalent(5, rule.Apply(data));\n\t}\n\n\t[Test]\n\tpublic void VariableWithInvalidPathAndNoDefaultThrowsError()\n\t{\n\t\tvar rule = new VariableRule(\"baz\");\n\t\tvar data = new JsonObject { [\"foo\"] = 5, [\"bar\"] = 10 };\n\n\t\tJsonAssert.AreEquivalent(null, rule.Apply(data));\n\t}\n\n\t[Test]\n\tpublic void VariableWithValidPathAndDefaultFetchesData()\n\t{\n\t\tvar rule = new VariableRule(\"foo\", 11);\n\t\tvar data = new JsonObject { [\"foo\"] = 5, [\"bar\"] = 10 };\n\n\t\tJsonAssert.AreEquivalent(5, rule.Apply(data));\n\t}\n\n\t[Test]\n\tpublic void VariableWithInvalidPathAndDefaultReturnsDefault()\n\t{\n\t\tvar rule = new VariableRule(\"baz\", 11);\n\t\tvar data = new JsonObject { [\"foo\"] = 5, [\"bar\"] = 10 };\n\n\t\tJsonAssert.AreEquivalent(11, rule.Apply(data));\n\t}\n\n\t[Test]\n\tpublic void VariableWithEmptyPathReturnsEntireData()\n\t{\n\t\tvar rule = new VariableRule(\"\");\n\t\tvar data = new JsonObject { [\"foo\"] = 5, [\"bar\"] = 10 };\n\n\t\tJsonAssert.AreEquivalent(data, rule.Apply(data));\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Logic.Tests;\n\npublic class VariableTests\n{\n\t[Test]\n\tpublic void VariableWithValidPathAndNoDefaultFetchesData" + }, + { + "title": "src/JsonLogic/assembly.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/assembly.cs#L1-L3", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/assembly.cs", + "startLine": 1, + "endLine": 3, + "content": "using System.Runtime.CompilerServices;\n\n[assembly: InternalsVisibleTo(\"JsonLogic.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d111b5991feb360746cf4535b9ec3196825996680b6599cf10748f90a58ec820431f81d21eff5229a3fd7c3e42e46a20584ac413ebe39b4c05905fd47b877bffed36bff23ad4ad14aad3deed8f24ed40a1371daad79a41172b2cdf0db4b664198f38f3a19419457131f8ee4558e628b5c986bb574d4e151b650eae6aa1f5ccbf\")]", + "snippet": "using System.Runtime.CompilerServices;\n\n[assembly: InternalsVisibleTo(\"JsonLogic.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d111b5991feb360746cf4535b9ec3196825996680b6599cf10748f90a5" + }, + { + "title": "src/JsonLogic/DeconstructionExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/DeconstructionExtensions.cs#L1-L16", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/DeconstructionExtensions.cs", + "startLine": 1, + "endLine": 16, + "content": "#if NETSTANDARD2_0\n\nusing System.Collections.Generic;\n\nnamespace Json.Logic;\n\ninternal static class DeconstructionExtensions\n{\n\tpublic static void Deconstruct(this KeyValuePair kvp, out TKey key, out TValue value)\n\t{\n\t\tkey = kvp.Key;\n\t\tvalue = kvp.Value;\n\t}\n}\n\n#endif", + "snippet": "#if NETSTANDARD2_0\n\nusing System.Collections.Generic;\n\nnamespace Json.Logic;\n\ninternal static class DeconstructionExtensions\n{\n\tpublic static void Deconstruct(this KeyValuePair kvp, out TKey k" + }, + { + "title": "src/JsonLogic/EvaluationContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/EvaluationContext.cs#L1-L103", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/EvaluationContext.cs", + "startLine": 1, + "endLine": 103, + "content": "using System.Collections.Generic;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Logic;\n\n/// \n/// Provides context data for JSON-e evaluation.\n/// \npublic class EvaluationContext\n{\n\tprivate readonly Stack _contextStack;\n\n\t/// \n\t/// The top-level context value.\n\t/// \n\tpublic JsonNode? CurrentValue => _contextStack.Peek();\n\n\tinternal EvaluationContext(JsonNode? baseContext)\n\t{\n\t\t_contextStack = new Stack();\n\t\t_contextStack.Push(baseContext);\n\t}\n\n\t/// \n\t/// Adds or overrides context data.\n\t/// \n\t/// \n\tpublic void Push(JsonNode? newContext)\n\t{\n\t\t_contextStack.Push(newContext);\n\t}\n\n\t/// \n\t/// Removes the previous context data. Call only if you've explicitly added context data with \n\t/// \n\t/// \n\tpublic JsonNode? Pop()\n\t{\n\t\treturn _contextStack.Pop();\n\t}\n\n\t/// \n\t/// Attempts to resolve a variable path within the entire context.\n\t/// \n\t/// The variable path.\n\t/// The result, if found; null otherwise..\n\t/// true if the path was found; false otherwise.\n\tpublic bool TryFind(string? path, out JsonNode? result)\n\t{\n\t\tif (path == null)\n\t\t{\n\t\t\tresult = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tvar parts = path.Split('.');\n\t\tforeach (var node in _contextStack)\n\t\t{\n\t\t\tif (TryFindInSingleLayer(node, parts, out result)) return true;\n\t\t}\n\n\t\tresult = null;\n\t\treturn false;\n\t}\n\n\tprivate static bool TryFindInSingleLayer(JsonNode? layer, string[] parts, out JsonNode? result)\n\t{\n\t\tvar current = layer;\n\t\tforeach (var part in parts)\n\t\t{\n\t\t\tswitch (current)\n\t\t\t{\n\t\t\t\tcase JsonObject obj:\n\t\t\t\t\tif (!obj.TryGetValue(part, out current, out _))\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = null;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase JsonArray array:\n\t\t\t\t\tif (!int.TryParse(part, out var index))\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = null;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif (0 >= array.Count || array.Count <= index)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = null;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = array[index];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tresult = null;\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tresult = current;\n\t\treturn true;\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Logic;\n\n/// \n/// Provides context data for JSON-e evaluation.\n/// \npublic class EvaluationContext\n{\n\tpri" + }, + { + "title": "src/JsonLogic/ILogicLogger.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/ILogicLogger.cs#L1-L56", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/ILogicLogger.cs", + "startLine": 1, + "endLine": 56, + "content": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Logic;\n\n/// \n/// Defines a logger that writes structured log entries represented as JSON nodes.\n/// \n/// Implementations of this interface can be used to record log information in a structured format,\n/// enabling easier parsing and analysis of log data. The interface is intended for scenarios where log content is best\n/// represented as JSON, such as for telemetry or diagnostics in distributed systems.\npublic interface ILogicLogger\n{\n\t/// \n\t/// Writes the specified JSON content followed by a line terminator.\n\t/// \n\t/// The JSON content to write. Can be null, in which case no content is written but a line terminator is still\n\t/// appended.\n\tvoid WriteLine(JsonNode? content);\n}\n\n/// \n/// Provides commonly used implementations of the ILogicLogger interface for application logic logging.\n/// \n/// This static class offers ready-to-use logger instances, including a console logger for outputting log\n/// messages to the console and a null logger that ignores all log messages. These loggers can be used to simplify\n/// logging setup in applications or for testing purposes.\npublic static class LogicLoggers\n{\n\t/// \n\t/// Gets a logger instance that writes log messages to the console.\n\t/// \n\tpublic static ILogicLogger ConsoleLogger { get; } = new ConsoleLogger();\n\t/// \n\t/// Gets a logger instance that performs no logging operations. This is the default logger.\n\t/// \n\t/// This property provides a no-op implementation of the logger interface. It can be used in scenarios\n\t/// where logging is optional or should be suppressed, such as in testing or when a logger is required but no actual\n\t/// logging is desired.\n\tpublic static ILogicLogger NullLogger { get; } = new NullLogger();\n}\n\ninternal class NullLogger : ILogicLogger\n{\n\tpublic void WriteLine(JsonNode? content)\n\t{\n\t}\n}\n\ninternal class ConsoleLogger : ILogicLogger\n{\n\tpublic void WriteLine(JsonNode? content)\n\t{\n\t\tConsole.WriteLine(content);\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Logic;\n\n/// \n/// Defines a logger that writes structured log entries represented as JSON nodes.\n/// \n/// Implementations of this int" + }, + { + "title": "src/JsonLogic/IRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/IRule.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/IRule.cs", + "startLine": 1, + "endLine": 17, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.Logic;\n\n/// \n/// Defines functionality for a model-less approach to evaluating JSON Logic rules.\n/// \npublic interface IRule\n{\n\t/// \n\t/// Applies the rule.\n\t/// \n\t/// The arguments.\n\t/// The context.\n\t/// The result.\n\tJsonNode? Apply(JsonNode? args, EvaluationContext context);\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.Logic;\n\n/// \n/// Defines functionality for a model-less approach to evaluating JSON Logic rules.\n/// \npublic interface IRule\n{\n\t/// \n\t/// Applies " + }, + { + "title": "src/JsonLogic/JsonLogic.cs (1/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/JsonLogic.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/JsonLogic.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing Json.More;\n\nnamespace Json.Logic;\n\n/// \n/// Provides factory methods to create operations.\n/// \npublic static class JsonLogic\n{\n\t/// \n\t/// Applies a rule encoded into a to some data.\n\t/// \n\t/// The rule to apply.\n\t/// The context data.\n\t/// The result.\n\tpublic static JsonNode? Apply(JsonNode? rule, JsonNode? context = null)\n\t{\n\t\tvar evalContext = new EvaluationContext(context);\n\t\treturn Apply(rule, evalContext);\n\t}\n\n\t/// \n\t/// Applies a nested rule encoded into a to a context.\n\t/// This is to be called from within an handler.\n\t/// \n\t/// The rule to apply.\n\t/// The context data.\n\t/// The result.\n\tpublic static JsonNode? Apply(JsonNode? rule, EvaluationContext context)\n\t{\n\t\tswitch (rule)\n\t\t{\n\t\t\tcase JsonObject { Count: 1 } obj:\n\t\t\t\tvar (key, value) = obj.Single();\n\t\t\t\tvar handler = RuleRegistry.GetHandler(key);\n\n\t\t\t\treturn handler is null ? rule : handler.Apply(value, context);\n\t\t\tcase JsonArray array:\n\t\t\t\treturn array.Select(x => Apply(x, context)).ToJsonArray();\n\t\t}\n\n\t\treturn rule;\n\t}\n\n\t/// \n\t/// Creates an `and` rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// An `and` rule.\n\tpublic static Rule And(Rule a, params Rule[] more) => new AndRule(a, more);\n\n#if NET9_0_OR_GREATER\n\t/// \n\t/// Creates an `and` rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// An `and` rule.\n\tpublic static Rule And(Rule a, params ReadOnlySpan more) => new AndRule(a, more);\n#endif\n\n\t/// \n\t/// Creates an `or` rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// An `or` rule.\n\tpublic static Rule Or(Rule a, params Rule[] more) => new OrRule(a, more);\n\n#if NET9_0_OR_GREATER\n\t/// \n\t/// Creates an `or` rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// An `or` rule.\n\tpublic static Rule Or(Rule a, params ReadOnlySpan more) => new OrRule(a, more);\n#endif\n\n\t/// \n\t/// Creates a `!` (\"not\") rule.\n\t/// \n\t/// The rule to negate.\n\t/// A `!` rule.\n\tpublic static Rule Not(Rule value) => new NotRule(value);\n\t\n\t/// \n\t/// Creates a `!!` (\"boolean cast\") rule.\n\t/// \n\t/// The rule to negate.\n\t/// A `!!` rule.\n\tpublic static Rule BoolCast(Rule value) => new BooleanCastRule(value);\n\n\t/// \n\t/// Creates an `if` rule.\n\t/// \n\t/// The rule chain to process.\n\t/// An `if` rule.\n\tpublic static Rule If(params Rule[] components) => new IfRule(components);\n\n\t/// \n\t/// Creates a `+` (\"add\") rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// A `+` rule.\n\tpublic static Rule Add(Rule a, params Rule[] more) => new AddRule(a, more);\n\n#if NET9_0_OR_GREATER\n\t/// \n\t/// Creates a `+` (\"add\") rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// A `+` rule.", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.Logic.Rules;\nusing Json.More;\n\nnamespace Json.Logic;\n\n/// \n/// Provides factory methods to create operations.\n/// \npublic stati" + }, + { + "title": "src/JsonLogic/JsonLogic.cs (2/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/JsonLogic.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/JsonLogic.cs", + "startLine": 121, + "endLine": 240, + "content": "public static Rule Add(Rule a, params ReadOnlySpan more) => new AddRule(a, more);\n#endif\n\n\t/// \n\t/// Creates a `-` (\"subtract\") rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// A `-` rule.\n\tpublic static Rule Subtract(Rule a, params Rule[] more) => new SubtractRule(a, more);\n\n#if NET9_0_OR_GREATER\n\t/// \n\t/// Creates a `-` (\"subtract\") rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// A `-` rule.\n\tpublic static Rule Subtract(Rule a, params ReadOnlySpan more) => new SubtractRule(a, more);\n#endif\n\n\t/// \n\t/// Creates a `*` (\"multiply\") rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// A `*` rule.\n\tpublic static Rule Multiply(Rule a, params Rule[] more) => new MultiplyRule(a, more);\n\n#if NET9_0_OR_GREATER\n\t/// \n\t/// Creates a `*` (\"multiply\") rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// A `*` rule.\n\tpublic static Rule Multiply(Rule a, params ReadOnlySpan more) => new MultiplyRule(a, more);\n#endif\n\n\t/// \n\t/// Creates a `/` (\"divide\") rule.\n\t/// \n\t/// The first rule.\n\t/// \n\t/// A `/` rule.\n\tpublic static Rule Divide(Rule a, Rule b) => new DivideRule(a, b);\n\t\n\t/// \n\t/// Creates a `%` (\"modulus\") rule.\n\t/// \n\t/// The first rule.\n\t/// \n\t/// A `%` rule.\n\tpublic static Rule Modulus(Rule a, Rule b) => new ModRule(a, b);\n\n\t/// \n\t/// Creates a `max` rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// A `max` rule.\n\tpublic static Rule Max(Rule a, params Rule[] more) => new MaxRule(a, more);\n\n#if NET9_0_OR_GREATER\n\t/// \n\t/// Creates a `max` rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// A `max` rule.\n\tpublic static Rule Max(Rule a, params ReadOnlySpan more) => new MaxRule(a, more);\n#endif\n\n\t/// \n\t/// Creates a `min` rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// A `min` rule.\n\tpublic static Rule Min(Rule a, params Rule[] more) => new MinRule(a, more);\n\n#if NET9_0_OR_GREATER\n\t/// \n\t/// Creates a `min` rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// A `min` rule.\n\tpublic static Rule Min(Rule a, params ReadOnlySpan more) => new MinRule(a, more);\n#endif\n\n\t/// \n\t/// Creates a `===` (\"strict equal\") rule.\n\t/// \n\t/// The first rule.\n\t/// The second rule.\n\t/// A `===` rule.\n\tpublic static Rule StrictEquals(Rule a, Rule b) => new StrictEqualsRule(a, b);\n\t\n\t/// \n\t/// Creates a `!==` (\"strict not equal\") rule.\n\t/// \n\t/// The first rule.\n\t/// The second rule.\n\t/// A `!==` rule.\n\t\n\tpublic static Rule StrictNotEquals(Rule a, Rule b) => new StrictNotEqualsRule(a, b);\n\t/// \n\t/// Creates a `==` (\"loose equal\") rule.\n\t/// \n\t/// The first rule.\n\t/// The second rule.\n\t/// A `==` rule.\n\t\n\tpublic static Rule LooseEquals(Rule a, Rule b) => new LooseEqualsRule(a, b);\n\t/// \n\t/// Creates a `!=` (\"loose not equal\") rule.\n\t/// \n\t/// The first rule.\n\t/// The second rule.", + "snippet": "public static Rule Add(Rule a, params ReadOnlySpan more) => new AddRule(a, more);\n#endif\n\n\t/// \n\t/// Creates a `-` (\"subtract\") rule.\n\t/// \n\t/// The first rule.\n\t/// A `!=` rule.\n\tpublic static Rule LooseNotEquals(Rule a, Rule b) => new LooseNotEqualsRule(a, b);\n\t/// \n\t/// Creates a `<` (\"less than\") rule.\n\t/// \n\t/// The lower limit rule.\n\t/// The upper limit rule.\n\t/// A `<` rule.\n\tpublic static Rule LessThan(Rule a, Rule b) => new LessThanRule(a, b);\n\n\t/// \n\t/// Creates a three-argument `<` (\"exclusive between\") rule.\n\t/// \n\t/// The lower limit rule.\n\t/// The rule.\n\t/// The upper limit rule.\n\t/// A `<` rule.\n\tpublic static Rule BetweenExclusive(Rule a, Rule b, Rule c) => new LessThanRule(a, b, c);\n\t/// \n\t/// Creates a `<=` (\"less than or equal\") rule.\n\t/// \n\t/// The lower limit rule.\n\t/// The upper limit rule.\n\t/// A `<=` rule.\n\tpublic static Rule LessThanOrEqual(Rule a, Rule b) => new LessThanEqualRule(a, b);\n\n\t/// \n\t/// Creates a three-argument `<=` (\"inclusive between\") rule.\n\t/// \n\t/// The lower limit rule.\n\t/// The second rule.\n\t/// The upper limit rule.\n\t/// A `<=` rule.\n\tpublic static Rule BetweenInclusive(Rule a, Rule b, Rule c) => new LessThanEqualRule(a, b, c);\n\t/// \n\t/// Creates a `>` (\"more than\") rule.\n\t/// \n\t/// The upper limit rule.\n\t/// The lower limit rule.\n\t/// A `>` rule.\n\tpublic static Rule MoreThan(Rule a, Rule b) => new MoreThanRule(a, b);\n\t/// \n\t/// Creates a `>=` (\"more than or equal\") rule.\n\t/// \n\t/// The upper limit rule.\n\t/// The lower limit rule.\n\t/// A `>` rule.\n\tpublic static Rule MoreThanOrEqual(Rule a, Rule b) => new MoreThanEqualRule(a, b);\n\n\t/// \n\t/// Creates a `cat` (\"concatenation\") rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// A `cat` rule.\n\tpublic static Rule Cat(Rule a, params Rule[] more) => new CatRule(a, more);\n\n#if NET9_0_OR_GREATER\n\t/// \n\t/// Creates a `cat` (\"concatenation\") rule.\n\t/// \n\t/// The first rule.\n\t/// Subsequent rules.\n\t/// A `cat` rule.\n\tpublic static Rule Cat(Rule a, params ReadOnlySpan more) => new CatRule(a, more);\n#endif\n\n\t/// \n\t/// Creates a `substr` (\"concatenation\") rule.\n\t/// \n\t/// The input rule.\n\t/// The start rule.\n\t/// A `substr` rule.\n\tpublic static Rule Substr(Rule input, Rule start) => new SubstrRule(input, start);\n\t\n\t/// \n\t/// Creates a `substr` (\"concatenation\") rule.\n\t/// \n\t/// The input rule.\n\t/// The start rule.\n\t/// The count rule.\n\t/// A `substr` rule.\n\tpublic static Rule Substr(Rule input, Rule start, Rule count) => new SubstrRule(input, start, count);\n\n\t/// \n\t/// Creates an `all` rule.\n\t/// \n\t/// The input rule.\n\t/// The predicate to test by.\n\t/// An `all` rule.\n\tpublic static Rule All(Rule input, Rule rule) => new AllRule(input, rule);\n\t/// \n\t/// Creates a `some` (\"any\") rule.\n\t/// \n\t/// The input rule.\n\t/// The predicate to test by.\n\t/// A `some` rule.\n\tpublic static Rule Some(Rule input, Rule rule) => new SomeRule(input, rule);\n\t\n\t/// \n\t/// Creates a `none` rule.\n\t/// \n\t/// The input rule.\n\t/// The predicate to test by.\n\t/// A `none` rule.\n\tpublic static Rule None(Rule input, Rule rule) => new NoneRule(input, rule);\n\t\n\t/// \n\t/// Creates a `missing` rule.\n\t/// \n\t/// The missing components.\n\t/// A `missing` rule.\n\tpublic static Rule Missing(params Rule[] components) => new MissingRule(components);\n\t\n\t/// \n\t/// Creates a `missing-some` rule.\n\t/// \n\t/// The required count.\n\t/// The missing components.\n\t/// A `missing_some` rule.", + "snippet": "/// A `!=` rule.\n\tpublic static Rule LooseNotEquals(Rule a, Rule b) => new LooseNotEqualsRule(a, b);\n\t/// \n\t/// Creates a `<` (\"less than\") rule.\n\t/// \n\t/// The lo" + }, + { + "title": "src/JsonLogic/JsonLogic.cs (4/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/JsonLogic.cs#L361-L441", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/JsonLogic.cs", + "startLine": 361, + "endLine": 441, + "content": "public static Rule MissingSome(Rule requiredCount, Rule components) => new MissingSomeRule(requiredCount, components);\n\t/// \n\t/// Creates a `none` rule.\n\t/// \n\t/// The predicate to test by.\n\t/// The input rule.\n\t/// A `none` rule.\n\tpublic static Rule In(Rule test, Rule input) => new InRule(test, input);\n\n\t/// \n\t/// Creates a `map` rule.\n\t/// \n\t/// The input rule.\n\t/// The predicate to test by.\n\t/// A `map` rule.\n\tpublic static Rule Map(Rule input, Rule rule) => new MapRule(input, rule);\n\t/// \n\t/// Creates a `reduce` rule.\n\t/// \n\t/// The input rule.\n\t/// The predicate to test by.\n\t/// The initial rule.\n\t/// A `reduce` rule.\n\tpublic static Rule Reduce(Rule input, Rule rule, Rule initial) => new ReduceRule(input, rule, initial);\n\t/// \n\t/// Creates a `filter` rule.\n\t/// \n\t/// The input rule.\n\t/// The predicate to test by.\n\t/// A `filter` rule.\n\tpublic static Rule Filter(Rule input, Rule rule) => new FilterRule(input, rule);\n\t\n\t/// \n\t/// Creates a `merge` rule.\n\t/// \n\t/// The items to merge.\n\t/// A `merge` rule.\n\tpublic static Rule Merge(params Rule[] items) => new MergeRule(items);\n\n\t/// \n\t/// Creates a rule that stands in for a literal JSON value.\n\t/// \n\t/// The JSON value.\n\t/// A literal rule.\n\tpublic static Rule Literal(JsonNode? value) => new LiteralRule(value);\n\n\t/// \n\t/// Creates a `var` rule that accesses data.\n\t/// \n\t/// A rule that produces the dot-delimited path.\n\t/// A variable rule.\n\tpublic static Rule Variable(Rule input) => new VariableRule(input);\n\t/// \n\t/// Creates a `var` rule that accesses data.\n\t/// \n\t/// A rule that produces the dot-delimited path.\n\t/// A default value to use if the path is not found.\n\t/// A variable rule.\n\tpublic static Rule Variable(Rule input, Rule defaultValue) => new VariableRule(input, defaultValue);\n\t/// \n\t/// Creates a `var` rule that accesses data.\n\t/// \n\t/// The dot-delimited path.\n\t/// A variable rule.\n\tpublic static Rule Variable(string path) => new VariableRule(Literal(path));\n\t/// \n\t/// Creates a `var` rule that accesses data.\n\t/// \n\t/// The dot-delimited path.\n\t/// A default value to use if the path is not found.\n\t/// A variable rule.\n\tpublic static Rule Variable(string path, Rule defaultValue) => new VariableRule(Literal(path), defaultValue);\n\n\t/// \n\t/// Functions as a no-op. Processes the rule, then logs and returns the output.\n\t/// \n\t/// The rule to log.\n\t/// The result of the rule.\n\tpublic static Rule Log(Rule log) => new LogRule(log);\n\n}", + "snippet": "public static Rule MissingSome(Rule requiredCount, Rule components) => new MissingSomeRule(requiredCount, components);\n\t/// \n\t/// Creates a `none` rule.\n\t/// \n\t/// The predicate to t" + }, + { + "title": "src/JsonLogic/JsonLogicException.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/JsonLogicException.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/JsonLogicException.cs", + "startLine": 1, + "endLine": 18, + "content": "using System;\n\nnamespace Json.Logic;\n\n/// \n/// Thrown when a rule cannot be processed or deserialized.\n/// \npublic class JsonLogicException : Exception\n{\n\t/// \n\t/// Creates a new instance of the class.\n\t/// \n\t/// The exception message.\n\tpublic JsonLogicException(string message)\n\t\t: base(message)\n\t{\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Logic;\n\n/// \n/// Thrown when a rule cannot be processed or deserialized.\n/// \npublic class JsonLogicException : Exception\n{\n\t/// \n\t/// Creates a new instance of t" + }, + { + "title": "src/JsonLogic/JsonNodeExtensions.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/JsonNodeExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/JsonNodeExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Logic;\n\n/// \n/// Provides fuzzy-logic extensions for values.\n/// \npublic static class JsonNodeExtensions\n{\n\t/// \n\t/// Determines whether a value can be considered as `true`.\n\t/// \n\t/// The element.\n\t/// \n\t/// `true` if the value is:\n\t///\n\t/// - a non-empty array\n\t/// - a non-empty string\n\t/// - a non-zero number\n\t/// - true\n\t///\n\t///\t`false` otherwise\n\t///\n\t/// \n\tpublic static bool IsTruthy(this JsonNode? node)\n\t{\n\t\tswitch (node)\n\t\t{\n\t\t\tcase null:\n\t\t\t\treturn false;\n\t\t\tcase JsonObject obj:\n\t\t\t\treturn obj.Count != 0;\n\t\t\tcase JsonArray arr:\n\t\t\t\treturn arr.Count != 0;\n\t\t\tcase JsonValue value:\n\t\t\t\tif (value.TryGetValue(out string? s)) return s != string.Empty;\n\t\t\t\tif (value.TryGetValue(out bool b)) return b;\n\t\t\t\tvar n = value.GetNumber();\n\t\t\t\treturn n != null && n != 0;\n\t\t\tdefault:\n\t\t\t\tthrow new JsonLogicException($\"Cannot determine truthiness of `{node}`.\");\n\t\t}\n\t}\n\n\t/// \n\t/// Provides a loose-cast to a string.\n\t/// \n\t/// The node.\n\t/// \n\t///\tA string representation of the value as follows:\n\t///\n\t/// - arrays are the elements stringified and comma-delimited\n\t/// - null returns the empty string\n\t/// - objects return null (not stringifiable)\n\t///\t- numbers and booleans return their JSON equivalents\n\t/// - strings are unchanged\n\t/// \n\tpublic static string? Stringify(this JsonNode? node)\n\t{\n\t\tswitch (node)\n\t\t{\n\t\t\tcase null:\n\t\t\t\treturn string.Empty;\n\t\t\tcase JsonArray arr:\n\t\t\t\treturn string.Join(\",\", arr.Select(Stringify));\n\t\t\tcase JsonValue value:\n\t\t\t\tif (value.TryGetValue(out string? s)) return s;\n\t\t\t\treturn JsonSerializer.Serialize(node, JsonLogicSerializerContext.Default.JsonNode);\n\t\t\tdefault:\n\t\t\t\treturn null;\n\t\t}\n\t}\n\n\t/// \n\t/// Provides a loose-cast to a number.\n\t/// \n\t/// The node.\n\t/// \n\t///\tA string representation of the value as follows:\n\t///\n\t/// - empty string returns 0\n\t/// - all other strings try to parse a number from the value\n\t/// - true returns 1\n\t/// - false returns 0\n\t///\t- numbers are unchanged\n\t/// - null, objects, and arrays return null (not numberifiable)\n\t/// \n\tpublic static decimal? Numberify(this JsonNode? node)\n\t{\n\t\tif (node is null) return 0;\n\n\t\tif (node is not JsonValue value) return null;\n\n\t\tif (value.TryGetValue(out string? s))\n\t\t\treturn s == string.Empty\n\t\t\t\t? 0\n\t\t\t\t: decimal.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture.NumberFormat, out var d)\n\t\t\t\t\t? d\n\t\t\t\t\t: null;\n\n\t\tif (value.TryGetValue(out bool b)) return b ? 1 : 0;\n\n\t\treturn value.GetNumber();\n\n\t}\n\n\t/// \n\t/// Flattens an array into its root components (removes intermediate arrays).\n\t/// \n\t/// The element.\n\t/// Returns a single array with all of the intermediate arrays removed.\n\tpublic static IEnumerable Flatten(this JsonNode? root)\n\t{\n\t\tif (root is not JsonArray array) return new[] { root };", + "snippet": "using System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Logic;\n\n/// \n/// Provides fuzzy-logic exten" + }, + { + "title": "src/JsonLogic/JsonNodeExtensions.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/JsonNodeExtensions.cs#L121-L235", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/JsonNodeExtensions.cs", + "startLine": 121, + "endLine": 235, + "content": "return array.SelectMany(Flatten);\n\t}\n\n\t/// \n\t/// Provides loose equality comparison of values.\n\t/// \n\t/// The first value.\n\t/// The second value.\n\t/// `true` if the values are loosely equal; `false` otherwise.\n\t/// \n\t/// Adapted from [@marvindv/jsonlogic_rs](https://github.com/marvindv/jsonlogic_rs/blob/b2ad93af575f19c6b220a6a54d599e104e72a630/src/operators/logic.rs#L33).\n\t/// \n\tpublic static bool LooseEquals(this JsonNode? a, JsonNode? b)\n\t{\n\t\tif (a is null && b is null) return true;\n\t\tif (a is null || b is null) return false;\n\n\t\tif (a is JsonObject && b is JsonObject) return a.IsEquivalentTo(b);\n\t\tif (a is JsonObject || b is JsonObject) return false;\n\n\t\tif (a is JsonArray && b is JsonArray) return a.IsEquivalentTo(b);\n\t\tif (a is JsonArray aArr)\n\t\t{\n\t\t\tvar aStr = Stringify(aArr);\n\t\t\tvar bVal = (JsonValue)b;\n\t\t\tif (bVal.TryGetValue(out string? bStr)) return aStr == bStr;\n\t\t\tvar bNum = bVal.GetNumber();\n\t\t\tif (!bNum.HasValue) return LooseEquals(b, aStr);\n\t\t\treturn false;\n\t\t}\n\t\tif (b is JsonArray bArr)\n\t\t{\n\t\t\tvar bStr = Stringify(bArr);\n\t\t\tvar aVal = (JsonValue)a;\n\t\t\tif (aVal.TryGetValue(out string? aStr)) return bStr == aStr;\n\t\t\tvar aNum = aVal.GetNumber();\n\t\t\tif (!aNum.HasValue) return LooseEquals(b, bStr);\n\t\t\treturn false;\n\t\t}\n\n\t\tvar aNumber = ((JsonValue)a).GetNumber();\n\t\tvar bNumber = ((JsonValue)b).GetNumber();\n\t\tif (aNumber.HasValue && !bNumber.HasValue) return aNumber == b.Numberify();\n\t\tif (!aNumber.HasValue && bNumber.HasValue) return a.Numberify() == bNumber;\n\n\t\treturn a.IsEquivalentTo(b);\n\t}\n\n\t//fn is_abstract_equal(a: &Value, b: &Value) -> bool {\n\t// use Value::*;\n\n\t// match (a, b) {\n\t// // 1. Strict equal for same types.\n\t// (Array(_), Array(_))\n\t// | (Bool(_), Bool(_))\n\t// | (Null, Null)\n\t// | (Number(_), Number(_))\n\t// | (Object(_), Object(_))\n\t// | (String(_), String(_)) => is_strict_equal(a, b),\n\t// // short-circuit only one operand being null\n\t// (Null, _) | (_, Null) => false,\n\t// // 4. If Type(a) is number and Type(b) is string, return a == ToNumber(b).\n\t// (Number(a), String(_)) => coerce_to_f64(b)\n\t// .map(|b| a.as_f64().unwrap() == b)\n\t// .unwrap_or(false),\n\t// // 5. If Type(a) is string and Type(b) is number, return ToNumber(a) == b.\n\t// (String(_), Number(b)) => coerce_to_f64(a)\n\t// .map(|a| a == b.as_f64().unwrap())\n\t// .unwrap_or(false),\n\t// // 6. If Type(a) is bool return ToNumber(a)==b\n\t// (Bool(_), _) => coerce_to_f64(a)\n\t// .map(|a| is_abstract_equal(&Value::Number(serde_json::Number::from_f64(a).unwrap()), b))\n\t// .unwrap_or(false),\n\t// // 7. If Type(b) is bool return a==ToNumber(b)\n\t// (_, Bool(_)) => coerce_to_f64(b)\n\t// .map(|b| is_abstract_equal(a, &Value::Number(serde_json::Number::from_f64(b).unwrap())))\n\t// .unwrap_or(false),\n\t// // 8. something with object\n\t// // if non array object:\n\t// // An object is never equal to something else, including another object, since\n\t// // ToPrimitive(object) does not work for json.\n\t// (Object(_), _) | (_, Object(_)) => false,\n\t// // if array:\n\t// // the only possible operand types that are still possible are Number and String\n\t// (String(a), Array(b)) | (Array(b), String(a)) => a == &arr_to_primitive_str(b),\n\t// (Number(_), Array(b)) => is_abstract_equal(a, &Value::String(arr_to_primitive_str(b))),\n\t// (Array(a), Number(_)) => is_abstract_equal(&Value::String(arr_to_primitive_str(a)), b),\n\t// }\n\t//}\n\n\t//fn arr_to_primitive_str(arr: &[Value]) -> String {\n\t//\tarr.iter()\n\t//\t\t\t.map(|el| coerce_to_str(el))\n\t//\t\t.collect::>()\n\t//\t\t.join(\",\")\n\t//}\n\n\tinternal static string JsonType(this JsonNode? node)\n\t{\n\t\treturn node switch\n\t\t{\n\t\t\tnull => \"null\",\n\t\t\tJsonObject => \"object\",\n\t\t\tJsonArray => \"array\",\n\t\t\tJsonValue value => value.TryGetValue(out string? _)\n\t\t\t\t? \"string\"\n\t\t\t\t: value.TryGetValue(out bool _)\n\t\t\t\t\t? \"boolean\"\n\t\t\t\t\t: value.GetNumber() != null\n\t\t\t\t\t\t? \"number\"\n\t\t\t\t\t\t: throw new JsonLogicException(\"Unknown node type\"),\n\t\t\t_ => throw new JsonLogicException(\"Unknown node type\")\n\t\t};\n\t}\n}", + "snippet": "return array.SelectMany(Flatten);\n\t}\n\n\t/// \n\t/// Provides loose equality comparison of values.\n\t/// \n\t/// The first value.\n\t/// The second" + }, + { + "title": "src/JsonLogic/JsonSerializerOptionsExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/JsonSerializerOptionsExtensions.cs#L1-L52", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/JsonSerializerOptionsExtensions.cs", + "startLine": 1, + "endLine": 52, + "content": "using System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Logic.Rules;\n\nnamespace Json.Logic;\n\n[JsonSerializable(typeof(Rule))]\n[JsonSerializable(typeof(AddRule))]\n[JsonSerializable(typeof(AllRule))]\n[JsonSerializable(typeof(AndRule))]\n[JsonSerializable(typeof(BooleanCastRule))]\n[JsonSerializable(typeof(CatRule))]\n[JsonSerializable(typeof(DivideRule))]\n[JsonSerializable(typeof(FilterRule))]\n[JsonSerializable(typeof(IfRule))]\n[JsonSerializable(typeof(InRule))]\n[JsonSerializable(typeof(LessThanEqualRule))]\n[JsonSerializable(typeof(LessThanRule))]\n[JsonSerializable(typeof(LiteralRule))]\n[JsonSerializable(typeof(LogRule))]\n[JsonSerializable(typeof(LooseEqualsRule))]\n[JsonSerializable(typeof(LooseNotEqualsRule))]\n[JsonSerializable(typeof(MapRule))]\n[JsonSerializable(typeof(MaxRule))]\n[JsonSerializable(typeof(MergeRule))]\n[JsonSerializable(typeof(MinRule))]\n[JsonSerializable(typeof(MissingRule))]\n[JsonSerializable(typeof(MissingSomeRule))]\n[JsonSerializable(typeof(ModRule))]\n[JsonSerializable(typeof(MoreThanEqualRule))]\n[JsonSerializable(typeof(MoreThanRule))]\n[JsonSerializable(typeof(MultiplyRule))]\n[JsonSerializable(typeof(NoneRule))]\n[JsonSerializable(typeof(NotRule))]\n[JsonSerializable(typeof(OrRule))]\n[JsonSerializable(typeof(ReduceRule))]\n[JsonSerializable(typeof(RuleCollection))]\n[JsonSerializable(typeof(SomeRule))]\n[JsonSerializable(typeof(StrictEqualsRule))]\n[JsonSerializable(typeof(StrictNotEqualsRule))]\n[JsonSerializable(typeof(SubstrRule))]\n[JsonSerializable(typeof(SubtractRule))]\n[JsonSerializable(typeof(VariableRule))]\n[JsonSerializable(typeof(JsonNode))]\n[JsonSerializable(typeof(int))]\n[JsonSerializable(typeof(float))]\n[JsonSerializable(typeof(double))]\n[JsonSerializable(typeof(decimal))]\n[JsonSerializable(typeof(bool))]\n[JsonSerializable(typeof(string))]\ninternal partial class JsonLogicSerializerContext : JsonSerializerContext;", + "snippet": "using System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Logic.Rules;\n\nnamespace Json.Logic;\n\n[JsonSerializable(typeof(Rule))]\n[JsonSerializable(typeof(AddRule))]\n[JsonSerializable(typeof(AllRule))]" + }, + { + "title": "src/JsonLogic/Net8Extensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Net8Extensions.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Net8Extensions.cs", + "startLine": 1, + "endLine": 15, + "content": "#if NETSTANDARD2_0\n\nusing System.Collections.Generic;\n\nnamespace Json.Logic;\n\ninternal static class Net8Extensions\n{\n\tpublic static TValue? GetValueOrDefault(this IReadOnlyDictionary dictionary, TKey key)\n\t{\n\t\treturn dictionary.TryGetValue(key, out var value) ? value : default;\n\t}\n}\n\n#endif", + "snippet": "#if NETSTANDARD2_0\n\nusing System.Collections.Generic;\n\nnamespace Json.Logic;\n\ninternal static class Net8Extensions\n{\n\tpublic static TValue? GetValueOrDefault(this IReadOnlyDictionary dictionar" + }, + { + "title": "src/JsonLogic/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonLogic/obj/Debug/net10.0/JsonLogic.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Debug/net10.0/JsonLogic.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Debug/net10.0/JsonLogic.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JsonLogic built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"6.1.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"6.1.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"6.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonLogic/obj/Debug/net8.0/JsonLogic.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Debug/net8.0/JsonLogic.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Debug/net8.0/JsonLogic.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JsonLogic built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"6.1.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"6.1.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"6.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonLogic/obj/Debug/net9.0/JsonLogic.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Debug/net9.0/JsonLogic.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Debug/net9.0/JsonLogic.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JsonLogic built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"6.1.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"6.1.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"6.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonLogic/obj/Debug/netstandard2.0/JsonLogic.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Debug/netstandard2.0/JsonLogic.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Debug/netstandard2.0/JsonLogic.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JsonLogic built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"6.1.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"6.1.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"6.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonLogic/obj/Release/net10.0/JsonLogic.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Release/net10.0/JsonLogic.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Release/net10.0/JsonLogic.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JsonLogic built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"6.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"6.0.2+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"6.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonLogic/obj/Release/net8.0/JsonLogic.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Release/net8.0/JsonLogic.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Release/net8.0/JsonLogic.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JsonLogic built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"6.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"6.0.2+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"6.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonLogic/obj/Release/net9.0/JsonLogic.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Release/net9.0/JsonLogic.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Release/net9.0/JsonLogic.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JsonLogic built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"6.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"6.0.2+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"6.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonLogic/obj/Release/netstandard2.0/JsonLogic.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/obj/Release/netstandard2.0/JsonLogic.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/obj/Release/netstandard2.0/JsonLogic.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JsonLogic built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"6.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"6.0.2+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonLogic\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"6.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonLogic/OperatorAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/OperatorAttribute.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/OperatorAttribute.cs", + "startLine": 1, + "endLine": 24, + "content": "using System;\n\nnamespace Json.Logic;\n\n/// \n/// Decorates implementations to identify a rule.\n/// \n[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]\npublic class OperatorAttribute : Attribute\n{\n\t/// \n\t/// The identifier.\n\t/// \n\tpublic string Name { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The identifier.\n\tpublic OperatorAttribute(string name)\n\t{\n\t\tName = name;\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Logic;\n\n/// \n/// Decorates implementations to identify a rule.\n/// \n[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]\npublic class Operator" + }, + { + "title": "src/JsonLogic/Rule.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rule.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rule.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Logic.Rules;\nusing Json.More;\n\nnamespace Json.Logic;\n\n/// \n/// Provides a base class for rules.\n/// \n[JsonConverter(typeof(LogicComponentConverter))]\npublic abstract class Rule\n{\n\tinternal JsonNode? Source { get; set; }\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic abstract JsonNode? Apply(JsonNode? data, JsonNode? contextData = null);\n\n\t/// \n\t/// Casts a JSON value to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator Rule(JsonNode? value) => new LiteralRule(value);\n\t/// \n\t/// Casts an `int` value to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator Rule(int value) => new LiteralRule(value);\n\t/// \n\t/// Casts a `string` value to a . Can also be used to create a `null` JSON literal.\n\t/// \n\t/// The value.\n\tpublic static implicit operator Rule(string? value) => value == null ? LiteralRule.Null : new LiteralRule(value);\n\t/// \n\t/// Casts a `bool` value to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator Rule(bool value) => new LiteralRule(value);\n\t/// \n\t/// Casts a `long` value to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator Rule(long value) => new LiteralRule(value);\n\t/// \n\t/// Casts a `decimal` value to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator Rule(decimal value) => new LiteralRule(value);\n\t/// \n\t/// Casts a `float` value to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator Rule(float value) => new LiteralRule(value);\n\t/// \n\t/// Casts a `double` value to a .\n\t/// \n\t/// The value.\n\tpublic static implicit operator Rule(double value) => new LiteralRule(value);\n}\n\n/// \n/// Provides serialization for all derivatives.\n/// \npublic class LogicComponentConverter : JsonConverter\n{\n\t/// \n\t/// Indicates whether should be passed to the converter\n\t/// on serialization, and whether \n\t/// should be passed on deserialization.\n\t/// \n\tpublic override bool HandleNull => true;\n\n\t/// \n\t/// Gets or sets whether to save the source data for re-serialization; default is true.\n\t/// \n\tpublic bool SaveSource { get; set; } = true;\n\n\t/// Reads and converts the JSON to type .\n\t/// The reader.\n\t/// The type to convert.\n\t/// An object that specifies serialization options to use.\n\t/// The converted value.\n\tpublic override Rule Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar node = options.Read(ref reader, JsonLogicSerializerContext.Default.JsonNode);\n\t\tRule rule;\n\n\t\tif (node is JsonObject)\n\t\t{\n\t\t\tif (node is not JsonObject { Count: 1 } data)\n\t\t\t{\n\t\t\t\trule = new LiteralRule(node);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar (op, args) = data.First();\n\n\t\t\t\tvar ruleType = RuleRegistry.GetRule(op) ??\n\t\t\t\t throw new JsonException($\"Cannot identify rule for {op}\");\n\t\t\t\tvar typeInfo = RuleRegistry.GetTypeInfo(ruleType) ??\n\t\t\t\t options.GetTypeInfo(ruleType) ??\n\t\t\t\t throw new JsonException($\"Cannot get JsonTypeInfo for rule type {ruleType}\");\n\n\t\t\t\trule = args is null\n\t\t\t\t\t? (Rule)JsonSerializer.Deserialize(\"[]\", typeInfo)!\n\t\t\t\t\t: (Rule)args.Deserialize(typeInfo)!;\n\t\t\t}\n\t\t}\n\t\telse if (node is JsonArray)", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Logic.Rules;\nusing Json.More;\n\nnamespace Json.Logic;\n\n/// \n/// Provides a b" + }, + { + "title": "src/JsonLogic/Rule.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rule.cs#L121-L150", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rule.cs", + "startLine": 121, + "endLine": 150, + "content": "{\n\t\t\tvar data = node.AsArray().Select(x => x.Deserialize(JsonLogicSerializerContext.Default.Rule)!).ToArray();\n\t\t\trule = new RuleCollection(data);\n\t\t}\n\t\telse\n\t\t\trule = new LiteralRule(node);\n\n\t\tif (SaveSource)\n\t\t\trule.Source = node;\n\t\treturn rule;\n\t}\n\n\t/// Writes a specified value as JSON.\n\t/// The writer to write to.\n\t/// The value to convert to JSON.\n\t/// An object that specifies serialization options to use.\n\tpublic override void Write(Utf8JsonWriter writer, Rule value, JsonSerializerOptions options)\n\t{\n\t\tif (value.Source != null)\n\t\t{\n\t\t\toptions.Write(writer, value.Source, JsonLogicSerializerContext.Default.JsonNode);\n\t\t\treturn;\n\t\t}\n\n\t\tvar ruleType = value.GetType();\n\t\tvar typeInfo = RuleRegistry.GetTypeInfo(ruleType)!;\n\t\tvar converter = (IWeaklyTypedJsonConverter)typeInfo.Converter;\n\t\tconverter.Write(writer, value, options, typeInfo);\n\t}\n}", + "snippet": "{\n\t\t\tvar data = node.AsArray().Select(x => x.Deserialize(JsonLogicSerializerContext.Default.Rule)!).ToArray();\n\t\t\trule = new RuleCollection(data);\n\t\t}\n\t\telse\n\t\t\trule = new LiteralRule(node);\n\n\t\tif (SaveSource)\n\t\t\trule.So" + }, + { + "title": "src/JsonLogic/RuleExtensions.cs (1/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/RuleExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/RuleExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing System.Text.Json.Nodes;\nusing Json.Logic.Rules;\n\nnamespace Json.Logic;\n\n/// \n/// Calls with no data.\n/// \npublic static class RuleExtensions\n{\n\t/// \n\t/// Calls with no data.\n\t/// \n\t/// The rule.\n\t/// The result.\n\tpublic static JsonNode? Apply(this Rule rule)\n\t{\n\t\treturn rule.Apply(null);\n\t}\n\n\t/// \n\t/// Gets the collection of items within the rule.\n\t/// \n\t/// The rule\n\t/// The collection of rules.\n\tpublic static IEnumerable GetItems(this AddRule rule)\n\t{\n\t\treturn rule.Items.AsReadOnly();\n\t}\n\n\t/// \n\t/// Gets the rule that returns the input.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetInput(this AllRule rule)\n\t{\n\t\treturn rule.Input;\n\t}\n\n\t/// \n\t/// Gets the rule that the items in the input should follow.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRule(this AllRule rule)\n\t{\n\t\treturn rule.Rule;\n\t}\n\n\t/// \n\t/// Gets the collection of items within the rule.\n\t/// \n\t/// The rule\n\t/// The collection of items.\n\tpublic static IEnumerable GetItems(this AndRule rule)\n\t{\n\t\treturn rule.Items.AsReadOnly();\n\t}\n\n\t/// \n\t/// Gets the rule that returns the value.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetValue(this BooleanCastRule rule)\n\t{\n\t\treturn rule.Value;\n\t}\n\n\t/// \n\t/// Gets the collection of items within the rule.\n\t/// \n\t/// The rule\n\t/// The collection of rules.\n\tpublic static IEnumerable GetItems(this CatRule rule)\n\t{\n\t\treturn rule.Items.AsReadOnly();\n\t}\n\n\t/// \n\t/// Gets the rule that returns the dividend.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetDividend(this DivideRule rule)\n\t{\n\t\treturn rule.A;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the divisor.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetDivisor(this DivideRule rule)\n\t{\n\t\treturn rule.B;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the input.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetInput(this FilterRule rule)\n\t{\n\t\treturn rule.Input;\n\t}\n\n\t/// \n\t/// Gets the rule that the items in the input should follow.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRule(this FilterRule rule)\n\t{\n\t\treturn rule.Rule;\n\t}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json.Nodes;\nusing Json.Logic.Rules;\n\nnamespace Json.Logic;\n\n/// \n/// Calls with no data.\n/// \npublic static class RuleExtens" + }, + { + "title": "src/JsonLogic/RuleExtensions.cs (2/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/RuleExtensions.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/RuleExtensions.cs", + "startLine": 121, + "endLine": 240, + "content": "/// \n\t/// Gets the rule that returns the condition.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule? GetCondition(this IfRule rule)\n\t{\n\t\treturn rule.Components.Count > 0 ? rule.Components[0] : null;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the then requirement.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule? GetThen(this IfRule rule)\n\t{\n\t\treturn rule.Components.Count > 1 ? rule.Components[1] : null;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the else requirement.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule? GetElse(this IfRule rule)\n\t{\n\t\treturn rule.Components.Count > 2 ? rule.Components[2] : null;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the test.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetTest(this InRule rule)\n\t{\n\t\treturn rule.Test;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the value.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetValue(this InRule rule)\n\t{\n\t\treturn rule.Value;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the left operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetLeft(this LessThanEqualRule rule)\n\t{\n\t\treturn rule.A;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the middle operand, if there is one.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule? GetMiddle(this LessThanEqualRule rule)\n\t{\n\t\treturn rule.C is null ? null : rule.B;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the right operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRight(this LessThanEqualRule rule)\n\t{\n\t\treturn rule.C ?? rule.B;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the left operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetLeft(this LessThanRule rule)\n\t{\n\t\treturn rule.A;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the middle operand, if there is one.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule? GetMiddle(this LessThanRule rule)\n\t{\n\t\treturn rule.C is null ? null : rule.B;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the right operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRight(this LessThanRule rule)\n\t{\n\t\treturn rule.C ?? rule.B;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the value.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetValue(this LiteralRule rule)\n\t{\n\t\treturn rule.Value;\n\t}", + "snippet": "/// \n\t/// Gets the rule that returns the condition.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule? GetCondition(this IfRule rule)\n\t{\n\t\treturn rule.C" + }, + { + "title": "src/JsonLogic/RuleExtensions.cs (3/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/RuleExtensions.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/RuleExtensions.cs", + "startLine": 241, + "endLine": 360, + "content": "/// \n\t/// Gets the rule that returns the log entry.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetValue(this LogRule rule)\n\t{\n\t\treturn rule.Log;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the left operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetLeft(this LooseEqualsRule rule)\n\t{\n\t\treturn rule.A;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the right operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRight(this LooseEqualsRule rule)\n\t{\n\t\treturn rule.B;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the left operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetLeft(this LooseNotEqualsRule rule)\n\t{\n\t\treturn rule.A;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the right operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRight(this LooseNotEqualsRule rule)\n\t{\n\t\treturn rule.B;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the input.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetInput(this MapRule rule)\n\t{\n\t\treturn rule.Input;\n\t}\n\n\t/// \n\t/// Gets the rule to process the items in the input.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRule(this MapRule rule)\n\t{\n\t\treturn rule.Rule;\n\t}\n\n\t/// \n\t/// Gets the collection of items within the rule.\n\t/// \n\t/// The rule\n\t/// The collection of rules.\n\tpublic static IEnumerable GetItems(this MaxRule rule)\n\t{\n\t\treturn rule.Items.AsReadOnly();\n\t}\n\n\t/// \n\t/// Gets the collection of items within the rule.\n\t/// \n\t/// The rule\n\t/// The collection of rules.\n\tpublic static IEnumerable GetItems(this MergeRule rule)\n\t{\n\t\treturn rule.Items.AsReadOnly();\n\t}\n\n\t/// \n\t/// Gets the collection of items within the rule.\n\t/// \n\t/// The rule\n\t/// The collection of rules.\n\tpublic static IEnumerable GetItems(this MinRule rule)\n\t{\n\t\treturn rule.Items.AsReadOnly();\n\t}\n\n\t/// \n\t/// Gets the collection of items within the rule.\n\t/// \n\t/// The rule\n\t/// The collection of rules.\n\tpublic static IEnumerable GetItems(this MissingRule rule)\n\t{\n\t\treturn rule.Components;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the required count.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRequiredCount(this MissingSomeRule rule)\n\t{\n\t\treturn rule.RequiredCount;\n\t}", + "snippet": "/// \n\t/// Gets the rule that returns the log entry.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetValue(this LogRule rule)\n\t{\n\t\treturn rule.Log;\n" + }, + { + "title": "src/JsonLogic/RuleExtensions.cs (4/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/RuleExtensions.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/RuleExtensions.cs", + "startLine": 361, + "endLine": 480, + "content": "/// \n\t/// Gets the rule that returns the items collection.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetItems(this MissingSomeRule rule)\n\t{\n\t\treturn rule.Components;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the dividend.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetDividend(this ModRule rule)\n\t{\n\t\treturn rule.A;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the divisor.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetDivisor(this ModRule rule)\n\t{\n\t\treturn rule.B;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the left operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetLeft(this MoreThanEqualRule rule)\n\t{\n\t\treturn rule.A;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the right operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRight(this MoreThanEqualRule rule)\n\t{\n\t\treturn rule.B;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the left operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetLeft(this MoreThanRule rule)\n\t{\n\t\treturn rule.A;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the right operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRight(this MoreThanRule rule)\n\t{\n\t\treturn rule.B;\n\t}\n\n\t/// \n\t/// Gets the collection of items within the rule.\n\t/// \n\t/// The rule\n\t/// The collection of rules.\n\tpublic static IEnumerable GetItems(this MultiplyRule rule)\n\t{\n\t\treturn rule.Items;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the input.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetInput(this NoneRule rule)\n\t{\n\t\treturn rule.Input;\n\t}\n\n\t/// \n\t/// Gets the rule that the items in the input should not follow.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRule(this NoneRule rule)\n\t{\n\t\treturn rule.Rule;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the value.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetValue(this NotRule rule)\n\t{\n\t\treturn rule.Value;\n\t}\n\n\t/// \n\t/// Gets the collection of items within the rule.\n\t/// \n\t/// The rule\n\t/// The collection of rules.\n\tpublic static IEnumerable GetItems(this OrRule rule)\n\t{\n\t\treturn rule.Items;\n\t}", + "snippet": "/// \n\t/// Gets the rule that returns the items collection.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetItems(this MissingSomeRule rule)\n\t{\n\t\tre" + }, + { + "title": "src/JsonLogic/RuleExtensions.cs (5/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/RuleExtensions.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/RuleExtensions.cs", + "startLine": 481, + "endLine": 600, + "content": "/// \n\t/// Gets the rule that returns the input.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetInput(this ReduceRule rule)\n\t{\n\t\treturn rule.Input;\n\t}\n\n\t/// \n\t/// Gets the rule to process the items in the input.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRule(this ReduceRule rule)\n\t{\n\t\treturn rule.Rule;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the initial value.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetInitial(this ReduceRule rule)\n\t{\n\t\treturn rule.Initial;\n\t}\n\n\t/// \n\t/// Gets the collection of items within the rule.\n\t/// \n\t/// The rule\n\t/// The collection of rules.\n\tpublic static IEnumerable GetItems(this RuleCollection rule)\n\t{\n\t\treturn rule.Rules;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the input.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetInput(this SomeRule rule)\n\t{\n\t\treturn rule.Input;\n\t}\n\n\t/// \n\t/// Gets the rule that the items in the input should follow.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRule(this SomeRule rule)\n\t{\n\t\treturn rule.Rule;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the left operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetLeft(this StrictEqualsRule rule)\n\t{\n\t\treturn rule.A;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the right operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRight(this StrictEqualsRule rule)\n\t{\n\t\treturn rule.B;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the left operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetLeft(this StrictNotEqualsRule rule)\n\t{\n\t\treturn rule.A;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the right operand.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetRight(this StrictNotEqualsRule rule)\n\t{\n\t\treturn rule.B;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the input.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetInput(this SubstrRule rule)\n\t{\n\t\treturn rule.Input;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the start index.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetStart(this SubstrRule rule)\n\t{\n\t\treturn rule.Start;\n\t}", + "snippet": "/// \n\t/// Gets the rule that returns the input.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule GetInput(this ReduceRule rule)\n\t{\n\t\treturn rule.Input;" + }, + { + "title": "src/JsonLogic/RuleExtensions.cs (6/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/RuleExtensions.cs#L601-L641", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/RuleExtensions.cs", + "startLine": 601, + "endLine": 641, + "content": "/// \n\t/// Gets the rule that returns the character count.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule? GetCount(this SubstrRule rule)\n\t{\n\t\treturn rule.Count;\n\t}\n\n\t/// \n\t/// Gets the collection of items within the rule.\n\t/// \n\t/// The rule\n\t/// The collection of rules.\n\tpublic static IEnumerable GetItems(this SubtractRule rule)\n\t{\n\t\treturn rule.Items;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the path.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule? GetPath(this VariableRule rule)\n\t{\n\t\treturn rule.Path;\n\t}\n\n\t/// \n\t/// Gets the rule that returns the default value.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule? GetDefault(this VariableRule rule)\n\t{\n\t\treturn rule.DefaultValue;\n\t}\n}", + "snippet": "/// \n\t/// Gets the rule that returns the character count.\n\t/// \n\t/// The rule\n\t/// A rule.\n\tpublic static Rule? GetCount(this SubstrRule rule)\n\t{\n\t\treturn " + }, + { + "title": "src/JsonLogic/RuleRegistry.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/RuleRegistry.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/RuleRegistry.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text.Json.Serialization;\nusing System.Text.Json.Serialization.Metadata;\nusing Json.Logic.Rules;\nusing Json.More;\n\nnamespace Json.Logic;\n\n/// \n/// Catalogs all of the known rules.\n/// \npublic static class RuleRegistry\n{\n\tprivate static readonly ConcurrentDictionary _rules;\n\tprivate static readonly ConcurrentDictionary _ruleHandlers;\n\tprivate static readonly ConcurrentDictionary _ruleResolvers;\n\n\tstatic RuleRegistry()\n\t{\n\t\t_rules = new ConcurrentDictionary(new Dictionary\n\t\t{\n\t\t\t{ \"+\", typeof(AddRule) },\n\t\t\t{ \"all\", typeof(AllRule) },\n\t\t\t{ \"and\", typeof(AndRule) },\n\t\t\t{ \"!!\", typeof(BooleanCastRule) },\n\t\t\t{ \"cat\", typeof(CatRule) },\n\t\t\t{ \"/\", typeof(DivideRule) },\n\t\t\t{ \"filter\", typeof(FilterRule) },\n\t\t\t{ \"if\", typeof(IfRule) },\n\t\t\t{ \"?:\", typeof(IfRule) },\n\t\t\t{ \"in\", typeof(InRule) },\n\t\t\t{ \"<=\", typeof(LessThanEqualRule) },\n\t\t\t{ \"<\", typeof(LessThanRule) },\n\t\t\t{ \"\", typeof(LiteralRule) },\n\t\t\t{ \"log\", typeof(LogRule) },\n\t\t\t{ \"==\", typeof(LooseEqualsRule) },\n\t\t\t{ \"!=\", typeof(LooseNotEqualsRule) },\n\t\t\t{ \"map\", typeof(MapRule) },\n\t\t\t{ \"max\", typeof(MaxRule) },\n\t\t\t{ \"merge\", typeof(MergeRule) },\n\t\t\t{ \"min\", typeof(MinRule) },\n\t\t\t{ \"missing\", typeof(MissingRule) },\n\t\t\t{ \"missing_some\", typeof(MissingSomeRule) },\n\t\t\t{ \"%\", typeof(ModRule) },\n\t\t\t{ \">=\", typeof(MoreThanEqualRule) },\n\t\t\t{ \">\", typeof(MoreThanRule) },\n\t\t\t{ \"*\", typeof(MultiplyRule) },\n\t\t\t{ \"none\", typeof(NoneRule) },\n\t\t\t{ \"!\", typeof(NotRule) },\n\t\t\t{ \"or\", typeof(OrRule) },\n\t\t\t{ \"reduce\", typeof(ReduceRule) },\n\t\t\t{ \"some\", typeof(SomeRule) },\n\t\t\t{ \"===\", typeof(StrictEqualsRule) },\n\t\t\t{ \"!==\", typeof(StrictNotEqualsRule) },\n\t\t\t{ \"substr\", typeof(SubstrRule) },\n\t\t\t{ \"-\", typeof(SubtractRule) },\n\t\t\t{ \"var\", typeof(VariableRule) }\n\t\t});\n\t\t_ruleHandlers = new()\n\t\t{\n\t\t\t[\"+\"] = new AddRule(),\n\t\t\t[\"all\"] = new AllRule(),\n\t\t\t[\"and\"] = new AndRule(),\n\t\t\t[\"!!\"] = new BooleanCastRule(),\n\t\t\t[\"cat\"] = new CatRule(),\n\t\t\t[\"/\"] = new DivideRule(),\n\t\t\t[\"filter\"] = new FilterRule(),\n\t\t\t[\"if\"] = new IfRule(),\n\t\t\t[\"?:\"] = new IfRule(),\n\t\t\t[\"in\"] = new InRule(),\n\t\t\t[\"<=\"] = new LessThanEqualRule(),\n\t\t\t[\"<\"] = new LessThanRule(),\n\t\t\t[\"log\"] = new LogRule(),\n\t\t\t[\"==\"] = new LooseEqualsRule(),\n\t\t\t[\"!=\"] = new LooseNotEqualsRule(),\n\t\t\t[\"max\"] = new MaxRule(),\n\t\t\t[\"map\"] = new MapRule(),\n\t\t\t[\"merge\"] = new MergeRule(),\n\t\t\t[\"min\"] = new MinRule(),\n\t\t\t[\"missing\"] = new MissingRule(),\n\t\t\t[\"missing_some\"] = new MissingSomeRule(),\n\t\t\t[\"%\"] = new ModRule(),\n\t\t\t[\">=\"] = new MoreThanEqualRule(),\n\t\t\t[\">\"] = new MoreThanRule(),\n\t\t\t[\"*\"] = new MultiplyRule(),\n\t\t\t[\"none\"] = new NoneRule(),\n\t\t\t[\"!\"] = new NotRule(),\n\t\t\t[\"or\"] = new OrRule(),\n\t\t\t[\"reduce\"] = new ReduceRule(),\n\t\t\t[\"some\"] = new SomeRule(),\n\t\t\t[\"substr\"] = new SubstrRule(),\n\t\t\t[\"===\"] = new StrictEqualsRule(),\n\t\t\t[\"!==\"] = new StrictNotEqualsRule(),\n\t\t\t[\"-\"] = new SubtractRule(),\n\t\t\t[\"var\"] = new VariableRule(),\n\t\t};\n\t\t_ruleResolvers = new ConcurrentDictionary(_rules.Values.Distinct().ToDictionary(x => x, _ => (JsonSerializerContext)JsonLogicSerializerContext.Default));\n\t}\n\n\t/// \n\t/// Gets a implementation for a given identifier string.\n\t/// \n\t/// The identifier.\n\t/// The of the rule.\n\tpublic static Type? GetRule(string identifier)\n\t{\n\t\treturn _rules.GetValueOrDefault(identifier);\n\t}\n\n\t/// \n\t/// Gets an handler for model-less rule evaluation.\n\t/// \n\t/// The operator that the rule handles.\n\t/// The handler implementation.\n\tpublic static IRule? GetHandler(string op)", + "snippet": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text.Json.Serialization;\nusing System.T" + }, + { + "title": "src/JsonLogic/RuleRegistry.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/RuleRegistry.cs#L121-L194", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/RuleRegistry.cs", + "startLine": 121, + "endLine": 194, + "content": "{\n\t\treturn _ruleHandlers.GetValueOrDefault(op);\n\t}\n\n\t/// \n\t/// Registers a new rule type.\n\t/// \n\t/// The type of the rule to add.\n\t/// \n\t/// Rules must contain a parameterless constructor.\n\t///\n\t/// Decorate your rule type with one or more s to\n\t/// define its identifier.\n\t///\n\t/// Registering a rule with an identifier that already exists will overwrite the\n\t/// existing registration.\n\t/// \n\t[RequiresDynamicCode(\"For AOT support, use Register that takes a JsonTypeInfo. Using this method requires reflection later.\")]\n\tpublic static void AddRule()\n\t\twhere T : Rule\n\t{\n\t\tvar type = typeof(T);\n\t\tvar operators = type.GetCustomAttributes().Select(a => a.Name);\n\t\tforeach (var name in operators)\n\t\t{\n\t\t\t_rules[name] = type;\n\t\t}\n\t}\n\n\t/// \n\t/// Adds a custom implementation.\n\t/// \n\t/// The operator that the rule handles.\n\t/// The rule implementation.\n\tpublic static void AddRule(string op, IRule rule)\n\t{\n\t\t_ruleHandlers[op] = rule;\n\t}\n\n\t/// \n\t/// Registers a new rule type.\n\t/// \n\t/// The type of the rule to add.\n\t/// \n\t/// Rules must contain a parameterless constructor.\n\t///\n\t/// Decorate your rule type with one or more s to\n\t/// define its identifier.\n\t///\n\t/// Registering a rule with an identifier that already exists will overwrite the\n\t/// existing registration.\n\t/// \n\tpublic static void AddRule(JsonSerializerContext typeContext)\n\t\twhere T : Rule\n\t{\n\t\tvar type = typeof(T);\n\t\tvar typeInfo = typeContext.GetTypeInfo(typeof(T)) ??\n\t\t throw new ArgumentException($\"Rule implementation `{typeof(T).Name}` does not have a JsonTypeInfo\");\n\t\t_ = typeInfo.Converter as IWeaklyTypedJsonConverter ??\n\t\t throw new ArgumentException(\"Rule Converter must implement IWeaklyTypedJsonConverter or WeaklyTypedJsonConverter to be AOT compatible\");\n\t\tvar operators = type.GetCustomAttributes().Select(a => a.Name);\n\t\tforeach (var name in operators)\n\t\t{\n\t\t\t_rules[name] = type;\n\t\t}\n\n\t\t_ruleResolvers[type] = typeContext;\n\t}\n\n\tinternal static JsonTypeInfo? GetTypeInfo(Type ruleType)\n\t{\n\t\treturn _ruleResolvers.TryGetValue(ruleType, out var context) ? context.GetTypeInfo(ruleType) : null;\n\t}\n}", + "snippet": "{\n\t\treturn _ruleHandlers.GetValueOrDefault(op);\n\t}\n\n\t/// \n\t/// Registers a new rule type.\n\t/// \n\t/// The type of the rule to add.\n\t/// \n\t/// Rules must contain " + }, + { + "title": "src/JsonLogic/Rules/AddRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/AddRule.cs#L1-L116", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/AddRule.cs", + "startLine": 1, + "endLine": 116, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `+` operation.\n/// \n[Operator(\"+\")]\n[JsonConverter(typeof(AddRuleJsonConverter))]\npublic class AddRule : Rule, IRule\n{\n\t/// \n\t/// The sequence of values to add together.\n\t/// \n\tprotected internal List Items { get; }\n\n\t/// \n\t/// Creates a new instance of when '+' operator is detected within json logic.\n\t/// \n\t/// The first value, to which other values will be added to.\n\t/// Sequence of values to add to the first value.\n\tprotected internal AddRule(Rule a, params Rule[] more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance of when '+' operator is detected within json logic.\n\t/// \n\t/// The first value, to which other values will be added to.\n\t/// Sequence of values to add to the first value.\n\tprotected internal AddRule(Rule a, ReadOnlySpan more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal AddRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tdecimal result = 0;\n\n\t\tforeach (var item in Items)\n\t\t{\n\t\t\tvar value = item.Apply(data, contextData);\n\n\t\t\tvar number = value.Numberify();\n\n\t\t\tif (number == null) return null;\n\n\t\t\tresult += number.Value;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray array)\n\t\t\treturn JsonLogic.Apply(args, context).Numberify();\n\n\t\tdecimal result = 0;\n\t\tforeach (var item in array)\n\t\t{\n\t\t\tvar value = JsonLogic.Apply(item, context);\n\t\t\tvar number = value.Numberify();\n\t\t\tif (number is null) return null;\n\n\t\t\tresult += number.Value;\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\ninternal class AddRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override AddRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = reader.TokenType == JsonTokenType.StartArray\n\t\t\t? options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule)\n\t\t\t: new[] { options.Read(ref reader, JsonLogicSerializerContext.Default.Rule)! };\n\n\t\tif (parameters == null || parameters.Length == 0)\n\t\t\tthrow new JsonException(\"The + rule needs an array of parameters.\");\n\n\t\treturn new AddRule(parameters[0], parameters.Skip(1).ToArray());\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, AddRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"+\");\n\t\toptions.WriteList(writer, value.Items, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n" + }, + { + "title": "src/JsonLogic/Rules/AllRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/AllRule.cs#L1-L108", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/AllRule.cs", + "startLine": 1, + "endLine": 108, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `all` operation.\n/// \n[Operator(\"all\")]\n[JsonConverter(typeof(AllRuleJsonConverter))]\npublic class AllRule : Rule, IRule\n{\n\t/// \n\t/// The sequence of elements to apply the rule to.\n\t/// \n\tprotected internal Rule Input { get; }\n\t\n\t/// \n\t/// The rule to apply to All items in the input sequence.\n\t/// \n\tprotected internal Rule Rule { get; }\n\n\t/// \n\t/// Creates a new instance of when 'all' operator is detected within json logic.\n\t/// \n\t/// A sequence of elements to apply the rule to.\n\t/// A rule to apply to All items in the input sequence.\n\tprotected internal AllRule(Rule input, Rule rule)\n\t{\n\t\tInput = input;\n\t\tRule = rule;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal AllRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar input = Input.Apply(data, contextData);\n\n\t\tif (input is not JsonArray arr) return false;\n\n\t\tvar results = arr.Select(value => Rule.Apply(contextData, value)).ToList();\n\t\treturn (results.Count != 0 &&\n\t\t\t\tresults.All(result => result.IsTruthy()));\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonLogicException(\"The 'all' rule requires an array with two arguments\");\n\n\t\tvar input = JsonLogic.Apply(array[0], context);\n\t\tvar rule = array[1];\n\n\t\tif (input is not JsonArray {Count: > 0} items) return false;\n\n\t\tforeach (var item in items)\n\t\t{\n\t\t\tcontext.Push(item);\n\t\t\tvar localResult = JsonLogic.Apply(rule, context).IsTruthy();\n\t\t\tcontext.Pop();\n\n\t\t\tif (!localResult) return false;\n\t\t}\n\n\t\treturn true;\n\t}\n}\n\ninternal class AllRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override AllRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length:2})\n\t\t\tthrow new JsonException(\"The all rule needs an array with 2 parameters.\");\n\n\t\treturn new AllRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, AllRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"all\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.Input, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.Rule, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `all` operation.\n/" + }, + { + "title": "src/JsonLogic/Rules/AndRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/AndRule.cs#L1-L108", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/AndRule.cs", + "startLine": 1, + "endLine": 108, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `and` operation.\n/// \n[Operator(\"and\")]\n[JsonConverter(typeof(AndRuleJsonConverter))]\npublic class AndRule : Rule, IRule\n{\n\t/// \n\t/// The sequence of values to And against.\n\t/// \n\tprotected internal List Items { get; }\n\n\t/// \n\t/// Creates a new instance of when 'and' operator is detected within json logic.\n\t/// \n\t/// The first value.\n\t/// Sequence of values to And against.\n\tprotected internal AndRule(Rule a, params Rule[] more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance of when 'and' operator is detected within json logic.\n\t/// \n\t/// The first value.\n\t/// Sequence of values to And against.\n\tprotected internal AndRule(Rule a, ReadOnlySpan more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal AndRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar items = Items.Select(i => i.Apply(data, contextData));\n\t\tJsonNode? first = false;\n\t\tforeach (var x in items)\n\t\t{\n\t\t\tfirst = x;\n\t\t\tif (!x.IsTruthy()) break;\n\t\t}\n\n\t\treturn first;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray array)\n\t\t\tthrow new JsonLogicException(\"The 'and' rule requires an array of arguments\");\n\n\t\tif (array.Count == 0) return false;\n\n\t\tJsonNode? result = null;\n\t\tforeach (var item in array)\n\t\t{\n\t\t\tresult = JsonLogic.Apply(item, context);\n\t\t\tif (!result.IsTruthy()) break;\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\ninternal class AndRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override AndRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters == null || parameters.Length == 0)\n\t\t\tthrow new JsonException(\"The and rule needs an array of parameters.\");\n\n\t\treturn new AndRule(parameters[0], parameters.Skip(1).ToArray());\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, AndRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"and\");\n\t\toptions.WriteList(writer, value.Items, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n" + }, + { + "title": "src/JsonLogic/Rules/BooleanCastRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/BooleanCastRule.cs#L1-L79", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/BooleanCastRule.cs", + "startLine": 1, + "endLine": 79, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `!!` operation.\n/// \n[Operator(\"!!\")]\n[JsonConverter(typeof(BooleanCastRuleJsonConverter))]\npublic class BooleanCastRule : Rule, IRule\n{\n\t/// \n\t/// The value to test.\n\t/// \n\tprotected internal Rule Value { get; }\n\n\t/// \n\t/// Creates a new instance of when '!!' operator is detected within json logic.\n\t/// \n\t/// The value to test.\n\tprotected internal BooleanCastRule(Rule value)\n\t{\n\t\tValue = value;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal BooleanCastRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\treturn Value.Apply(data, contextData).IsTruthy();\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray {Count: 1} array)\n\t\t\tthrow new JsonLogicException(\"The '!!' rule needs an array with a single parameter\");\n\n\t\treturn JsonLogic.Apply(array[0], context).IsTruthy();\n\t}\n}\n\ninternal class BooleanCastRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override BooleanCastRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 1 })\n\t\t\tthrow new JsonException(\"The !! rule needs an array with a single parameter.\");\n\n\t\treturn new BooleanCastRule(parameters[0]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, BooleanCastRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"!!\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.Value, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `!!` operation.\n/// \n[Opera" + }, + { + "title": "src/JsonLogic/Rules/CatRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/CatRule.cs#L1-L112", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/CatRule.cs", + "startLine": 1, + "endLine": 112, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `cat` operation.\n/// \n[Operator(\"cat\")]\n[JsonConverter(typeof(CatRuleJsonConverter))]\npublic class CatRule : Rule, IRule\n{\n\t/// \n\t/// The sequence of values to concatenate together.\n\t/// \n\tprotected internal List Items { get; }\n\n\t/// \n\t/// Creates a new instance of when 'cat' operator is detected within json logic.\n\t/// \n\t/// The first value, to which subsequent values will be concatenated to.\n\t/// A sequence of values to concatenate to the first value.\n\tprotected internal CatRule(Rule a, params Rule[] more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance of when 'cat' operator is detected within json logic.\n\t/// \n\t/// The first value, to which subsequent values will be concatenated to.\n\t/// A sequence of values to concatenate to the first value.\n\tprotected internal CatRule(Rule a, ReadOnlySpan more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal CatRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar result = string.Empty;\n\n\t\tforeach (var item in Items)\n\t\t{\n\t\t\tvar value = item.Apply(data, contextData);\n\n\t\t\tvar str = value.Stringify();\n\n\t\t\tresult += str ?? throw new JsonLogicException($\"Cannot concatenate {value.JsonType()}\");\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray array) return args;\n\n\t\tvar result = new StringBuilder();\n\t\tforeach (var item in array)\n\t\t{\n\t\t\tvar value = JsonLogic.Apply(item, context);\n\t\t\tvar str = value.Stringify() ?? throw new JsonLogicException($\"Cannot concatenate {value.JsonType()}.\");\n\t\t\tresult.Append(str);\n\t\t}\n\n\t\treturn result.ToString();\n\t}\n}\n\ninternal class CatRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override CatRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = reader.TokenType == JsonTokenType.StartArray\n\t\t\t? options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule)\n\t\t\t: new[] { options.Read(ref reader, JsonLogicSerializerContext.Default.Rule)! };\n\n\t\tif (parameters == null || parameters.Length == 0)\n\t\t\tthrow new JsonException(\"The cat rule needs an array of parameters.\");\n\n\t\treturn new CatRule(parameters[0], parameters.Skip(1).ToArray());\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, CatRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"cat\");\n\t\toptions.WriteList(writer, value.Items, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rul" + }, + { + "title": "src/JsonLogic/Rules/DivideRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/DivideRule.cs#L1-L99", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/DivideRule.cs", + "startLine": 1, + "endLine": 99, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `/` operation.\n/// \n[Operator(\"/\")]\n[JsonConverter(typeof(DivideRuleJsonConverter))]\npublic class DivideRule : Rule, IRule\n{\n\t/// \n\t/// The value to divide.\n\t/// \n\tprotected internal Rule A { get; }\n\t/// \n\t/// The divisor.\n\t/// \n\tprotected internal Rule B { get; }\n\n\t/// \n\t/// Creates a new instance of when '/' operator is detected within json logic.\n\t/// \n\t/// The value to divide.\n\t/// The divisor, ie; the value to divide by.\n\tprotected internal DivideRule(Rule a, Rule b)\n\t{\n\t\tA = a;\n\t\tB = b;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal DivideRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar a = A.Apply(data, contextData);\n\t\tvar b = B.Apply(data, contextData);\n\n\t\tvar numberA = a.Numberify();\n\t\tvar numberB = b.Numberify();\n\n\t\tif (numberA == null || numberB == null) return null;\n\n\t\tif (numberB == 0) return null;\n\n\t\treturn numberA.Value / numberB.Value;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray {Count: 2} array)\n\t\t\tthrow new JsonLogicException(\"The '/' rule needs an array with 2 parameters\");\n\n\t\tvar a = JsonLogic.Apply(array[0], context).Numberify();\n\t\tvar b = JsonLogic.Apply(array[1], context).Numberify();\n\n\t\treturn b == 0 ? null : a / b;\n\t}\n}\n\ninternal class DivideRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override DivideRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The / rule needs an array with 2 parameters.\");\n\n\t\treturn new DivideRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, DivideRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"/\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.A, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.B, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `/` operation.\n/// \n[Operat" + }, + { + "title": "src/JsonLogic/Rules/FilterRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/FilterRule.cs#L1-L109", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/FilterRule.cs", + "startLine": 1, + "endLine": 109, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `filter` operation.\n/// \n[Operator(\"filter\")]\n[JsonConverter(typeof(FilterRuleJsonConverter))]\npublic class FilterRule : Rule, IRule\n{\n\t/// \n\t/// A sequence of values to filter.\n\t/// \n\tprotected internal Rule Input { get; }\n\t\n\t/// \n\t/// A predicate to apply to each item in the sequence.\n\t/// \n\tprotected internal Rule Rule { get; }\n\n\t/// \n\t/// Creates a new instance of when 'filter' operator is detected within json logic.\n\t/// \n\t/// A sequence of values to filter.\n\t/// A predicate to apply to each item in the sequence.\n\tprotected internal FilterRule(Rule input, Rule rule)\n\t{\n\t\tInput = input;\n\t\tRule = rule;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal FilterRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar input = Input.Apply(data, contextData);\n\n\t\tif (input is not JsonArray arr)\n\t\t\treturn new JsonArray();\n\n\t\treturn arr.Where(i => Rule.Apply(data, i).IsTruthy()).ToJsonArray();\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonLogicException(\"The 'filter' rule requires an array with two arguments\");\n\n\t\tvar input = JsonLogic.Apply(array[0], context);\n\t\tvar rule = array[1];\n\n\t\tif (input is not JsonArray items) return false;\n\n\t\tvar results = new List();\n\t\tforeach (var item in items)\n\t\t{\n\t\t\tcontext.Push(item);\n\t\t\tvar localResult = JsonLogic.Apply(rule, context).IsTruthy();\n\t\t\tcontext.Pop();\n\n\t\t\tif (localResult) results.Add(item);\n\t\t}\n\n\t\treturn results.ToJsonArray();\n\t}\n}\n\ninternal class FilterRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override FilterRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The filter rule needs an array with 2 parameters.\");\n\n\t\treturn new FilterRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, FilterRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"filter\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.Input, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.Rule, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n" + }, + { + "title": "src/JsonLogic/Rules/IfRule.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/IfRule.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/IfRule.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `if` and `?:` operations.\n/// \n[Operator(\"if\")]\n[Operator(\"?:\")]\n[JsonConverter(typeof(IfRuleJsonConverter))]\npublic class IfRule : Rule, IRule\n{\n\t/// \n\t/// A condition, what to do when the condition is true, and what to do when the condition is false. \n\t/// \n\tprotected internal List Components { get; }\n\n\t/// \n\t/// Creates a new instance of when 'if' or '?:' operators are detected within json logic.\n\t/// \n\t/// A condition, what to do when the condition is true, and what to do when the condition is false.\n\tprotected internal IfRule(params Rule[] components)\n\t{\n\t\tComponents = new List(components);\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal IfRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tbool condition;\n\t\tswitch (Components.Count)\n\t\t{\n\t\t\tcase 0:\n\t\t\t\treturn null;\n\t\t\tcase 1:\n\t\t\t\treturn Components[0].Apply(data, contextData);\n\t\t\tcase 2:\n\t\t\t\tcondition = Components[0].Apply(data, contextData).IsTruthy();\n\t\t\t\tvar thenResult = Components[1];\n\n\t\t\t\treturn condition\n\t\t\t\t\t? thenResult.Apply(data, contextData)\n\t\t\t\t\t: null;\n\t\t\tdefault:\n\t\t\t\tvar currentCondition = Components[0];\n\t\t\t\tvar currentTrueResult = Components[1];\n\t\t\t\tvar elseIndex = 2;\n\n\t\t\t\twhile (currentCondition != null)\n\t\t\t\t{\n\t\t\t\t\tcondition = currentCondition.Apply(data, contextData).IsTruthy();\n\n\t\t\t\t\tif (condition)\n\t\t\t\t\t\treturn currentTrueResult.Apply(data, contextData);\n\n\t\t\t\t\tif (elseIndex == Components.Count) return null;\n\n\t\t\t\t\tcurrentCondition = Components[elseIndex++];\n\n\t\t\t\t\tif (elseIndex >= Components.Count)\n\t\t\t\t\t\treturn currentCondition.Apply(data, contextData);\n\n\t\t\t\t\tcurrentTrueResult = Components[elseIndex++];\n\t\t\t\t}\n\n\t\t\t\treturn Components[elseIndex].Apply(data, contextData);\n\t\t}\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray array)\n\t\t\tthrow new JsonLogicException(\"The 'if' rule requires an array\");\n\n\t\tbool condition;\n\t\tswitch (array.Count)\n\t\t{\n\t\t\tcase 0:\n\t\t\t\treturn null;\n\t\t\tcase 1:\n\t\t\t\treturn JsonLogic.Apply(array[0], context);\n\t\t\tcase 2:\n\t\t\t\tcondition = JsonLogic.Apply(array[0], context).IsTruthy();\n\t\t\t\treturn condition\n\t\t\t\t\t? JsonLogic.Apply(array[1], context)\n\t\t\t\t\t: null;\n\t\t\tdefault:\n\t\t\t\tvar currentCondition = array[0];\n\t\t\t\tvar currentTrueResult = array[1];\n\t\t\t\tvar elseIndex = 2;\n\n\t\t\t\twhile (currentCondition != null)\n\t\t\t\t{\n\t\t\t\t\tcondition = JsonLogic.Apply(currentCondition, context).IsTruthy();\n\n\t\t\t\t\tif (condition)\n\t\t\t\t\t\treturn JsonLogic.Apply(currentTrueResult, context);\n\n\t\t\t\t\tif (elseIndex == array.Count) return null;\n\n\t\t\t\t\tcurrentCondition = array[elseIndex++];", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n" + }, + { + "title": "src/JsonLogic/Rules/IfRule.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/IfRule.cs#L121-L150", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/IfRule.cs", + "startLine": 121, + "endLine": 150, + "content": "if (elseIndex >= array.Count)\n\t\t\t\t\t\treturn JsonLogic.Apply(currentCondition, context);\n\n\t\t\t\t\tcurrentTrueResult = array[elseIndex++];\n\t\t\t\t}\n\t\t\t\treturn JsonLogic.Apply(array[elseIndex], context);\n\t\t}\n\t}\n}\n\ninternal class IfRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override IfRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters == null) return new IfRule();\n\n\t\treturn new IfRule(parameters);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, IfRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"if\");\n\t\toptions.WriteList(writer, value.Components, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "if (elseIndex >= array.Count)\n\t\t\t\t\t\treturn JsonLogic.Apply(currentCondition, context);\n\n\t\t\t\t\tcurrentTrueResult = array[elseIndex++];\n\t\t\t\t}\n\t\t\t\treturn JsonLogic.Apply(array[elseIndex], context);\n\t\t}\n\t}\n}\n\ninternal class I" + }, + { + "title": "src/JsonLogic/Rules/InRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/InRule.cs#L1-L118", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/InRule.cs", + "startLine": 1, + "endLine": 118, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `in` operation.\n/// \n[Operator(\"in\")]\n[JsonConverter(typeof(InRuleJsonConverter))]\npublic class InRule : Rule, IRule\n{\n\t/// \n\t/// A value to search for.\n\t/// \n\tprotected internal Rule Test { get; }\n\t/// \n\t/// The string value to test against.\n\t/// \n\tprotected internal Rule Value { get; }\n\n\t/// \n\t/// Creates a new instance of when 'in' operator is detected within json logic.\n\t/// \n\t/// A value to search for.\n\t/// The string value to test against.\n\tprotected internal InRule(Rule test, Rule value)\n\t{\n\t\tTest = test;\n\t\tValue = value;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal InRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar test = Test.Apply(data, contextData);\n\t\tvar source = Value.Apply(data, contextData);\n\n\t\tif (source is JsonValue value && value.TryGetValue(out string? stringSource))\n\t\t{\n\t\t\tvar stringTest = test.Stringify();\n\n\t\t\tif (stringTest == null || stringSource == null)\n\t\t\t\tthrow new JsonLogicException($\"Cannot check string for {test.JsonType()}.\");\n\n\t\t\treturn !string.IsNullOrEmpty(stringTest) && stringSource.Contains(stringTest);\n\t\t}\n\n\t\tif (source is JsonArray arr)\n\t\t\treturn arr.Any(i => i.IsEquivalentTo(test));\n\n\t\treturn false;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray{Count:2} array)\n\t\t\tthrow new JsonLogicException(\"The 'in' rule requires an array with 2 parameters\");\n\n\t\tvar test = JsonLogic.Apply(array[0], context);\n\t\tvar source = JsonLogic.Apply(array[1], context);\n\n\t\tif (source is JsonValue value && value.TryGetValue(out string? stringSource))\n\t\t{\n\t\t\tvar stringTest = test.Stringify();\n\n\t\t\tif (stringTest == null || stringSource == null)\n\t\t\t\tthrow new JsonLogicException($\"Cannot check string for {test.JsonType()}.\");\n\n\t\t\treturn !string.IsNullOrEmpty(stringTest) && stringSource.Contains(stringTest);\n\t\t}\n\n\t\tif (source is JsonArray arr)\n\t\t\treturn arr.Any(i => i.IsEquivalentTo(test));\n\n\t\treturn false;\n\t}\n}\n\ninternal class InRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override InRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The in rule needs an array with 2 parameters.\");\n\n\t\treturn new InRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, InRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"in\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.Test, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.Value, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `in` operation.\n//" + }, + { + "title": "src/JsonLogic/Rules/LessThanEqualRule.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/LessThanEqualRule.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/LessThanEqualRule.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n#pragma warning disable CS1570\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `<=` operation.\n/// \n[Operator(\"<=\")]\n[JsonConverter(typeof(LessThanEqualRuleJsonConverter))]\npublic class LessThanEqualRule : Rule, IRule\n{\n\t/// \n\t/// The Lower bound.\n\t/// \n\tprotected internal Rule A { get; }\n\t/// \n\t/// The middle argument.\n\t/// \n\tprotected internal Rule B { get; }\n\t/// \n\t/// The Higher bound.\n\t/// \n\tprotected internal Rule? C { get; }\n\n\t/// \n\t/// Creates a new instance of when '<=' operator is detected within json logic.\n\t/// \n\t/// The value to test.\n\t/// The boundary to test against.\n\tprotected internal LessThanEqualRule(Rule a, Rule b)\n\t{\n\t\tA = a;\n\t\tB = b;\n\t}\n\t/// \n\t/// Creates a new instance of when '<=' operator is detected within json logic.\n\t/// \n\t/// The lower bound.\n\t/// The middle argument.\n\t/// The upper bound.\n\tprotected internal LessThanEqualRule(Rule a, Rule b, Rule c)\n\t{\n\t\tA = a;\n\t\tB = b;\n\t\tC = c;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal LessThanEqualRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar a = A.Apply(data, contextData);\n\t\tvar b = B.Apply(data, contextData);\n\n\t\tvar av = a as JsonValue;\n\t\tvar bv = b as JsonValue;\n\n\t\tstring? stringA, stringB;\n\n\t\tif (C == null)\n\t\t{\n\t\t\tif (av != null && av.TryGetValue(out stringA) &&\n\t\t\t bv != null && bv.TryGetValue(out stringB))\n\t\t\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) <= 0;\n\n\t\t\tvar numberA = a.Numberify();\n\t\t\tvar numberB = b.Numberify();\n\n\t\t\tif (numberA != null && numberB != null) return numberA <= numberB;\n\t\t\tif (numberA != null || numberB != null) return false;\n\n\t\t\tstringA = a.Stringify();\n\t\t\tstringB = b.Stringify();\n\n\t\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) <= 0;\n\t\t}\n\n\t\tvar c = C.Apply(data, contextData);\n\t\tvar cv = c as JsonValue;\n\n\t\tif (av != null && av.TryGetValue(out stringA) &&\n\t\t bv != null && bv.TryGetValue(out stringB) &&\n\t\t cv != null && cv.TryGetValue(out string? stringC))\n\t\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) <= 0 &&\n\t\t\t string.Compare(stringB, stringC, StringComparison.Ordinal) <= 0;\n\n\t\tvar low = a.Numberify();\n\t\tvar value = b.Numberify();\n\t\tvar high = c.Numberify();\n\t\tif (low != null && value != null && high != null) return low <= value && value <= high;\n\t\tif (low != null || value != null || high != null) return false;\n\n\t\tstringA = a.Stringify();\n\t\tstringB = b.Stringify();\n\t\tstringC = c.Stringify();\n\n\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) <= 0 &&\n\t\t string.Compare(stringB, stringC, StringComparison.Ordinal) <= 0;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray {Count: 2 or 3} array)\n\t\t\tthrow new JsonException(\"The '<=' rule needs an array with either 2 or 3 parameters\");", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n#pragma warning disable CS1570\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `<=` o" + }, + { + "title": "src/JsonLogic/Rules/LessThanEqualRule.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/LessThanEqualRule.cs#L121-L194", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/LessThanEqualRule.cs", + "startLine": 121, + "endLine": 194, + "content": "var a = JsonLogic.Apply(array[0], context) as JsonValue;\n\t\tvar b = JsonLogic.Apply(array[1], context) as JsonValue;\n\t\tvar c = array.Count == 3 ?JsonLogic.Apply( array[2], context) as JsonValue : null;\n\n\t\tstring? stringA, stringB;\n\n\t\tif (c == null)\n\t\t{\n\t\t\tif (a != null && a.TryGetValue(out stringA) &&\n\t\t\t b != null && b.TryGetValue(out stringB))\n\t\t\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) <= 0;\n\n\t\t\tvar numberA = a.Numberify();\n\t\t\tvar numberB = b.Numberify();\n\n\t\t\tif (numberA != null && numberB != null) return numberA <= numberB;\n\t\t\tif (numberA != null || numberB != null) return false;\n\n\t\t\tstringA = a.Stringify();\n\t\t\tstringB = b.Stringify();\n\n\t\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) <= 0;\n\t\t}\n\n\t\tif (a != null && a.TryGetValue(out stringA) &&\n\t\t b != null && b.TryGetValue(out stringB) &&\n\t\t c != null && c.TryGetValue(out string? stringC))\n\t\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) <= 0 &&\n\t\t\t string.Compare(stringB, stringC, StringComparison.Ordinal) <= 0;\n\n\t\tvar low = a.Numberify();\n\t\tvar value = b.Numberify();\n\t\tvar high = c.Numberify();\n\t\tif (low != null && value != null && high != null) return low <= value && value <= high;\n\t\tif (low != null || value != null || high != null) return false;\n\n\t\tstringA = a.Stringify();\n\t\tstringB = b.Stringify();\n\t\tstringC = c.Stringify();\n\n\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) <= 0 &&\n\t\t string.Compare(stringB, stringC, StringComparison.Ordinal) <= 0;\n\t}\n}\n\ninternal class LessThanEqualRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override LessThanEqualRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not ({ Length: 2 } or { Length: 3 }))\n\t\t\tthrow new JsonException(\"The <= rule needs an array with either 2 or 3 parameters.\");\n\n\t\tif (parameters.Length == 2) return new LessThanEqualRule(parameters[0], parameters[1]);\n\n\t\treturn new LessThanEqualRule(parameters[0], parameters[1], parameters[2]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, LessThanEqualRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"<=\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.A, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.B, JsonLogicSerializerContext.Default.Rule);\n\t\tif (value.C != null)\n\t\t\toptions.Write(writer, value.C, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "var a = JsonLogic.Apply(array[0], context) as JsonValue;\n\t\tvar b = JsonLogic.Apply(array[1], context) as JsonValue;\n\t\tvar c = array.Count == 3 ?JsonLogic.Apply( array[2], context) as JsonValue : null;\n\n\t\tstring? stringA," + }, + { + "title": "src/JsonLogic/Rules/LessThanRule.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/LessThanRule.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/LessThanRule.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n#pragma warning disable CS1570\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `<` operation.\n/// \n[Operator(\"<\")]\n[JsonConverter(typeof(LessThanRuleJsonConverter))]\npublic class LessThanRule : Rule, IRule\n{\n\t/// \n\t/// The Lower bound.\n\t/// \n\tprotected internal Rule A { get; }\n\t/// \n\t/// The middle argument.\n\t/// \n\tprotected internal Rule B { get; }\n\t/// \n\t/// The Higher bound.\n\t/// \n\tprotected internal Rule? C { get; }\n\n\t/// \n\t/// Creates a new instance of when '<' operator is detected within json logic.\n\t/// \n\t/// The argument to test.\n\t/// The boundary to test against.\n\tprotected internal LessThanRule(Rule a, Rule b)\n\t{\n\t\tA = a;\n\t\tB = b;\n\t}\n\n\t/// \n\t/// Creates a new instance of when '<' operator is detected within json logic.\n\t/// \n\t/// The lower bound.\n\t/// The middle argument.\n\t/// The upper bound.\n\tprotected internal LessThanRule(Rule a, Rule b, Rule c)\n\t{\n\t\tA = a;\n\t\tB = b;\n\t\tC = c;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal LessThanRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar a = A.Apply(data, contextData);\n\t\tvar b = B.Apply(data, contextData);\n\n\t\tvar av = a as JsonValue;\n\t\tvar bv = b as JsonValue;\n\n\t\tstring? stringA, stringB;\n\n\t\tif (C == null)\n\t\t{\n\t\t\tif (av != null && av.TryGetValue(out stringA) &&\n\t\t\t bv != null && bv.TryGetValue(out stringB))\n\t\t\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) < 0;\n\n\t\t\tvar numberA = a.Numberify();\n\t\t\tvar numberB = b.Numberify();\n\n\t\t\tif (numberA != null && numberB != null) return numberA < numberB;\n\t\t\tif (numberA != null || numberB != null) return false;\n\n\t\t\tstringA = a.Stringify();\n\t\t\tstringB = b.Stringify();\n\n\t\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) < 0;\n\t\t}\n\n\t\tvar c = C.Apply(data, contextData);\n\t\tvar cv = c as JsonValue;\n\n\t\tif (av != null && av.TryGetValue(out stringA) &&\n\t\t bv != null && bv.TryGetValue(out stringB) &&\n\t\t cv != null && cv.TryGetValue(out string? stringC))\n\t\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) < 0 &&\n\t\t\t string.Compare(stringB, stringC, StringComparison.Ordinal) < 0;\n\n\t\tvar low = a.Numberify();\n\t\tvar value = b.Numberify();\n\t\tvar high = c.Numberify();\n\t\tif (low != null && value != null && high != null) return low < value && value < high;\n\t\tif (low != null || value != null || high != null) return false;\n\n\t\tstringA = a.Stringify();\n\t\tstringB = b.Stringify();\n\t\tstringC = c.Stringify();\n\n\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) < 0 &&\n\t\t string.Compare(stringB, stringC, StringComparison.Ordinal) < 0;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 or 3 } array)", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n#pragma warning disable CS1570\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `<` op" + }, + { + "title": "src/JsonLogic/Rules/LessThanRule.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/LessThanRule.cs#L121-L195", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/LessThanRule.cs", + "startLine": 121, + "endLine": 195, + "content": "throw new JsonException(\"The '<' rule needs an array with either 2 or 3 parameters\");\n\n\t\tvar a = JsonLogic.Apply(array[0], context) as JsonValue;\n\t\tvar b = JsonLogic.Apply(array[1], context) as JsonValue;\n\t\tvar c = array.Count == 3 ? JsonLogic.Apply(array[2], context) as JsonValue : null;\n\n\t\tstring? stringA, stringB;\n\n\t\tif (c == null)\n\t\t{\n\t\t\tif (a != null && a.TryGetValue(out stringA) &&\n\t\t\t b != null && b.TryGetValue(out stringB))\n\t\t\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) < 0;\n\n\t\t\tvar numberA = a.Numberify();\n\t\t\tvar numberB = b.Numberify();\n\n\t\t\tif (numberA != null && numberB != null) return numberA < numberB;\n\t\t\tif (numberA != null || numberB != null) return false;\n\n\t\t\tstringA = a.Stringify();\n\t\t\tstringB = b.Stringify();\n\n\t\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) < 0;\n\t\t}\n\n\t\tif (a != null && a.TryGetValue(out stringA) &&\n\t\t b != null && b.TryGetValue(out stringB) &&\n\t\t c != null && c.TryGetValue(out string? stringC))\n\t\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) < 0 &&\n\t\t\t string.Compare(stringB, stringC, StringComparison.Ordinal) < 0;\n\n\t\tvar low = a.Numberify();\n\t\tvar value = b.Numberify();\n\t\tvar high = c.Numberify();\n\t\tif (low != null && value != null && high != null) return low < value && value < high;\n\t\tif (low != null || value != null || high != null) return false;\n\n\t\tstringA = a.Stringify();\n\t\tstringB = b.Stringify();\n\t\tstringC = c.Stringify();\n\n\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) < 0 &&\n\t\t string.Compare(stringB, stringC, StringComparison.Ordinal) < 0;\n\t}\n}\n\ninternal class LessThanRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override LessThanRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not ({ Length: 2 } or { Length: 3 }))\n\t\t\tthrow new JsonException(\"The < rule needs an array with either 2 or 3 parameters.\");\n\n\t\tif (parameters.Length == 2) return new LessThanRule(parameters[0], parameters[1]);\n\n\t\treturn new LessThanRule(parameters[0], parameters[1], parameters[2]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, LessThanRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"<\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.A, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.B, JsonLogicSerializerContext.Default.Rule);\n\t\tif (value.C != null)\n\t\t\toptions.Write(writer, value.C, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "throw new JsonException(\"The '<' rule needs an array with either 2 or 3 parameters\");\n\n\t\tvar a = JsonLogic.Apply(array[0], context) as JsonValue;\n\t\tvar b = JsonLogic.Apply(array[1], context) as JsonValue;\n\t\tvar c = array" + }, + { + "title": "src/JsonLogic/Rules/LiteralRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/LiteralRule.cs#L1-L56", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/LiteralRule.cs", + "startLine": 1, + "endLine": 56, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Provides a stand-in \"rule\" for literal values.\n/// \n/// This is not exactly part of the specification, but it helps things in this library.\n[Operator(\"\")]\n[JsonConverter(typeof(LiteralRuleJsonConverter))]\npublic class LiteralRule : Rule\n{\n\tinternal JsonNode? Value { get; }\n\n\tinternal static readonly LiteralRule Null = new(null);\n\n\tinternal LiteralRule(JsonNode? value)\n\t{\n\t\tValue = value?.DeepClone();\n\t}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\treturn Value;\n\t}\n}\n\ninternal class LiteralRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override LiteralRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\t// this is handled by Rule\n\t\tthrow new NotImplementedException();\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, LiteralRule value, JsonSerializerOptions options)\n\t{\n\t\tif (value.Value is null) \n\t\t\twriter.WriteNullValue();\n\t\telse\n\t\t\tJsonSerializer.Serialize(writer, value.Value, JsonLogicSerializerContext.Default.JsonNode!);\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Provides a stand-in \"rule\" for literal values.\n//" + }, + { + "title": "src/JsonLogic/Rules/LogRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/LogRule.cs#L1-L87", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/LogRule.cs", + "startLine": 1, + "endLine": 87, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `log` operation.\n/// \n[Operator(\"log\")]\n[JsonConverter(typeof(LogRuleJsonConverter))]\npublic class LogRule : Rule, IRule\n{\n\t/// \n\t/// Gets or sets the logger used for logic operations.\n\t/// \n\t/// If not explicitly set, the property returns a default console logger. Assigning a custom logger\n\t/// allows integration with different logging frameworks or custom logging behavior.\n\tpublic static ILogicLogger Logger\n\t{\n\t\tget => field ?? LogicLoggers.ConsoleLogger;\n\t\tset;\n\t}\n\n\tinternal Rule Log { get; }\n\n\tinternal LogRule(Rule log)\n\t{\n\t\tLog = log;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal LogRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar log = Log.Apply(data, contextData);\n\n\t\tLogger.WriteLine(log);\n\n\t\treturn log;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tvar log = JsonLogic.Apply(args, context);\n\n\t\tLogger.WriteLine(log);\n\n\t\treturn log;\n\t}\n}\n\ninternal class LogRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override LogRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = reader.TokenType == JsonTokenType.StartArray\n\t\t\t? options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule)\n\t\t\t: [options.Read(ref reader, JsonLogicSerializerContext.Default.Rule)!];\n\n\t\treturn new LogRule(parameters!.Length == 0\n\t\t\t? new LiteralRule(\"\")\n\t\t\t: parameters[0]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, LogRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"log\");\n\t\toptions.Write(writer, value.Log, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `log` operation.\n/// \n[Oper" + }, + { + "title": "src/JsonLogic/Rules/LooseEqualsRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/LooseEqualsRule.cs#L1-L92", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/LooseEqualsRule.cs", + "startLine": 1, + "endLine": 92, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `==` operation.\n/// \n[Operator(\"==\")]\n[JsonConverter(typeof(LooseEqualsRuleJsonConverter))]\npublic class LooseEqualsRule : Rule, IRule\n{\n\t/// \n\t/// First value to compare.\n\t/// \n\tprotected internal Rule A { get; }\n\t/// \n\t/// Second value to compare.\n\t/// \n\tprotected internal Rule B { get; }\n\n\t/// \n\t/// Creates a new instance of when '==' operator is detected within json logic.\n\t/// \n\t/// First value to compare.\n\t/// Second value to compare.\n\tprotected internal LooseEqualsRule(Rule a, Rule b)\n\t{\n\t\tA = a;\n\t\tB = b;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal LooseEqualsRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar a = A.Apply(data, contextData);\n\t\tvar b = B.Apply(data, contextData);\n\n\t\treturn a.LooseEquals(b);\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonLogicException(\"The '==' rule needs an array with 2 parameters\");\n\n\t\tvar a = JsonLogic.Apply(array[0], context);\n\t\tvar b = JsonLogic.Apply(array[1], context);\n\n\t\treturn a.LooseEquals(b);\n\t}\n}\n\ninternal class LooseEqualsRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override LooseEqualsRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The == rule needs an array with 2 parameters.\");\n\n\t\treturn new LooseEqualsRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, LooseEqualsRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"==\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.A, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.B, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `==` operation.\n/// \n[Opera" + }, + { + "title": "src/JsonLogic/Rules/LooseNotEqualsRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/LooseNotEqualsRule.cs#L1-L92", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/LooseNotEqualsRule.cs", + "startLine": 1, + "endLine": 92, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `!=` operation.\n/// \n[Operator(\"!=\")]\n[JsonConverter(typeof(LooseNotEqualsRuleJsonConverter))]\npublic class LooseNotEqualsRule : Rule, IRule\n{\n\t/// \n\t/// First value to compare.\n\t/// \n\tprotected internal Rule A { get; }\n\t/// \n\t/// Second value to compare.\n\t/// \n\tprotected internal Rule B { get; }\n\n\t/// \n\t/// Creates a new instance of when '!=' operator is detected within json logic.\n\t/// \n\t/// First value to compare.\n\t/// Second value to compare.\n\tprotected internal LooseNotEqualsRule(Rule a, Rule b)\n\t{\n\t\tA = a;\n\t\tB = b;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal LooseNotEqualsRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar a = A.Apply(data, contextData);\n\t\tvar b = B.Apply(data, contextData);\n\n\t\treturn !a.LooseEquals(b);\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonLogicException(\"The '!=' rule needs an array with 2 parameters\");\n\n\t\tvar a = JsonLogic.Apply(array[0], context);\n\t\tvar b = JsonLogic.Apply(array[1], context);\n\n\t\treturn !a.LooseEquals(b);\n\t}\n}\n\ninternal class LooseNotEqualsRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override LooseNotEqualsRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The != rule needs an array with 2 parameters.\");\n\n\t\treturn new LooseNotEqualsRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, LooseNotEqualsRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"!=\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.A, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.B, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `!=` operation.\n/// \n[Opera" + }, + { + "title": "src/JsonLogic/Rules/MapRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/MapRule.cs#L1-L108", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/MapRule.cs", + "startLine": 1, + "endLine": 108, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `map` operation.\n/// \n[Operator(\"map\")]\n[JsonConverter(typeof(MapRuleJsonConverter))]\npublic class MapRule : Rule, IRule\n{\n\t/// \n\t/// A sequence of values to map over.\n\t/// \n\tprotected internal Rule Input { get; }\n\t/// \n\t/// A rule to apply to each item in the sequence.\n\t/// \n\tprotected internal Rule Rule { get; }\n\n\t/// \n\t/// Creates a new instance of when 'map' operator is detected within json logic.\n\t/// \n\t/// A sequence of values to map over.\n\t/// A rule to apply to each item in the sequence.\n\tprotected internal MapRule(Rule input, Rule rule)\n\t{\n\t\tInput = input;\n\t\tRule = rule;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal MapRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar input = Input.Apply(data, contextData);\n\n\t\tif (input is not JsonArray arr)\n\t\t\treturn new JsonArray();\n\n\t\treturn arr.Select(i => Rule.Apply(data, i)).ToJsonArray();\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonLogicException(\"The 'map' rule requires an array with two arguments\");\n\n\t\tvar input = JsonLogic.Apply(array[0], context);\n\t\tvar rule = array[1];\n\n\t\tif (input is not JsonArray items) return new JsonArray();\n\n\t\tvar results = new List();\n\t\tforeach (var item in items)\n\t\t{\n\t\t\tcontext.Push(item);\n\t\t\tvar localResult = JsonLogic.Apply(rule, context);\n\t\t\tcontext.Pop();\n\n\t\t\tresults.Add(localResult);\n\t\t}\n\n\t\treturn results.ToJsonArray();\n\t}\n}\n\ninternal class MapRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override MapRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The map rule needs an array with 2 parameters.\");\n\n\t\treturn new MapRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, MapRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"map\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.Input, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.Rule, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n" + }, + { + "title": "src/JsonLogic/Rules/MaxRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/MaxRule.cs#L1-L113", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/MaxRule.cs", + "startLine": 1, + "endLine": 113, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\n// ReSharper disable PossibleMultipleEnumeration\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `max` operation.\n/// \n[Operator(\"max\")]\n[JsonConverter(typeof(MaxRuleJsonConverter))]\npublic class MaxRule : Rule, IRule\n{\n\t/// \n\t/// The sequence of numbers to query for max.\n\t/// \n\tprotected internal List Items { get; }\n\n\t/// \n\t/// Creates a new instance of when 'max' operator is detected within json logic.\n\t/// \n\t/// The first numeric value in a sequence of numbers.\n\t/// A sequence of numbers.\n\tprotected internal MaxRule(Rule a, params Rule[] more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance of when 'max' operator is detected within json logic.\n\t/// \n\t/// The first numeric value in a sequence of numbers.\n\t/// A sequence of numbers.\n\tprotected internal MaxRule(Rule a, ReadOnlySpan more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal MaxRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar items = Items.Select(i => i.Apply(data, contextData))\n\t\t\t.Select(e => new { Type = e.JsonType(), Value = e.Numberify() })\n\t\t\t.ToList();\n\t\tvar nulls = items.Where(i => i.Value == null);\n\t\tif (nulls.Any()) return null;\n\n\t\treturn items.Max(i => i.Value!.Value);\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray array)\n\t\t\treturn JsonLogic.Apply(args, context).Numberify();\n\n\t\tif (array.Count == 0) return null;\n\n\t\tvar result = array[0].Numberify();\n\t\tif (result is null) return null;\n\n\t\tforeach (var item in array.Skip(1))\n\t\t{\n\t\t\tvar value = JsonLogic.Apply(item, context);\n\t\t\tvar number = value.Numberify();\n\t\t\tif (number is null) return null;\n\n\t\t\tresult = Math.Max(result.Value, number.Value);\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\ninternal class MaxRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override MaxRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters == null || parameters.Length == 0)\n\t\t\tthrow new JsonException(\"The max rule needs an array of parameters.\");\n\n\t\treturn new MaxRule(parameters[0], parameters.Skip(1).ToArray());\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, MaxRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"max\");\n\t\toptions.WriteList(writer, value.Items, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\n// ReSharper disable PossibleMultipleEnumer" + }, + { + "title": "src/JsonLogic/Rules/MergeRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/MergeRule.cs#L1-L90", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/MergeRule.cs", + "startLine": 1, + "endLine": 90, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `merge` operation.\n/// \n[Operator(\"merge\")]\n[JsonConverter(typeof(MergeRuleJsonConverter))]\npublic class MergeRule : Rule, IRule\n{\n\t/// \n\t/// A sequence of arrays to merge into a single array.\n\t/// \n\tprotected internal List Items { get; }\n\n\t/// \n\t/// Creates a new instance of when 'merge' operator is detected within json logic.\n\t/// \n\t/// A sequence of arrays to merge into a single array.\n\tprotected internal MergeRule(params Rule[] items)\n\t{\n\t\tItems = [.. items];\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal MergeRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar items = Items.Select(i => i.Apply(data, contextData)).SelectMany(e => e.Flatten());\n\n\t\treturn items.ToJsonArray();\n\t}\n\n\t/// \n\t/// \n\t/// \n\t/// \n\t/// \n\t/// \n\t/// \n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray array) return JsonLogic.Apply(new JsonArray(args?.DeepClone()), context);\n\n\t\treturn array.Select(x => JsonLogic.Apply(x, context))\n\t\t\t.SelectMany(x => x.Flatten())\n\t\t\t.ToJsonArray();\n\t}\n}\n\ninternal class MergeRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override MergeRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = reader.TokenType == JsonTokenType.StartArray\n\t\t\t? options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule)\n\t\t\t: new[] { options.Read(ref reader, JsonLogicSerializerContext.Default.Rule)! };\n\n\t\tif (parameters == null) return new MergeRule();\n\n\t\treturn new MergeRule(parameters);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, MergeRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"merge\");\n\t\toptions.WriteList(writer, value.Items, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n" + }, + { + "title": "src/JsonLogic/Rules/MinRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/MinRule.cs#L1-L111", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/MinRule.cs", + "startLine": 1, + "endLine": 111, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\n// ReSharper disable PossibleMultipleEnumeration\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `min` operation.\n/// \n[Operator(\"min\")]\n[JsonConverter(typeof(MinRuleJsonConverter))]\npublic class MinRule : Rule, IRule\n{\n\t/// \n\t/// The sequence of numbers to query for min.\n\t/// \n\tprotected internal List Items { get; }\n\n\t/// \n\t/// Creates a new instance of when 'min' operator is detected within json logic.\n\t/// \n\t/// The first numeric value in a sequence of numbers.\n\t/// A sequence of numbers.\n\tprotected internal MinRule(Rule a, params Rule[] more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance of when 'min' operator is detected within json logic.\n\t/// \n\t/// The first numeric value in a sequence of numbers.\n\t/// A sequence of numbers.\n\tprotected internal MinRule(Rule a, ReadOnlySpan more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal MinRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar items = Items.Select(i => i.Apply(data, contextData)).Select(e => new { Type = e.JsonType(), Value = e.Numberify() }).ToList();\n\t\tvar nulls = items.Where(i => i.Value == null);\n\t\tif (nulls.Any()) return null;\n\n\t\treturn items.Min(i => i.Value!.Value);\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray array)\n\t\t\treturn JsonLogic.Apply(args, context).Numberify();\n\n\t\tif (array.Count == 0) return null;\n\n\t\tvar result = array[0].Numberify();\n\t\tif (result is null) return null;\n\n\t\tforeach (var item in array.Skip(1))\n\t\t{\n\t\t\tvar value = JsonLogic.Apply(item, context);\n\t\t\tvar number = value.Numberify();\n\t\t\tif (number is null) return null;\n\n\t\t\tresult = Math.Min(result.Value, number.Value);\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\ninternal class MinRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override MinRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters == null || parameters.Length == 0)\n\t\t\tthrow new JsonException(\"The min rule needs an array of parameters.\");\n\n\t\treturn new MinRule(parameters[0], parameters.Skip(1).ToArray());\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, MinRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"min\");\n\t\toptions.WriteList(writer, value.Items, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\n// ReSharper disable PossibleMultipleEnumer" + }, + { + "title": "src/JsonLogic/Rules/MissingRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/MissingRule.cs#L1-L118", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/MissingRule.cs", + "startLine": 1, + "endLine": 118, + "content": "using System;\nusing System.Linq;\nusing System.Runtime.InteropServices.ComTypes;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `missing` operation.\n/// \n[Operator(\"missing\")]\n[JsonConverter(typeof(MissingRuleJsonConverter))]\npublic class MissingRule : Rule, IRule\n{\n\t/// \n\t/// A sequence of keys to search for.\n\t/// \n\tprotected internal Rule[] Components { get; }\n\n\t/// \n\t/// Creates a new instance of when 'missing' operator is detected within json logic.\n\t/// \n\t/// A sequence of keys to search for.\n\tprotected internal MissingRule(params Rule[] components)\n\t{\n\t\tComponents = components;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal MissingRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar expected = Components.SelectMany(c => c.Apply(data, contextData).Flatten())\n\t\t\t.OfType()\n\t\t\t.Where(v => v.TryGetValue(out string? _));\n\n\t\tif (data is not JsonObject)\n\t\t\treturn expected.ToJsonArray();\n\n\t\tvar paths = expected.Select(e => e.GetValue()!)\n\t\t\t.Select(p => new\n\t\t\t{\n\t\t\t\tPath = p, Pointer = p == string.Empty\n\t\t\t\t\t? JsonPointer.Empty\n\t\t\t\t\t: JsonPointer.Parse($\"/{p.Replace('.', '/')}\")\n\t\t\t})\n\t\t\t.Select(p =>\n\t\t\t{\n\t\t\t\tp.Pointer.TryEvaluate(data, out var value);\n\t\t\t\treturn new { Path = p.Path, Value = value };\n\t\t\t});\n\n\t\treturn paths.Where(p => p.Value == null || p.Value.IsEquivalentTo(string.Empty))\n\t\t\t.Select(k => (JsonNode?)k.Path)\n\t\t\t.ToJsonArray();\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray array)\n\t\t\tarray = new JsonArray(args?.DeepClone());\n\n\t\tvar expected = array.SelectMany(c => JsonLogic.Apply(c, context).Flatten())\n\t\t\t.OfType()\n\t\t\t.Where(v => v.TryGetValue(out string? _));\n\n\t\tif (context.CurrentValue is not JsonObject)\n\t\t\treturn expected.ToJsonArray();\n\n\t\tvar paths = expected.Select(e => e.GetValue()!)\n\t\t\t.Select(p =>\n\t\t\t{\n\t\t\t\tcontext.TryFind(p, out var result);\n\t\t\t\treturn new { Path = p, Value = result };\n\t\t\t});\n\n\t\treturn paths.Where(p => p.Value == null || p.Value.IsEquivalentTo(string.Empty))\n\t\t\t.Select(k => (JsonNode?)k.Path)\n\t\t\t.ToJsonArray();\n\t}\n}\n\ninternal class MissingRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override MissingRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = reader.TokenType == JsonTokenType.StartArray\n\t\t\t? options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule)\n\t\t\t: new[] { options.Read(ref reader, JsonLogicSerializerContext.Default.Rule)! };\n\n\t\tif (parameters == null) return new MissingRule();\n\n\t\treturn new MissingRule(parameters);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, MissingRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"missing\");\n\t\toptions.WriteList(writer, value.Components, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Runtime.InteropServices.ComTypes;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace " + }, + { + "title": "src/JsonLogic/Rules/MissingSomeRule.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/MissingSomeRule.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/MissingSomeRule.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Linq;\nusing System.Runtime.InteropServices.ComTypes;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `missing_some` operation.\n/// \n[Operator(\"missing_some\")]\n[JsonConverter(typeof(MissingSomeRuleJsonConverter))]\npublic class MissingSomeRule : Rule, IRule\n{\n\t/// \n\t/// The minimum number of keys that are required.\n\t/// \n\tprotected internal Rule RequiredCount { get; }\n\t\n\t/// \n\t/// The sequence of keys to search for.\n\t/// \n\tprotected internal Rule Components { get; }\n\n\t/// \n\t/// Creates a new instance of when 'missing_some' operator is detected within json logic.\n\t/// \n\t/// The minimum number of data keys that are required.\n\t/// A sequence of keys to search for.\n\tprotected internal MissingSomeRule(Rule requiredCount, Rule components)\n\t{\n\t\tRequiredCount = requiredCount;\n\t\tComponents = components;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal MissingSomeRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar requiredCount = RequiredCount.Apply(data, contextData).Numberify() ?? 1;\n\t\tvar components = Components.Apply(data, contextData);\n\t\tif (components is not JsonArray arr)\n\t\t\tarr = new JsonArray(components?.DeepClone());\n\n\t\tvar expected = arr.SelectMany(e => e.Flatten()).ToList();\n\n\t\tif (data is not JsonObject)\n\t\t\treturn expected.ToJsonArray();\n\n\t\tvar paths = expected\n\t\t\t.Select(p =>\n\t\t\t{\n\t\t\t\tif (p is JsonValue v && v.TryGetValue(out string? s))\n\t\t\t\t\treturn new\n\t\t\t\t\t{\n\t\t\t\t\t\tPath = p, Pointer = (JsonPointer?) (s == string.Empty\n\t\t\t\t\t\t\t? JsonPointer.Empty\n\t\t\t\t\t\t\t: JsonPointer.Parse($\"/{s.Replace('.', '/')}\"))\n\t\t\t\t\t};\n\t\t\t\treturn new { Path = p, Pointer = (JsonPointer?)null }!;\n\t\t\t})\n\t\t\t.Select(p =>\n\t\t\t{\n\t\t\t\tif (p.Pointer.HasValue && p.Pointer.Value.TryEvaluate(data, out var value))\n\t\t\t\t\treturn new { Path = p.Path, Value = value };\n\t\t\t\treturn new { Path = p.Path, Value = (JsonNode?)null };\n\t\t\t})\n\t\t\t.ToList();\n\n\t\tvar missing = paths.Where(p => p.Value == null)\n\t\t\t.Select(k => (JsonNode?)k.Path);\n\t\tvar found = paths.Count(p => p.Value != null);\n\n\t\tif (found < requiredCount)\n\t\t\treturn missing.ToJsonArray();\n\n\t\treturn new JsonArray();\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonLogicException(\"The 'missing_some' rule needs an array with 2 parameters\");\n\n\t\tvar requiredCount = JsonLogic.Apply(array[0], context).Numberify() ?? 1;\n\t\tvar components = JsonLogic.Apply(array[1], context);\n\t\tif (components is not JsonArray arr)\n\t\t\tarr = new JsonArray(components?.DeepClone());\n\n\t\tvar expected = arr.SelectMany(e => e.Flatten()).ToList();\n\n\t\tif (context.CurrentValue is not JsonObject)\n\t\t\treturn expected.ToJsonArray();\n\n\t\tvar paths = expected\n\t\t\t.Select(p =>\n\t\t\t{\n\t\t\t\tstring? path = null;\n\t\t\t\t(p as JsonValue)?.TryGetValue(out path);\n\t\t\t\tcontext.TryFind(path, out var value);\n\t\t\t\treturn new { Path = path ?? p, Value = value };\n\t\t\t})\n\t\t\t.ToArray();\n\n\t\tvar missing = paths.Where(p => p.Value == null)", + "snippet": "using System;\nusing System.Linq;\nusing System.Runtime.InteropServices.ComTypes;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace " + }, + { + "title": "src/JsonLogic/Rules/MissingSomeRule.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/MissingSomeRule.cs#L121-L154", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/MissingSomeRule.cs", + "startLine": 121, + "endLine": 154, + "content": ".Select(k => k.Path);\n\t\tvar found = paths.Count(p => p.Value != null);\n\n\t\tif (found < requiredCount)\n\t\t\treturn missing.ToJsonArray();\n\n\t\treturn new JsonArray();\n\t}\n}\n\ninternal class MissingSomeRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override MissingSomeRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The missing_some rule needs an array with 2 parameters.\");\n\n\t\treturn new MissingSomeRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, MissingSomeRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"missing_some\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.RequiredCount, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.Components, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": ".Select(k => k.Path);\n\t\tvar found = paths.Count(p => p.Value != null);\n\n\t\tif (found < requiredCount)\n\t\t\treturn missing.ToJsonArray();\n\n\t\treturn new JsonArray();\n\t}\n}\n\ninternal class MissingSomeRuleJsonConverter : WeaklyT" + }, + { + "title": "src/JsonLogic/Rules/ModRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/ModRule.cs#L1-L99", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/ModRule.cs", + "startLine": 1, + "endLine": 99, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `%` operation.\n/// \n[Operator(\"%\")]\n[JsonConverter(typeof(ModRuleJsonConverter))]\npublic class ModRule : Rule, IRule\n{\n\t/// \n\t/// The value to divide.\n\t/// \n\tprotected internal Rule A { get; }\n\t/// \n\t/// The divisor, ie; the value to divide by.\n\t/// \n\tprotected internal Rule B { get; }\n\n\t/// \n\t/// Creates a new instance of when '%' operator is detected within json logic.\n\t/// \n\t/// The value to divide.\n\t/// The divisor, ie; the value to divide by.\n\tprotected internal ModRule(Rule a, Rule b)\n\t{\n\t\tA = a;\n\t\tB = b;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal ModRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar a = A.Apply(data, contextData);\n\t\tvar b = B.Apply(data, contextData);\n\n\t\tvar numberA = a.Numberify();\n\t\tvar numberB = b.Numberify();\n\n\t\tif (numberA == null || numberB == null) return null;\n\n\t\tif (numberB == 0) return null;\n\n\t\treturn numberA.Value % numberB.Value;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonLogicException(\"The '%' rule needs an array with 2 parameters\");\n\n\t\tvar a = JsonLogic.Apply(array[0], context).Numberify();\n\t\tvar b = JsonLogic.Apply(array[1], context).Numberify();\n\n\t\treturn b == 0 ? null : a % b;\n\t}\n}\n\ninternal class ModRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override ModRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The % rule needs an array with 2 parameters.\");\n\n\t\treturn new ModRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, ModRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"%\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.A, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.B, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `%` operation.\n/// \n[Operat" + }, + { + "title": "src/JsonLogic/Rules/MoreThanEqualRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/MoreThanEqualRule.cs#L1-L118", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/MoreThanEqualRule.cs", + "startLine": 1, + "endLine": 118, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `>=` operation.\n/// \n[Operator(\">=\")]\n[JsonConverter(typeof(MoreThanEqualRuleJsonConverter))]\npublic class MoreThanEqualRule : Rule, IRule\n{\n\t/// \n\t/// The value to test.\n\t/// \n\tprotected internal Rule A { get; }\n\t/// \n\t/// The boundary to test against.\n\t/// \n\tprotected internal Rule B { get; }\n\n\t/// \n\t/// Creates a new instance of when '>=' operator is detected within json logic.\n\t/// \n\t/// The value to test.\n\t/// The boundary to test against.\n\tprotected internal MoreThanEqualRule(Rule a, Rule b)\n\t{\n\t\tA = a;\n\t\tB = b;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal MoreThanEqualRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar a = A.Apply(data, contextData);\n\t\tvar b = B.Apply(data, contextData);\n\n\t\tif (a is JsonValue av && av.TryGetValue(out string? s1) &&\n\t\t b is JsonValue bv && bv.TryGetValue(out string? s2))\n\t\t\treturn string.Compare(s1, s2, StringComparison.Ordinal) >= 0;\n\n\t\tvar numberA = a.Numberify();\n\t\tvar numberB = b.Numberify();\n\n\t\tif (numberA != null && numberB != null) return numberA >= numberB;\n\t\tif (numberA != null || numberB != null) return false;\n\n\t\tvar stringA = a.Stringify();\n\t\tvar stringB = b.Stringify();\n\n\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) >= 0;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonException(\"The '>=' rule needs an array with 2 parameters\");\n\n\t\tvar a = JsonLogic.Apply(array[0], context);\n\t\tvar b = JsonLogic.Apply(array[1], context);\n\n\t\tif (a is JsonValue av && av.TryGetValue(out string? s1) &&\n\t\t b is JsonValue bv && bv.TryGetValue(out string? s2))\n\t\t\treturn string.Compare(s1, s2, StringComparison.Ordinal) >= 0;\n\n\t\tvar numberA = a.Numberify();\n\t\tvar numberB = b.Numberify();\n\n\t\tif (numberA != null && numberB != null) return numberA >= numberB;\n\t\tif (numberA != null || numberB != null) return false;\n\n\t\tvar stringA = a.Stringify();\n\t\tvar stringB = b.Stringify();\n\n\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) >= 0;\n\t}\n}\n\ninternal class MoreThanEqualRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override MoreThanEqualRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The >= rule needs an array with 2 parameters.\");\n\n\t\treturn new MoreThanEqualRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, MoreThanEqualRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\">=\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.A, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.B, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `>=` operation.\n/// \n[Opera" + }, + { + "title": "src/JsonLogic/Rules/MoreThanRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/MoreThanRule.cs#L1-L118", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/MoreThanRule.cs", + "startLine": 1, + "endLine": 118, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `>` operation.\n/// \n[Operator(\">\")]\n[JsonConverter(typeof(MoreThanRuleJsonConverter))]\npublic class MoreThanRule : Rule, IRule\n{\n\t/// \n\t/// The value to test.\n\t/// \n\tprotected internal Rule A { get; }\n\t/// \n\t/// The boundary to test against.\n\t/// \n\tprotected internal Rule B { get; }\n\n\t/// \n\t/// Creates a new instance of when '>' operator is detected within json logic.\n\t/// \n\t/// The value to test.\n\t/// The boundary to test against.\n\tprotected internal MoreThanRule(Rule a, Rule b)\n\t{\n\t\tA = a;\n\t\tB = b;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal MoreThanRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar a = A.Apply(data, contextData);\n\t\tvar b = B.Apply(data, contextData);\n\n\t\tif (a is JsonValue av && av.TryGetValue(out string? s1) &&\n\t\t b is JsonValue bv && bv.TryGetValue(out string? s2))\n\t\t\treturn string.Compare(s1, s2, StringComparison.Ordinal) > 0;\n\n\t\tvar numberA = a.Numberify();\n\t\tvar numberB = b.Numberify();\n\n\t\tif (numberA != null && numberB != null) return numberA > numberB;\n\t\tif (numberA != null || numberB != null) return false;\n\n\t\tvar stringA = a.Stringify();\n\t\tvar stringB = b.Stringify();\n\n\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) > 0;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonException(\"The '>' rule needs an array with 2 parameters\");\n\n\t\tvar a = JsonLogic.Apply(array[0], context);\n\t\tvar b = JsonLogic.Apply(array[1], context);\n\n\t\tif (a is JsonValue av && av.TryGetValue(out string? s1) &&\n\t\t b is JsonValue bv && bv.TryGetValue(out string? s2))\n\t\t\treturn string.Compare(s1, s2, StringComparison.Ordinal) > 0;\n\n\t\tvar numberA = a.Numberify();\n\t\tvar numberB = b.Numberify();\n\n\t\tif (numberA != null && numberB != null) return numberA > numberB;\n\t\tif (numberA != null || numberB != null) return false;\n\n\t\tvar stringA = a.Stringify();\n\t\tvar stringB = b.Stringify();\n\n\t\treturn string.Compare(stringA, stringB, StringComparison.Ordinal) > 0;\n\t}\n}\n\ninternal class MoreThanRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override MoreThanRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The > rule needs an array with 2 parameters.\");\n\n\t\treturn new MoreThanRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, MoreThanRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\">\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.A, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.B, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `>` operation.\n/// \n[Operat" + }, + { + "title": "src/JsonLogic/Rules/MultiplyRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/MultiplyRule.cs#L1-L113", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/MultiplyRule.cs", + "startLine": 1, + "endLine": 113, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `*` operation.\n/// \n[Operator(\"*\")]\n[JsonConverter(typeof(MultiplyRuleJsonConverter))]\npublic class MultiplyRule : Rule, IRule\n{\n\t/// \n\t/// The sequence of numbers to multiple together.\n\t/// \n\tprotected internal List Items { get; }\n\n\t/// \n\t/// Creates a new instance of when '*' operator is detected within json logic.\n\t/// \n\t/// The first value in to which other values will be multiplied by.\n\t/// Sequence of values to multiply by.\n\tprotected internal MultiplyRule(Rule a, params Rule[] more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance of when '*' operator is detected within json logic.\n\t/// \n\t/// The first value in to which other values will be multiplied by.\n\t/// Sequence of values to multiply by.\n\tprotected internal MultiplyRule(Rule a, ReadOnlySpan more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal MultiplyRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tdecimal result = 1;\n\n\t\tforeach (var item in Items)\n\t\t{\n\t\t\tvar value = item.Apply(data, contextData);\n\n\t\t\tvar number = value.Numberify();\n\n\t\t\tif (number == null) return null;\n\n\t\t\tresult *= number.Value;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: > 0 } array)\n\t\t\tthrow new JsonLogicException(\"The '*' rule needs an array of parameters\");\n\n\t\tdecimal? result = 1;\n\t\tforeach (var item in array)\n\t\t{\n\t\t\tvar value = JsonLogic.Apply(item, context).Numberify();\n\t\t\tif (value is null) return null;\n\n\t\t\tresult *= value;\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\ninternal class MultiplyRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override MultiplyRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters == null || parameters.Length == 0)\n\t\t\tthrow new JsonException(\"The * rule needs an array of parameters.\");\n\n\t\treturn new MultiplyRule(parameters[0], parameters.Skip(1).ToArray());\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, MultiplyRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"*\");\n\t\toptions.WriteList(writer, value.Items, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n" + }, + { + "title": "src/JsonLogic/Rules/NoneRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/NoneRule.cs#L1-L106", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/NoneRule.cs", + "startLine": 1, + "endLine": 106, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `none` operation.\n/// \n[Operator(\"none\")]\n[JsonConverter(typeof(NoneRuleJsonConverter))]\npublic class NoneRule : Rule, IRule\n{\n\t/// \n\t/// The sequence of elements to apply the rule to.\n\t/// \n\tprotected internal Rule Input { get; }\n\t/// \n\t/// The rule to apply to items in the input sequence.\n\t/// \n\tprotected internal Rule Rule { get; }\n\n\t/// \n\t/// Creates a new instance of when 'none' operator is detected within json logic.\n\t/// \n\t/// A sequence of elements to apply the rule to.\n\t/// A rule to apply to items in the input sequence.\n\tprotected internal NoneRule(Rule input, Rule rule)\n\t{\n\t\tInput = input;\n\t\tRule = rule;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal NoneRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar input = Input.Apply(data, contextData);\n\n\t\tif (input is not JsonArray arr) return true;\n\n\t\treturn !arr.Select(value => Rule.Apply(contextData, value))\n\t\t\t.Any(result => result.IsTruthy());\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonLogicException(\"The 'none' rule requires an array with two arguments\");\n\n\t\tvar input = JsonLogic.Apply(array[0], context);\n\t\tvar rule = array[1];\n\n\t\tif (input is not JsonArray items) return true;\n\n\t\tforeach (var item in items)\n\t\t{\n\t\t\tcontext.Push(item);\n\t\t\tvar localResult = JsonLogic.Apply(rule, context).IsTruthy();\n\t\t\tcontext.Pop();\n\n\t\t\tif (localResult) return false;\n\t\t}\n\n\t\treturn true;\n\t}\n}\n\ninternal class NoneRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override NoneRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The none rule needs an array with 2 parameters.\");\n\n\t\treturn new NoneRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, NoneRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"none\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.Input, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.Rule, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `none` operation.\n" + }, + { + "title": "src/JsonLogic/Rules/NotRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/NotRule.cs#L1-L81", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/NotRule.cs", + "startLine": 1, + "endLine": 81, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `!` operation.\n/// \n[Operator(\"!\")]\n[JsonConverter(typeof(NotRuleJsonConverter))]\npublic class NotRule : Rule, IRule\n{\n\t/// \n\t/// The value to test.\n\t/// \n\tprotected internal Rule Value { get; }\n\n\t/// \n\t/// Creates a new instance of when '!' operator is detected within json logic.\n\t/// \n\t/// The value to test.\n\tprotected internal NotRule(Rule value)\n\t{\n\t\tValue = value;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal NotRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar value = Value.Apply(data, contextData);\n\n\t\treturn !value.IsTruthy();\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray {Count: 1} array)\n\t\t\treturn !JsonLogic.Apply(args, context).IsTruthy();\n\n\t\treturn !JsonLogic.Apply(array[0], context).IsTruthy();\n\t}\n}\n\ninternal class NotRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override NotRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = reader.TokenType == JsonTokenType.StartArray\n\t\t\t? options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule)\n\t\t\t: new[] { options.Read(ref reader, JsonLogicSerializerContext.Default.Rule)! };\n\n\t\tif (parameters is not { Length: 1 })\n\t\t\tthrow new JsonException(\"The ! rule needs an array with a single parameter.\");\n\n\t\treturn new NotRule(parameters[0]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, NotRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"!\");\n\t\toptions.Write(writer, value.Value, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `!` operation.\n/// \n[Operat" + }, + { + "title": "src/JsonLogic/Rules/OrRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/OrRule.cs#L1-L108", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/OrRule.cs", + "startLine": 1, + "endLine": 108, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `or` operation.\n/// \n[Operator(\"or\")]\n[JsonConverter(typeof(OrRuleJsonConverter))]\npublic class OrRule : Rule, IRule\n{\n\t/// \n\t/// The sequence of items to Or against.\n\t/// \n\tprotected internal List Items { get; }\n\n\t/// \n\t/// Creates a new instance of when 'or' operator is detected within json logic.\n\t/// \n\t/// The first value.\n\t/// Sequence of values to Or against.\n\tprotected internal OrRule(Rule a, params Rule[] more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance of when 'or' operator is detected within json logic.\n\t/// \n\t/// The first value.\n\t/// Sequence of values to Or against.\n\tprotected internal OrRule(Rule a, ReadOnlySpan more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal OrRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar items = Items.Select(i => i.Apply(data, contextData));\n\t\tJsonNode? first = false;\n\t\tforeach (var x in items)\n\t\t{\n\t\t\tfirst = x;\n\t\t\tif (x.IsTruthy()) break;\n\t\t}\n\n\t\treturn first;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray array)\n\t\t\tthrow new JsonLogicException(\"The 'or' rule requires an array of arguments\");\n\n\t\tif (array.Count == 0) return false;\n\n\t\tJsonNode? result = false;\n\t\tforeach (var item in array)\n\t\t{\n\t\t\tresult = JsonLogic.Apply(item, context);\n\t\t\tif (result.IsTruthy()) break;\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\ninternal class OrRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override OrRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters == null || parameters.Length == 0)\n\t\t\tthrow new JsonException(\"The + rule needs an array of parameters.\");\n\n\t\treturn new OrRule(parameters[0], parameters.Skip(1).ToArray());\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, OrRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"or\");\n\t\toptions.WriteList(writer, value.Items, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n" + }, + { + "title": "src/JsonLogic/Rules/ReduceRule.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/ReduceRule.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/ReduceRule.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Runtime.InteropServices.ComTypes;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `reduce` operation.\n/// \n[Operator(\"reduce\")]\n[JsonConverter(typeof(ReduceRuleJsonConverter))]\npublic class ReduceRule : Rule, IRule\n{\n\t/// \n\t/// A sequence of values to reduce.\n\t/// \n\tprotected internal Rule Input { get; }\n\t/// \n\t/// The reduction to perform.\n\t/// \n\tprotected internal Rule Rule { get; }\n\t/// \n\t/// The initial value to start the reduction. ie; the seed.\n\t/// \n\tprotected internal Rule Initial { get; }\n\n\t/// \n\t/// Creates a new instance of when 'reduce' operator is detected within json logic.\n\t/// \n\t/// A sequence of values to reduce.\n\t/// The reduction to perform.\n\t/// The initial value to start the reduction. ie; the seed.\n\tprotected internal ReduceRule(Rule input, Rule rule, Rule initial)\n\t{\n\t\tInput = input;\n\t\tRule = rule;\n\t\tInitial = initial;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal ReduceRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar input = Input.Apply(data, contextData);\n\t\tvar accumulator = Initial.Apply(data, contextData);\n\n\t\tif (input is not JsonArray arr) return accumulator;\n\n\t\tforeach (var element in arr)\n\t\t{\n\t\t\tvar intermediary = new JsonObject\n\t\t\t{\n\t\t\t\t[\"current\"] = element?.DeepClone(),\n\t\t\t\t[\"accumulator\"] = accumulator?.DeepClone()\n\t\t\t};\n\n\t\t\taccumulator = Rule.Apply(data, intermediary);\n\n\t\t\tif (accumulator == null) break;\n\t\t}\n\n\t\treturn accumulator;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray{Count:3} array)\n\t\t\tthrow new JsonException(\"The 'reduce' rule needs an array with 3 parameters.\");\n\n\t\tvar input = JsonLogic.Apply(array[0], context);\n\t\tvar rule = array[1];\n\t\tvar accumulator = JsonLogic.Apply(array[2], context);\n\n\t\tif (input is not JsonArray arr) return accumulator;\n\n\t\tforeach (var element in arr)\n\t\t{\n\t\t\tvar intermediary = new JsonObject\n\t\t\t{\n\t\t\t\t[\"current\"] = element?.DeepClone(),\n\t\t\t\t[\"accumulator\"] = accumulator?.DeepClone()\n\t\t\t};\n\t\t\t\n\t\t\tcontext.Push(intermediary);\n\t\t\taccumulator = JsonLogic.Apply(rule, context);\n\t\t\tcontext.Pop();\n\n\t\t\tif (accumulator == null) break;\n\t\t}\n\n\t\treturn accumulator;\n\t}\n}\n\ninternal class ReduceRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override ReduceRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 3 })\n\t\t\tthrow new JsonException(\"The reduce rule needs an array with 3 parameters.\");\n\n\t\treturn new ReduceRule(parameters[0], parameters[1], parameters[2]);\n\t}", + "snippet": "using System;\nusing System.Runtime.InteropServices.ComTypes;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Ha" + }, + { + "title": "src/JsonLogic/Rules/ReduceRule.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/ReduceRule.cs#L121-L133", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/ReduceRule.cs", + "startLine": 121, + "endLine": 133, + "content": "public override void Write(Utf8JsonWriter writer, ReduceRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"reduce\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.Input, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.Rule, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.Initial, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "public override void Write(Utf8JsonWriter writer, ReduceRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"reduce\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer," + }, + { + "title": "src/JsonLogic/Rules/RuleCollection.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/RuleCollection.cs#L1-L52", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/RuleCollection.cs", + "startLine": 1, + "endLine": 52, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Provides a stand-in \"rule\" for collections of rules.\n/// \n/// This is not exactly part of the specification, but it helps things in this library.\n[JsonConverter(typeof(RuleCollectionJsonConverter))]\npublic class RuleCollection : Rule\n{\n\tinternal IEnumerable Rules { get; }\n\n\tinternal RuleCollection(params Rule[] rules)\n\t{\n\t\tRules = rules;\n\t}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\treturn Rules.Select(x => x.Apply(data, contextData)).ToJsonArray();\n\t}\n}\n\ninternal class RuleCollectionJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override RuleCollection? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\t// not used\n\t\tthrow new NotImplementedException();\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, RuleCollection value, JsonSerializerOptions options)\n\t{\n\t\toptions.WriteList(writer, value.Rules, JsonLogicSerializerContext.Default.Rule);\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n" + }, + { + "title": "src/JsonLogic/Rules/SomeRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/SomeRule.cs#L1-L106", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/SomeRule.cs", + "startLine": 1, + "endLine": 106, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `some` operation.\n/// \n[Operator(\"some\")]\n[JsonConverter(typeof(SomeRuleJsonConverter))]\npublic class SomeRule : Rule, IRule\n{\n\t/// \n\t/// The sequence of elements to apply the rule to.\n\t/// \n\tprotected internal Rule Input { get; }\n\t/// \n\t/// The rule to apply to items in the input sequence.\n\t/// \n\tprotected internal Rule Rule { get; }\n\n\t/// \n\t/// Creates a new instance of when 'some' operator is detected within json logic.\n\t/// \n\t/// A sequence of elements to apply the rule to.\n\t/// A rule to apply to items in the input sequence.\n\tprotected internal SomeRule(Rule input, Rule rule)\n\t{\n\t\tInput = input;\n\t\tRule = rule;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal SomeRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar input = Input.Apply(data, contextData);\n\n\t\tif (input is not JsonArray arr) return false;\n\n\t\treturn arr.Select(value => Rule.Apply(contextData, value))\n\t\t\t.Any(result => result.IsTruthy());\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonLogicException(\"The 'some' rule requires an array with two arguments\");\n\n\t\tvar input = JsonLogic.Apply(array[0], context);\n\t\tvar rule = array[1];\n\n\t\tif (input is not JsonArray items) return false;\n\n\t\tforeach (var item in items)\n\t\t{\n\t\t\tcontext.Push(item);\n\t\t\tvar localResult = JsonLogic.Apply(rule, context).IsTruthy();\n\t\t\tcontext.Pop();\n\n\t\t\tif (localResult) return true;\n\t\t}\n\n\t\treturn false;\n\t}\n}\n\ninternal class SomeRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override SomeRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The some rule needs an array with 2 parameters.\");\n\n\t\treturn new SomeRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, SomeRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"some\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.Input, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.Rule, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `some` operation.\n" + }, + { + "title": "src/JsonLogic/Rules/StrictEqualsRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/StrictEqualsRule.cs#L1-L89", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/StrictEqualsRule.cs", + "startLine": 1, + "endLine": 89, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `===` operation.\n/// \n[Operator(\"===\")]\n[JsonConverter(typeof(StrictEqualsRuleJsonConverter))]\npublic class StrictEqualsRule : Rule, IRule\n{\n\t/// \n\t/// First value to compare.\n\t/// \n\tprotected internal Rule A { get; }\n\t/// \n\t/// Second value to compare.\n\t/// \n\tprotected internal Rule B { get; }\n\n\t/// \n\t/// Creates a new instance of when '===' operator is detected within json logic.\n\t/// \n\t/// First value to compare.\n\t/// Second value to compare.\n\tprotected internal StrictEqualsRule(Rule a, Rule b)\n\t{\n\t\tA = a;\n\t\tB = b;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal StrictEqualsRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\treturn A.Apply(data, contextData).IsEquivalentTo(B.Apply(data, contextData));\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonLogicException(\"The '===' rule needs an array with 2 parameters\");\n\n\t\tvar a = JsonLogic.Apply(array[0], context);\n\t\tvar b = JsonLogic.Apply(array[1], context);\n\n\t\treturn a.IsEquivalentTo(b);\n\t}\n}\n\ninternal class StrictEqualsRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override StrictEqualsRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The === rule needs an array with 2 parameters.\");\n\n\t\treturn new StrictEqualsRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, StrictEqualsRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"===\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.A, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.B, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `===` operation.\n/// \n[Oper" + }, + { + "title": "src/JsonLogic/Rules/StrictNotEqualsRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/StrictNotEqualsRule.cs#L1-L89", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/StrictNotEqualsRule.cs", + "startLine": 1, + "endLine": 89, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `!==` operation.\n/// \n[Operator(\"!==\")]\n[JsonConverter(typeof(StrictNotEqualsRuleJsonConverter))]\npublic class StrictNotEqualsRule : Rule, IRule\n{\n\t/// \n\t/// First value to compare.\n\t/// \n\tprotected internal Rule A { get; }\n\t/// \n\t/// Second value to compare.\n\t/// \n\tprotected internal Rule B { get; }\n\n\t/// \n\t/// Creates a new instance of when '!===' operator is detected within json logic.\n\t/// \n\t/// First value to compare.\n\t/// Second value to compare.\n\tprotected internal StrictNotEqualsRule(Rule a, Rule b)\n\t{\n\t\tA = a;\n\t\tB = b;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal StrictNotEqualsRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\treturn !A.Apply(data, contextData).IsEquivalentTo(B.Apply(data, contextData));\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray { Count: 2 } array)\n\t\t\tthrow new JsonLogicException(\"The '!==' rule needs an array with 2 parameters\");\n\n\t\tvar a = JsonLogic.Apply(array[0], context);\n\t\tvar b = JsonLogic.Apply(array[1], context);\n\n\t\treturn !a.IsEquivalentTo(b);\n\t}\n}\n\ninternal class StrictNotEqualsRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override StrictNotEqualsRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not { Length: 2 })\n\t\t\tthrow new JsonException(\"The !== rule needs an array with 2 parameters.\");\n\n\t\treturn new StrictNotEqualsRule(parameters[0], parameters[1]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, StrictNotEqualsRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"!==\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.A, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.B, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `!==` operation.\n/// \n[Oper" + }, + { + "title": "src/JsonLogic/Rules/SubstrRule.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/SubstrRule.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/SubstrRule.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Runtime.InteropServices.ComTypes;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `substr` operation.\n/// \n[Operator(\"substr\")]\n[JsonConverter(typeof(SubstrRuleJsonConverter))]\npublic class SubstrRule : Rule, IRule\n{\n\t/// \n\t/// The input string.\n\t/// \n\tprotected internal Rule Input { get; }\n\t/// \n\t/// The positive start position within the input string.\n\t/// \n\tprotected internal Rule Start { get; }\n\t/// \n\t/// How many characters to return.\n\t/// \n\tprotected internal Rule? Count { get; }\n\n\t/// \n\t/// Creates a new instance of when 'substr' operator is detected within json logic.\n\t/// \n\t/// The input string.\n\t/// The positive start position within the input string.\n\tprotected internal SubstrRule(Rule input, Rule start)\n\t{\n\t\tInput = input;\n\t\tStart = start;\n\t}\n\n\t/// \n\t/// Creates a new instance of when 'substr' operator is detected within json logic.\n\t/// \n\t/// The input string.\n\t/// The positive start position within the input string.\n\t/// How many characters to return.\n\tprotected internal SubstrRule(Rule input, Rule start, Rule count)\n\t{\n\t\tInput = input;\n\t\tStart = start;\n\t\tCount = count;\n\t}\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal SubstrRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tvar input = Input is LiteralRule { Value: null }\n\t\t\t? \"null\"\n\t\t\t: Input.Apply(data, contextData).Stringify() ?? string.Empty;\n\t\tvar start = Start.Apply(data, contextData).Numberify() ?? 0;\n\n\t\tvar numberStart = (int)start;\n\n\t\tif (numberStart < -input.Length) return input;\n\t\tif (numberStart < 0)\n\t\t\tnumberStart = Math.Max(input.Length + numberStart, 0);\n\t\tif (numberStart >= input.Length) return string.Empty;\n\n\t\tif (Count == null) return input[numberStart..];\n\n\t\tvar count = Count.Apply(data, contextData).Numberify() ?? 0;\n\n\t\tvar integerCount = (int)count;\n\t\tvar availableLength = input.Length - numberStart;\n\t\tif (integerCount < 0)\n\t\t\tintegerCount = Math.Max(availableLength + integerCount, 0);\n\t\tintegerCount = Math.Min(availableLength, integerCount);\n\n\t\treturn input.Substring(numberStart, integerCount);\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray{Count: 2 or 3} array)\n\t\t\tthrow new JsonException(\"The 'substr' rule needs an array with either 2 or 3 parameters\");\n\n\t\tvar input = array[0] is null\n\t\t\t? \"null\"\n\t\t\t: JsonLogic.Apply(array[0], context).Stringify() ?? string.Empty;\n\t\tvar start = JsonLogic.Apply(array[1], context).Numberify() ?? 0;\n\n\t\tvar numberStart = (int)start;\n\n\t\tif (numberStart < -input.Length) return input;\n\t\tif (numberStart < 0)\n\t\t\tnumberStart = Math.Max(input.Length + numberStart, 0);\n\t\tif (numberStart >= input.Length) return string.Empty;\n\n\t\tif (array.Count == 2) return input[numberStart..];\n\n\t\tvar count = JsonLogic.Apply(array[2], context).Numberify() ?? 0;\n\n\t\tvar integerCount = (int)count;\n\t\tvar availableLength = input.Length - numberStart;\n\t\tif (integerCount < 0)\n\t\t\tintegerCount = Math.Max(availableLength + integerCount, 0);\n\t\tintegerCount = Math.Min(availableLength, integerCount);", + "snippet": "using System;\nusing System.Runtime.InteropServices.ComTypes;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Ha" + }, + { + "title": "src/JsonLogic/Rules/SubstrRule.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/SubstrRule.cs#L121-L152", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/SubstrRule.cs", + "startLine": 121, + "endLine": 152, + "content": "return input.Substring(numberStart, integerCount);\n\t}\n}\n\ninternal class SubstrRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override SubstrRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters is not ({ Length: 2 } or { Length: 3 }))\n\t\t\tthrow new JsonException(\"The substr rule needs an array with either 2 or 3 parameters.\");\n\n\t\tif (parameters.Length == 2) return new SubstrRule(parameters[0], parameters[1]);\n\n\t\treturn new SubstrRule(parameters[0], parameters[1], parameters[2]);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, SubstrRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"substr\");\n\t\twriter.WriteStartArray();\n\t\toptions.Write(writer, value.Input, JsonLogicSerializerContext.Default.Rule);\n\t\toptions.Write(writer, value.Start, JsonLogicSerializerContext.Default.Rule);\n\t\tif (value.Count != null)\n\t\t\toptions.Write(writer, value.Count, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndArray();\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "return input.Substring(numberStart, integerCount);\n\t}\n}\n\ninternal class SubstrRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override SubstrRule? Read(ref Utf8JsonReader reader, Type typeToConvert, Js" + }, + { + "title": "src/JsonLogic/Rules/SubtractRule.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/SubtractRule.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/SubtractRule.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `-` operation.\n/// \n[Operator(\"-\")]\n[JsonConverter(typeof(SubtractRuleJsonConverter))]\npublic class SubtractRule : Rule, IRule\n{\n\t/// \n\t/// The sequence of values to subtract.\n\t/// \n\tprotected internal List Items { get; }\n\n\t/// \n\t/// Creates a new instance of when '-' operator is detected within json logic.\n\t/// \n\t/// The first value, from which other values will be subtracted.\n\t/// Sequence of values to subtract from the first value.\n\tprotected internal SubtractRule(Rule a, params Rule[] more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance of when '-' operator is detected within json logic.\n\t/// \n\t/// The first value, from which other values will be subtracted.\n\t/// Sequence of values to subtract from the first value.\n\tprotected internal SubtractRule(Rule a, ReadOnlySpan more)\n\t{\n\t\tItems = [a, .. more];\n\t}\n\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal SubtractRule(){}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tif (Items.Count == 0) return 0;\n\n\t\tvar value = Items[0].Apply(data, contextData);\n\t\tvar number = value.Numberify();\n\n\t\tif (number == null) return null;\n\n\t\tvar result = number.Value;\n\n\t\tif (Items.Count == 1) return -result;\n\n\t\tforeach (var item in Items.Skip(1))\n\t\t{\n\t\t\tvalue = item.Apply(data, contextData);\n\n\t\t\tnumber = value.Numberify();\n\n\t\t\tif (number == null) return null;\n\n\t\t\tresult -= number.Value;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tif (args is not JsonArray {Count: > 0} array)\n\t\t\tthrow new JsonLogicException(\"The '-' rule needs an array of parameters\");\n\n\t\tvar value = JsonLogic.Apply(array[0], context).Numberify();\n\t\tif (value is null) return null;\n\t\tif (array.Count == 1) return -value;\n\n\t\tvar result = value;\n\t\tforeach (var item in array.Skip(1))\n\t\t{\n\t\t\tvalue = JsonLogic.Apply(item, context).Numberify();\n\t\t\tif (value is null) return null;\n\n\t\t\tresult -= value;\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\ninternal class SubtractRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override SubtractRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule);\n\n\t\tif (parameters == null || parameters.Length == 0)\n\t\t\tthrow new JsonException(\"The - rule needs an array of parameters.\");\n\n\t\treturn new SubtractRule(parameters[0], parameters.Skip(1).ToArray());\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, SubtractRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Logic.Rules;\n\n/// \n" + }, + { + "title": "src/JsonLogic/Rules/SubtractRule.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/SubtractRule.cs#L121-L126", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/SubtractRule.cs", + "startLine": 121, + "endLine": 126, + "content": "writer.WritePropertyName(\"-\");\n\t\toptions.WriteList(writer, value.Items, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "writer.WritePropertyName(\"-\");\n\t\toptions.WriteList(writer, value.Items, JsonLogicSerializerContext.Default.Rule);\n\t\twriter.WriteEndObject();\n\t}\n}" + }, + { + "title": "src/JsonLogic/Rules/VariableRule.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonLogic/Rules/VariableRule.cs#L1-L118", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonLogic/Rules/VariableRule.cs", + "startLine": 1, + "endLine": 118, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `var` operation.\n/// \n[Operator(\"var\")]\n[JsonConverter(typeof(VariableRuleJsonConverter))]\npublic class VariableRule : Rule, IRule\n{\n\tinternal Rule? Path { get; }\n\tinternal Rule? DefaultValue { get; }\n\n\t/// \n\t/// Creates a new instance for model-less processing.\n\t/// \n\tprotected internal VariableRule()\n\t{\n\t}\n\tinternal VariableRule(Rule path)\n\t{\n\t\tPath = path;\n\t}\n\tinternal VariableRule(Rule path, Rule defaultValue)\n\t{\n\t\tPath = path;\n\t\tDefaultValue = defaultValue;\n\t}\n\n\t/// \n\t/// Applies the rule to the input data.\n\t/// \n\t/// The input data.\n\t/// \n\t/// Optional secondary data. Used by a few operators to pass a secondary\n\t/// data context to inner operators.\n\t/// \n\t/// The result of the rule.\n\tpublic override JsonNode? Apply(JsonNode? data, JsonNode? contextData = null)\n\t{\n\t\tif (Path == null) return data;\n\n\t\tvar path = Path.Apply(data, contextData);\n\t\tvar pathString = path.Stringify()!;\n\t\tif (pathString == string.Empty) return contextData ?? data;\n\n\t\tvar pointer = pathString == string.Empty ? JsonPointer.Empty : JsonPointer.Parse($\"/{pathString.Replace('.', '/')}\");\n\t\tif (pointer.TryEvaluate(contextData ?? data, out var pathEval) ||\n\t\t\tpointer.TryEvaluate(data, out pathEval))\n\t\t\treturn pathEval;\n\n\t\treturn DefaultValue?.Apply(data, contextData) ?? null;\n\t}\n\n\tJsonNode? IRule.Apply(JsonNode? args, EvaluationContext context)\n\t{\n\t\tvar pathValue = args;\n\t\tJsonNode? defaultValue = null;\n\t\tif (args is JsonArray array)\n\t\t{\n\t\t\tif (array.Count > 0)\n\t\t\t\tpathValue = array[0];\n\t\t\tif (array.Count > 1)\n\t\t\t\tdefaultValue = array[1];\n\t\t}\n\n\t\tvar path = JsonLogic.Apply(pathValue, context).Stringify();\n\t\tif (path == string.Empty) return context.CurrentValue;\n\n\t\tif (context.TryFind(path, out var value)) return value;\n\n\t\treturn JsonLogic.Apply(defaultValue, context);\n\t}\n}\n\ninternal class VariableRuleJsonConverter : WeaklyTypedJsonConverter\n{\n\tpublic override VariableRule? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar parameters = reader.TokenType == JsonTokenType.StartArray\n\t\t\t? options.ReadArray(ref reader, JsonLogicSerializerContext.Default.Rule)\n\t\t\t: new[] { options.Read(ref reader, JsonLogicSerializerContext.Default.Rule)! };\n\n\t\tif (parameters is not ({ Length: 0 } or { Length: 1 } or { Length: 2 }))\n\t\t\tthrow new JsonException(\"The var rule needs an array with 0, 1, or 2 parameters.\");\n\n\t\treturn parameters.Length switch\n\t\t{\n\t\t\t0 => new VariableRule(),\n\t\t\t1 => new VariableRule(parameters[0]),\n\t\t\t_ => new VariableRule(parameters[0], parameters[1])\n\t\t};\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, VariableRule value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\t\twriter.WritePropertyName(\"var\");\n\t\tif (value.DefaultValue != null)\n\t\t{\n\t\t\twriter.WriteStartArray();\n\t\t\toptions.Write(writer, value.Path, JsonLogicSerializerContext.Default.Rule!);\n\t\t\toptions.Write(writer, value.DefaultValue, JsonLogicSerializerContext.Default.Rule);\n\t\t\twriter.WriteEndArray();\n\t\t}\n\t\telse\n\t\t\toptions.Write(writer, value.Path, JsonLogicSerializerContext.Default.Rule!);\n\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Logic.Rules;\n\n/// \n/// Handles the `var` operation.\n" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Debug/net10.0/JsonMergePatch.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Debug/net10.0/JsonMergePatch.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Debug/net10.0/JsonMergePatch.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+cd3f7239ed20010290424b80b2e5fc57991de436\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonMergePatch.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Debug/net8.0/JsonMergePatch.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Debug/net8.0/JsonMergePatch.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Debug/net8.0/JsonMergePatch.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+cd3f7239ed20010290424b80b2e5fc57991de436\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonMergePatch.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Debug/net9.0/JsonMergePatch.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Debug/net9.0/JsonMergePatch.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Debug/net9.0/JsonMergePatch.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+cd3f7239ed20010290424b80b2e5fc57991de436\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/GenerateMergePatchUpdateAttribute.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/GenerateMergePatchUpdateAttribute.g.cs#L1-L21", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/GenerateMergePatchUpdateAttribute.g.cs", + "startLine": 1, + "endLine": 21, + "content": "// \n#nullable enable\nnamespace Json.MergePatch;\n\npublic enum NestingMode\n{\n\tAutomatic = 0,\n\tSubclass = 1,\n\tSameNamespace = 2\n}\n\n/// \n/// Marks a class for compile-time JSON Merge Patch (RFC 7396) source generation.\n/// The class must be declared partial if patch type is nested.\n/// \n[global::System.AttributeUsage(global::System.AttributeTargets.Class, AllowMultiple = false, Inherited = false)]\npublic sealed class GenerateMergePatchUpdateAttribute : global::System.Attribute\n{\n\tpublic string Name { get; set; } = \"PatchModel\";\n\tpublic NestingMode Nesting { get; set; } = NestingMode.Automatic;\n}", + "snippet": "// \n#nullable enable\nnamespace Json.MergePatch;\n\npublic enum NestingMode\n{\n\tAutomatic = 0,\n\tSubclass = 1,\n\tSameNamespace = 2\n}\n\n/// \n/// Marks a class for compile-time JSON Merge Patch (RFC 7396" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_AutoNestingModel.PatchModel.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_AutoNestingModel.PatchModel.g.cs#L1-L21", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_AutoNestingModel.PatchModel.g.cs", + "startLine": 1, + "endLine": 21, + "content": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class AutoNestingModel\n{\n\tpublic sealed class PatchModel\n\t{\n\t\tpublic global::DotNext.Optional Value { get; init; }\n\n\t\tpublic void ApplyTo(AutoNestingModel target)\n\t\t{\n\t\t\tif (!Value.IsUndefined)\n\t\t\t{\n\t\t\t\ttarget.Value = Value.Value;\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class AutoNestingModel\n{\n\tpublic sealed class PatchModel\n\t{\n\t\tpublic global::DotNext.Optional Value { get; init; }\n\n\t\tpublic vo" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_CollectionContainer.PatchModel.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_CollectionContainer.PatchModel.g.cs#L1-L48", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_CollectionContainer.PatchModel.g.cs", + "startLine": 1, + "endLine": 48, + "content": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class CollectionContainer\n{\n\tpublic sealed class PatchModel\n\t{\n\t\tpublic global::DotNext.Optional IntArray { get; init; }\n\t\tpublic global::DotNext.Optional?> IntList { get; init; }\n\t\tpublic global::DotNext.Optional?> Tags { get; init; }\n\t\tpublic global::DotNext.Optional?> Locations { get; init; }\n\n\t\tpublic void ApplyTo(CollectionContainer target)\n\t\t{\n\t\t\tif (!IntArray.IsUndefined)\n\t\t\t{\n\t\t\t\tif (IntArray.IsNull)\n\t\t\t\t\ttarget.IntArray = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.IntArray = IntArray.Value;\n\t\t\t}\n\t\t\tif (!IntList.IsUndefined)\n\t\t\t{\n\t\t\t\tif (IntList.IsNull)\n\t\t\t\t\ttarget.IntList = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.IntList = IntList.Value;\n\t\t\t}\n\t\t\tif (!Tags.IsUndefined)\n\t\t\t{\n\t\t\t\tif (Tags.IsNull)\n\t\t\t\t\ttarget.Tags = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.Tags = Tags.Value;\n\t\t\t}\n\t\t\tif (!Locations.IsUndefined)\n\t\t\t{\n\t\t\t\tif (Locations.IsNull)\n\t\t\t\t\ttarget.Locations = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.Locations = Locations.Value;\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class CollectionContainer\n{\n\tpublic sealed class PatchModel\n\t{\n\t\tpublic global::DotNext.Optional IntArray { get; init; }\n\t\tp" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_CollectionContainer.UpdateDto.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_CollectionContainer.UpdateDto.g.cs#L1-L48", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_CollectionContainer.UpdateDto.g.cs", + "startLine": 1, + "endLine": 48, + "content": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class CollectionContainer\n{\n\tpublic sealed class UpdateDto\n\t{\n\t\tpublic global::DotNext.Optional IntArray { get; init; }\n\t\tpublic global::DotNext.Optional?> IntList { get; init; }\n\t\tpublic global::DotNext.Optional?> Tags { get; init; }\n\t\tpublic global::DotNext.Optional?> Locations { get; init; }\n\n\t\tpublic void ApplyTo(CollectionContainer target)\n\t\t{\n\t\t\tif (!IntArray.IsUndefined)\n\t\t\t{\n\t\t\t\tif (IntArray.IsNull)\n\t\t\t\t\ttarget.IntArray = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.IntArray = IntArray.Value;\n\t\t\t}\n\t\t\tif (!IntList.IsUndefined)\n\t\t\t{\n\t\t\t\tif (IntList.IsNull)\n\t\t\t\t\ttarget.IntList = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.IntList = IntList.Value;\n\t\t\t}\n\t\t\tif (!Tags.IsUndefined)\n\t\t\t{\n\t\t\t\tif (Tags.IsNull)\n\t\t\t\t\ttarget.Tags = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.Tags = Tags.Value;\n\t\t\t}\n\t\t\tif (!Locations.IsUndefined)\n\t\t\t{\n\t\t\t\tif (Locations.IsNull)\n\t\t\t\t\ttarget.Locations = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.Locations = Locations.Value;\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class CollectionContainer\n{\n\tpublic sealed class UpdateDto\n\t{\n\t\tpublic global::DotNext.Optional IntArray { get; init; }\n\t\tpu" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_InvalidSubclassNestingModel.PatchModel.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_InvalidSubclassNestingModel.PatchModel.g.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_InvalidSubclassNestingModel.PatchModel.g.cs", + "startLine": 1, + "endLine": 18, + "content": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic sealed class InvalidSubclassNestingModelPatchModel\n{\n\tpublic global::DotNext.Optional Value { get; init; }\n\n\tpublic void ApplyTo(InvalidSubclassNestingModel target)\n\t{\n\t\tif (!Value.IsUndefined)\n\t\t{\n\t\t\t\ttarget.Value = Value.Value;\n\t\t}\n\t}\n}", + "snippet": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic sealed class InvalidSubclassNestingModelPatchModel\n{\n\tpublic global::DotNext.Optional Value { get; init; }\n\n\tpublic void ApplyTo(Invali" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_Location.LocationPatch.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_Location.LocationPatch.g.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_Location.LocationPatch.g.cs", + "startLine": 1, + "endLine": 33, + "content": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class Location\n{\n\tpublic sealed class LocationPatch\n\t{\n\t\tpublic global::DotNext.Optional City { get; init; }\n\t\t[global::System.Text.Json.Serialization.JsonPropertyName(\"zip\")]\n\t\tpublic global::DotNext.Optional PostalCode { get; init; }\n\n\t\tpublic void ApplyTo(Location target)\n\t\t{\n\t\t\tif (!City.IsUndefined)\n\t\t\t{\n\t\t\t\tif (City.IsNull)\n\t\t\t\t\ttarget.City = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.City = City.Value;\n\t\t\t}\n\t\t\tif (!PostalCode.IsUndefined)\n\t\t\t{\n\t\t\t\tif (PostalCode.IsNull)\n\t\t\t\t\ttarget.PostalCode = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.PostalCode = PostalCode.Value;\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class Location\n{\n\tpublic sealed class LocationPatch\n\t{\n\t\tpublic global::DotNext.Optional City { get; init; }\n\t\t[global::Sys" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_Location.PatchModel.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_Location.PatchModel.g.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_Location.PatchModel.g.cs", + "startLine": 1, + "endLine": 33, + "content": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class Location\n{\n\tpublic sealed class PatchModel\n\t{\n\t\tpublic global::DotNext.Optional City { get; init; }\n\t\t[global::System.Text.Json.Serialization.JsonPropertyName(\"zip\")]\n\t\tpublic global::DotNext.Optional PostalCode { get; init; }\n\n\t\tpublic void ApplyTo(Location target)\n\t\t{\n\t\t\tif (!City.IsUndefined)\n\t\t\t{\n\t\t\t\tif (City.IsNull)\n\t\t\t\t\ttarget.City = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.City = City.Value;\n\t\t\t}\n\t\t\tif (!PostalCode.IsUndefined)\n\t\t\t{\n\t\t\t\tif (PostalCode.IsNull)\n\t\t\t\t\ttarget.PostalCode = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.PostalCode = PostalCode.Value;\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class Location\n{\n\tpublic sealed class PatchModel\n\t{\n\t\tpublic global::DotNext.Optional City { get; init; }\n\t\t[global::System" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_Location.UpdateDto.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_Location.UpdateDto.g.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_Location.UpdateDto.g.cs", + "startLine": 1, + "endLine": 33, + "content": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class Location\n{\n\tpublic sealed class UpdateDto\n\t{\n\t\tpublic global::DotNext.Optional City { get; init; }\n\t\t[global::System.Text.Json.Serialization.JsonPropertyName(\"zip\")]\n\t\tpublic global::DotNext.Optional PostalCode { get; init; }\n\n\t\tpublic void ApplyTo(Location target)\n\t\t{\n\t\t\tif (!City.IsUndefined)\n\t\t\t{\n\t\t\t\tif (City.IsNull)\n\t\t\t\t\ttarget.City = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.City = City.Value;\n\t\t\t}\n\t\t\tif (!PostalCode.IsUndefined)\n\t\t\t{\n\t\t\t\tif (PostalCode.IsNull)\n\t\t\t\t\ttarget.PostalCode = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.PostalCode = PostalCode.Value;\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class Location\n{\n\tpublic sealed class UpdateDto\n\t{\n\t\tpublic global::DotNext.Optional City { get; init; }\n\t\t[global::System." + }, + { + "title": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_NamespaceNestingModel.PatchModel.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_NamespaceNestingModel.PatchModel.g.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_NamespaceNestingModel.PatchModel.g.cs", + "startLine": 1, + "endLine": 18, + "content": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic sealed class NamespaceNestingModelPatchModel\n{\n\tpublic global::DotNext.Optional Value { get; init; }\n\n\tpublic void ApplyTo(NamespaceNestingModel target)\n\t{\n\t\tif (!Value.IsUndefined)\n\t\t{\n\t\t\t\ttarget.Value = Value.Value;\n\t\t}\n\t}\n}", + "snippet": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic sealed class NamespaceNestingModelPatchModel\n{\n\tpublic global::DotNext.Optional Value { get; init; }\n\n\tpublic void ApplyTo(NamespaceNes" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_SubclassNestingModel.PatchModel.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_SubclassNestingModel.PatchModel.g.cs#L1-L21", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_SubclassNestingModel.PatchModel.g.cs", + "startLine": 1, + "endLine": 21, + "content": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class SubclassNestingModel\n{\n\tpublic sealed class PatchModel\n\t{\n\t\tpublic global::DotNext.Optional Value { get; init; }\n\n\t\tpublic void ApplyTo(SubclassNestingModel target)\n\t\t{\n\t\t\tif (!Value.IsUndefined)\n\t\t\t{\n\t\t\t\ttarget.Value = Value.Value;\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class SubclassNestingModel\n{\n\tpublic sealed class PatchModel\n\t{\n\t\tpublic global::DotNext.Optional Value { get; init; }\n\n\t\tpubli" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_WeatherForecast.PatchModel.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_WeatherForecast.PatchModel.g.cs#L1-L40", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_WeatherForecast.PatchModel.g.cs", + "startLine": 1, + "endLine": 40, + "content": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class WeatherForecast\n{\n\tpublic sealed class PatchModel\n\t{\n\t\tpublic global::DotNext.Optional Temperature { get; init; }\n\t\tpublic global::DotNext.Optional Summary { get; init; }\n\t\tpublic global::DotNext.Optional Location { get; init; }\n\n\t\tpublic void ApplyTo(WeatherForecast target)\n\t\t{\n\t\t\tif (!Temperature.IsUndefined)\n\t\t\t{\n\t\t\t\ttarget.Temperature = Temperature.Value;\n\t\t\t}\n\t\t\tif (!Summary.IsUndefined)\n\t\t\t{\n\t\t\t\tif (Summary.IsNull)\n\t\t\t\t\ttarget.Summary = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.Summary = Summary.Value;\n\t\t\t}\n\t\t\tif (!Location.IsUndefined)\n\t\t\t{\n\t\t\t\tif (Location.IsNull)\n\t\t\t\t\ttarget.Location = null;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttarget.Location ??= new global::Json.MergePatch.Tests.Location();\n\t\t\t\t\tLocation.Value!.ApplyTo(target.Location);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class WeatherForecast\n{\n\tpublic sealed class PatchModel\n\t{\n\t\tpublic global::DotNext.Optional Temperature { get; init; }\n\t\tpubli" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_WeatherForecast.UpdateDto.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_WeatherForecast.UpdateDto.g.cs#L1-L40", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Generated/JsonMergePatch.Net/Json.MergePatch.MergePatchGenerator/Json_MergePatch_Tests_WeatherForecast.UpdateDto.g.cs", + "startLine": 1, + "endLine": 40, + "content": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class WeatherForecast\n{\n\tpublic sealed class UpdateDto\n\t{\n\t\tpublic global::DotNext.Optional Temperature { get; init; }\n\t\tpublic global::DotNext.Optional Summary { get; init; }\n\t\tpublic global::DotNext.Optional Location { get; init; }\n\n\t\tpublic void ApplyTo(WeatherForecast target)\n\t\t{\n\t\t\tif (!Temperature.IsUndefined)\n\t\t\t{\n\t\t\t\ttarget.Temperature = Temperature.Value;\n\t\t\t}\n\t\t\tif (!Summary.IsUndefined)\n\t\t\t{\n\t\t\t\tif (Summary.IsNull)\n\t\t\t\t\ttarget.Summary = null;\n\t\t\t\telse\n\t\t\t\t\ttarget.Summary = Summary.Value;\n\t\t\t}\n\t\t\tif (!Location.IsUndefined)\n\t\t\t{\n\t\t\t\tif (Location.IsNull)\n\t\t\t\t\ttarget.Location = null;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttarget.Location ??= new global::Json.MergePatch.Tests.Location();\n\t\t\t\t\tLocation.Value!.ApplyTo(target.Location);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "// \n#nullable enable\n\nnamespace Json.MergePatch.Tests;\n\npublic partial class WeatherForecast\n{\n\tpublic sealed class UpdateDto\n\t{\n\t\tpublic global::DotNext.Optional Temperature { get; init; }\n\t\tpublic" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Release/net10.0/JsonMergePatch.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Release/net10.0/JsonMergePatch.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Release/net10.0/JsonMergePatch.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+f84dcf0eca68a74a932e145265535553e2448254\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonMergePatch.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Release/net8.0/JsonMergePatch.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Release/net8.0/JsonMergePatch.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Release/net8.0/JsonMergePatch.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+f84dcf0eca68a74a932e145265535553e2448254\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonMergePatch.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonMergePatch.Tests/obj/Release/net9.0/JsonMergePatch.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch.Tests/obj/Release/net9.0/JsonMergePatch.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch.Tests/obj/Release/net9.0/JsonMergePatch.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+f84dcf0eca68a74a932e145265535553e2448254\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonMergePatch/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonMergePatch/obj/Debug/net10.0/JsonMergePatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Debug/net10.0/JsonMergePatch.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Debug/net10.0/JsonMergePatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Merge Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonMergePatch/obj/Debug/net10.0/JsonMergePatch.GlobalUsings.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Debug/net10.0/JsonMergePatch.GlobalUsings.g.cs#L1-L9", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Debug/net10.0/JsonMergePatch.GlobalUsings.g.cs", + "startLine": 1, + "endLine": 9, + "content": "// \nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Net.Http;\nglobal using System.Threading;\nglobal using System.Threading.Tasks;", + "snippet": "// \nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Net.Http;\nglobal using System.Threading;\nglobal using System.Thread" + }, + { + "title": "src/JsonMergePatch/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonMergePatch/obj/Debug/net8.0/JsonMergePatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Debug/net8.0/JsonMergePatch.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Debug/net8.0/JsonMergePatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Merge Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonMergePatch/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonMergePatch/obj/Debug/net9.0/JsonMergePatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Debug/net9.0/JsonMergePatch.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Debug/net9.0/JsonMergePatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Merge Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonMergePatch/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonMergePatch/obj/Debug/netstandard2.0/JsonMergePatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Debug/netstandard2.0/JsonMergePatch.AssemblyInfo.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Debug/netstandard2.0/JsonMergePatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 25, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Merge Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+cd3f7239ed20010290424b80b2e5fc57991de436\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonMergePatch/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonMergePatch/obj/Release/net10.0/JsonMergePatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Release/net10.0/JsonMergePatch.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Release/net10.0/JsonMergePatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Merge Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonMergePatch/obj/Release/net10.0/JsonMergePatch.GlobalUsings.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Release/net10.0/JsonMergePatch.GlobalUsings.g.cs#L1-L9", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Release/net10.0/JsonMergePatch.GlobalUsings.g.cs", + "startLine": 1, + "endLine": 9, + "content": "// \nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Net.Http;\nglobal using System.Threading;\nglobal using System.Threading.Tasks;", + "snippet": "// \nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Net.Http;\nglobal using System.Threading;\nglobal using System.Thread" + }, + { + "title": "src/JsonMergePatch/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonMergePatch/obj/Release/net8.0/JsonMergePatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Release/net8.0/JsonMergePatch.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Release/net8.0/JsonMergePatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Merge Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonMergePatch/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonMergePatch/obj/Release/net9.0/JsonMergePatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Release/net9.0/JsonMergePatch.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Release/net9.0/JsonMergePatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Merge Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonMergePatch/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonMergePatch/obj/Release/netstandard2.0/JsonMergePatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonMergePatch/obj/Release/netstandard2.0/JsonMergePatch.AssemblyInfo.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonMergePatch/obj/Release/netstandard2.0/JsonMergePatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 25, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Merge Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+f84dcf0eca68a74a932e145265535553e2448254\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonMergePatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonPatch.Tests/GithubTests.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/GithubTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/GithubTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing Json.Pointer;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Patch.Tests;\n\npublic class GithubTests\n{\n\t[Test]\n\tpublic void Issue393_PatchDoesNothing()\n\t{\n\t\tconst string mask = \"*****\";\n\t\tvar maskJson = JsonValue.Create(mask);\n\n\t\tvar pathsToPatch = new[] { \"/first_name\", \"/last_name\" };\n\n\t\tvar patchOperations = pathsToPatch.Select(path => PatchOperation.Replace(JsonPointer.Parse(path), maskJson));\n\t\tvar patchConfig = new JsonPatch(patchOperations);\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(patchConfig, TestSerializerContext.Default.JsonPatch));\n\n\t\tconst string singleObjectJson = \"{\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"_id\\\":\\\"640729d45434f90313d25c78\\\",\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"guid\\\":\\\"f2e2767c-03e0-4862-addc-7d46c55efb33\\\",\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"first_name\\\":\\\"Kathrine\\\",\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"last_name\\\":\\\"Pate\\\"\" +\n\t\t\t\t\t\t\t\t\t\t\"}\";\n\n\t\tvar singleObject = JsonNode.Parse(singleObjectJson);\n\t\tvar patchedSingleObject = patchConfig.Apply(singleObject).Result;\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(patchedSingleObject, TestSerializerContext.Default.JsonNode!));\n\n\t\tconst string arrayObjectJson = \"[\" +\n\t\t\t\t\t\t\t\t\t \"{\" +\n\t\t\t\t\t\t\t\t\t \"\\\"_id\\\":\\\"640729d45434f90313d25c78\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"guid\\\":\\\"f2e2767c-03e0-4862-addc-7d46c55efb33\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"first_name\\\":\\\"Kathrine\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"last_name\\\":\\\"Pate\\\"\" +\n\t\t\t\t\t\t\t\t\t \"},\" +\n\t\t\t\t\t\t\t\t\t \"{\\\"_id\\\":\\\"640729d45b5824ffcabc30a5\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"guid\\\":\\\"73193eda-074b-4f31-9f09-507a008ccb75\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"first_name\\\":\\\"Rivers\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"last_name\\\":\\\"Smith\\\"\" +\n\t\t\t\t\t\t\t\t\t \"}\" +\n\t\t\t\t\t\t\t\t\t \"]\";\n\n\t\tvar arrayObject = JsonNode.Parse(arrayObjectJson);\n\n\t\t// Way 1: patch whole array\n\t\tvar patchedArray = patchConfig.Apply(arrayObject).Result; // <- does nothing\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(patchedArray, TestSerializerContext.Default.JsonNode!));\n\t}\n\n\t[Test]\n\tpublic void Issue393_NodeAlreadyHasParent_2()\n\t{\n\t\tconst string mask = \"*****\";\n\t\tvar maskJson = JsonValue.Create(mask);\n\n\t\tvar pathsToPatch = new[] { \"/first_name\", \"/last_name\" };\n\n\t\tvar patchOperations = pathsToPatch.Select(path => PatchOperation.Replace(JsonPointer.Parse(path), maskJson));\n\t\tvar patchConfig = new JsonPatch(patchOperations);\n\n\t\tconst string singleObjectJson = \"{\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"_id\\\":\\\"640729d45434f90313d25c78\\\",\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"guid\\\":\\\"f2e2767c-03e0-4862-addc-7d46c55efb33\\\",\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"first_name\\\":\\\"Kathrine\\\",\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"last_name\\\":\\\"Pate\\\"\" +\n\t\t\t\t\t\t\t\t\t\t\"}\";\n\n\t\tvar singleObject = JsonNode.Parse(singleObjectJson);\n\t\tvar patchedSingleObject = patchConfig.Apply(singleObject).Result;\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(patchedSingleObject, TestEnvironment.SerializerOptions));\n\n\t\tconst string arrayObjectJson = \"[\" +\n\t\t\t\t\t\t\t\t\t \"{\" +\n\t\t\t\t\t\t\t\t\t \"\\\"_id\\\":\\\"640729d45434f90313d25c78\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"guid\\\":\\\"f2e2767c-03e0-4862-addc-7d46c55efb33\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"first_name\\\":\\\"Kathrine\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"last_name\\\":\\\"Pate\\\"\" +\n\t\t\t\t\t\t\t\t\t \"},\" +\n\t\t\t\t\t\t\t\t\t \"{\\\"_id\\\":\\\"640729d45b5824ffcabc30a5\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"guid\\\":\\\"73193eda-074b-4f31-9f09-507a008ccb75\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"first_name\\\":\\\"Rivers\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"last_name\\\":\\\"Smith\\\"\" +\n\t\t\t\t\t\t\t\t\t \"}\" +\n\t\t\t\t\t\t\t\t\t \"]\";\n\n\t\tvar arrayObject = JsonNode.Parse(arrayObjectJson);\n\n\t\tvar jsonArray = arrayObject!.AsArray();\n\n\t\t// Way 2: just patch every element\n\t\tforeach (var element in jsonArray)\n\t\t{\n\t\t\tvar patchedNode = patchConfig.Apply(element).Result; // <- throws an error\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(patchedNode, TestEnvironment.SerializerOptions));\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void Issue393_NodeAlreadyHasParent_3()\n\t{\n\t\tconst string mask = \"*****\";\n\t\tvar maskJson = JsonValue.Create(mask);\n\n\t\tvar pathsToPatch = new[] { \"/first_name\", \"/last_name\" };\n\n\t\tvar patchOperations = pathsToPatch.Select(path => PatchOperation.Replace(JsonPointer.Parse(path), maskJson));\n\t\tvar patchConfig = new JsonPatch(patchOperations);", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing Json.Pointer;\nusing NUnit.Framework;\nusing " + }, + { + "title": "src/JsonPatch.Tests/GithubTests.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/GithubTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/GithubTests.cs", + "startLine": 121, + "endLine": 240, + "content": "const string singleObjectJson = \"{\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"_id\\\":\\\"640729d45434f90313d25c78\\\",\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"guid\\\":\\\"f2e2767c-03e0-4862-addc-7d46c55efb33\\\",\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"first_name\\\":\\\"Kathrine\\\",\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"last_name\\\":\\\"Pate\\\"\" +\n\t\t\t\t\t\t\t\t\t\t\"}\";\n\n\t\tvar singleObject = JsonNode.Parse(singleObjectJson);\n\t\tvar patchedSingleObject = patchConfig.Apply(singleObject).Result;\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(patchedSingleObject, TestEnvironment.SerializerOptions));\n\n\t\tconst string arrayObjectJson = \"[\" +\n\t\t\t\t\t\t\t\t\t \"{\" +\n\t\t\t\t\t\t\t\t\t \"\\\"_id\\\":\\\"640729d45434f90313d25c78\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"guid\\\":\\\"f2e2767c-03e0-4862-addc-7d46c55efb33\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"first_name\\\":\\\"Kathrine\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"last_name\\\":\\\"Pate\\\"\" +\n\t\t\t\t\t\t\t\t\t \"},\" +\n\t\t\t\t\t\t\t\t\t \"{\\\"_id\\\":\\\"640729d45b5824ffcabc30a5\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"guid\\\":\\\"73193eda-074b-4f31-9f09-507a008ccb75\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"first_name\\\":\\\"Rivers\\\",\" +\n\t\t\t\t\t\t\t\t\t \"\\\"last_name\\\":\\\"Smith\\\"\" +\n\t\t\t\t\t\t\t\t\t \"}\" +\n\t\t\t\t\t\t\t\t\t \"]\";\n\n\t\tvar arrayObject = JsonNode.Parse(arrayObjectJson);\n\n\t\tvar jsonArray = arrayObject!.AsArray();\n\n\t\t// Way 3: remove from initial array and then patch\n\t\tfor (int currentIndex = jsonArray.Count - 1; currentIndex >= 0; currentIndex--)\n\t\t{\n\t\t\tvar nodeToPatch = jsonArray[currentIndex];\n\t\t\tjsonArray.RemoveAt(currentIndex);\n\n\t\t\tvar patchedNode = patchConfig.Apply(nodeToPatch).Result; // <- throws an error\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(patchedNode, TestEnvironment.SerializerOptions));\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void Issue397_ReplaceShouldThrowForMissingValue()\n\t{\n\t\tJsonNode? maskJson = \"*****\";\n\n\t\tvar pathsToPatch = new[] { \"/first_name\", \"/last_name\" };\n\n\t\tvar patchOperations = pathsToPatch.Select(path => PatchOperation.Replace(JsonPointer.Parse(path), maskJson));\n\t\tvar patchConfig = new JsonPatch(patchOperations);\n\n\t\tconst string singleObjectJson = @\"{\n\t\"\"id\"\":\"\"640729d45434f90313d25c78\"\",\n \"\"guid\"\":\"\"f2e2767c-03e0-4862-addc-7d46c55efb33\"\",\n\t\"\"city\"\":\"\"Boston\"\"\n}\";\n\n\t\tvar singleObject = JsonNode.Parse(singleObjectJson);\n\t\tvar result = patchConfig.Apply(singleObject);\n\t\tvar serializerOptions = new JsonSerializerOptions\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tWriteIndented = true,\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t\t};\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, serializerOptions));\n\t\tAssert.That(patchConfig.Apply(singleObject).Error, Is.Not.Null);\n\t}\n\n\tpublic class Target543\n\t{\n\t\tpublic List Values { get; set; } = null!;\n\t}\n\n\t[Test]\n\tpublic void Issue543_CreatePatchToAddItem()\n\t{\n\t\tvar targetObj = new Target543 { Values = [1, 2, 3, 4] };\n\t\tvar target = JsonSerializer.SerializeToNode(targetObj, TestEnvironment.SerializerOptions);\n\n\t\tvar jsonPointer = JsonPointer.Create(\"Values\", \"-\");\n\t\tvar jsonPatch = new JsonPatch(PatchOperation.Add(jsonPointer, (JsonNode)42));\n\n\t\tvar expected = new JsonObject\n\t\t{\n\t\t\t[\"Values\"] = new JsonArray(1, 2, 3, 4, 42)\n\t\t};\n\n\t\tvar patchResult = jsonPatch.Apply(target);\n\n\t\tAssert.That(expected.IsEquivalentTo(patchResult.Result), Is.True);\n\t}\n\n\t[Test]\n\tpublic void Issue825_MoveShouldMoveItemToTheEndOfArray()\n\t{\n\t\tvar jsonModel = new JsonObject\n\t\t{\n\t\t\t[\"Items\"] = new JsonArray(1, 2, 3, 4, 5)\n\t\t};\n\n\t\tvar doc = new JsonPatch(\n\t\t\tPatchOperation.Move(\n\t\t\t\tJsonPointer.Parse(\"/Items/2\"),\n\t\t\t\tJsonPointer.Parse(\"/Items/-\")));\n\n\t\tvar result = doc.Apply(jsonModel);\n\n\t\tAssert.That(result.Error, Is.Null);\n\n\t\tvar jsonArray = result.Result![\"Items\"]!.AsArray();\n\t\tAssert.That(jsonArray, Has.Count.EqualTo(5));\n\t\tAssert.That(jsonArray[^1].IsEquivalentTo(3));\n\t}\n\n\t[Test]\n\tpublic void Issue825_CopyShouldCopyItemToEndOfArray()\n\t{\n\t\tvar jsonModel = new JsonObject\n\t\t{\n\t\t\t[\"Items\"] = new JsonArray(1, 2, 3, 4, 5)", + "snippet": "const string singleObjectJson = \"{\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"_id\\\":\\\"640729d45434f90313d25c78\\\",\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"guid\\\":\\\"f2e2767c-03e0-4862-addc-7d46c55efb33\\\",\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"first_name\\\":\\\"Kathrine\\\",\" +\n\t\t\t\t\t\t\t\t\t\t\"\\\"last_name" + }, + { + "title": "src/JsonPatch.Tests/GithubTests.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/GithubTests.cs#L241-L350", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/GithubTests.cs", + "startLine": 241, + "endLine": 350, + "content": "};\n\n\t\tvar doc = new JsonPatch(\n\t\t\tPatchOperation.Copy(\n\t\t\t\tJsonPointer.Parse(\"/Items/2\"),\n\t\t\t\tJsonPointer.Parse(\"/Items/-\")));\n\n\t\tvar result = doc.Apply(jsonModel);\n\n\t\tAssert.That(result.Error, Is.Null);\n\n\t\tvar jsonArray = result.Result![\"Items\"]!.AsArray();\n\t\tAssert.That(jsonArray, Has.Count.EqualTo(6));\n\t\tAssert.That(jsonArray[^1].IsEquivalentTo(3));\n\t}\n\n\t[Test]\n\tpublic void Issue825_RemoveShouldRemoveItemAtEndOfArray()\n\t{\n\t\tvar jsonModel = new JsonObject\n\t\t{\n\t\t\t[\"Items\"] = new JsonArray(1, 2, 3, 4, 5)\n\t\t};\n\n\t\tvar doc = new JsonPatch(PatchOperation.Remove(JsonPointer.Parse(\"/Items/-\")));\n\n\t\tvar result = doc.Apply(jsonModel);\n\n\t\tAssert.That(result.Error, Is.Null);\n\n\t\tvar jsonArray = result.Result![\"Items\"]!.AsArray();\n\t\tAssert.That(jsonArray, Has.Count.EqualTo(4));\n\t\tAssert.That(jsonArray[^1].IsEquivalentTo(4));\n\t}\n\n\t[TestCase(\"/Items/-\")]\n\t[TestCase(\"/Items/4\")]\n\tpublic void Issue825_ReplaceShouldReplaceItemToEndOfArray(string path)\n\t{\n\t\tvar jsonModel = new JsonObject\n\t\t{\n\t\t\t[\"Items\"] = new JsonArray(1, 2, 3, 4, 5)\n\t\t};\n\n\t\tvar doc = new JsonPatch(PatchOperation.Replace(\n\t\t\tJsonPointer.Parse(path),\n\t\t\tJsonNode.Parse(\"6\")));\n\n\t\tvar result = doc.Apply(jsonModel);\n\n\t\tAssert.That(result.Error, Is.Null);\n\n\t\tvar jsonArray = result.Result![\"Items\"]!.AsArray();\n\t\tAssert.That(jsonArray, Has.Count.EqualTo(5));\n\t\tAssert.That(jsonArray[^1].IsEquivalentTo(6));\n\t}\n\n\t[Test]\n\tpublic void Issue826_CopyShouldCopyValuesToTarget()\n\t{\n\t\tvar jsonModel = new JsonObject\n\t\t{\n\t\t\t[\"Items\"] = new JsonArray(1, 2, 3, 4, 5)\n\t\t};\n\t\tvar expected = new JsonObject\n\t\t{\n\t\t\t[\"Items\"] = new JsonArray(3, 1, 2, 3, 4, 5)\n\t\t};\n\n\t\tvar addDoc = new JsonPatch(\n\t\t\tPatchOperation.Add(\n\t\t\t\tJsonPointer.Parse(\"/Items/0\"),\n\t\t\t\tJsonNode.Parse(\"3\")));\n\n\t\tvar addResult = addDoc.Apply(jsonModel);\n\n\t\tAssert.That(addResult.Error, Is.Null);\n\t\tConsole.WriteLine(addResult.Result.AsJsonString());\n\t\tAssert.That(addResult.Result.IsEquivalentTo(expected));\n\n\t\tvar copyDoc = new JsonPatch(\n\t\t\tPatchOperation.Copy(\n\t\t\t\tJsonPointer.Parse(\"/Items/2\"),\n\t\t\t\tJsonPointer.Parse(\"/Items/0\")));\n\n\t\tvar copyResult = copyDoc.Apply(jsonModel);\n\n\t\tAssert.That(copyResult.Error, Is.Null);\n\t\tConsole.WriteLine(copyResult.Result.AsJsonString());\n\t\tAssert.That(copyResult.Result.IsEquivalentTo(expected));\n\t}\n\n\t[Test]\n\tpublic void Issue1004_AddPropertyToScalarShouldFail()\n\t{\n\t\tvar jsonModel = new JsonObject\n\t\t{\n\t\t\t[\"a\"] = \"b\",\n\t\t};\n\n\t\tvar patchDoc = new JsonPatch(\n\t\t\tPatchOperation.Add(JsonPointer.Parse(\"/a/b\"), \"c\")\n\t\t);\n\n\t\tvar patchResult = patchDoc.Apply(jsonModel);\n\n\t\tAssert.That(patchResult.IsSuccess, Is.False);\n\t\tAssert.That(patchResult.Error, Is.EqualTo(\"Target path `/a/b` could not be reached.\"));\n\t}\n}", + "snippet": "};\n\n\t\tvar doc = new JsonPatch(\n\t\t\tPatchOperation.Copy(\n\t\t\t\tJsonPointer.Parse(\"/Items/2\"),\n\t\t\t\tJsonPointer.Parse(\"/Items/-\")));\n\n\t\tvar result = doc.Apply(jsonModel);\n\n\t\tAssert.That(result.Error, Is.Null);\n\n\t\tvar jsonArray" + }, + { + "title": "src/JsonPatch.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonPatch.Tests/obj/Debug/net10.0/JsonPatch.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/obj/Debug/net10.0/JsonPatch.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/obj/Debug/net10.0/JsonPatch.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonPatch.Tests/obj/Debug/net8.0/JsonPatch.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/obj/Debug/net8.0/JsonPatch.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/obj/Debug/net8.0/JsonPatch.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonPatch.Tests/obj/Debug/net9.0/JsonPatch.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/obj/Debug/net9.0/JsonPatch.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/obj/Debug/net9.0/JsonPatch.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonPatch.Tests/obj/Release/net10.0/JsonPatch.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/obj/Release/net10.0/JsonPatch.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/obj/Release/net10.0/JsonPatch.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonPatch.Tests/obj/Release/net8.0/JsonPatch.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/obj/Release/net8.0/JsonPatch.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/obj/Release/net8.0/JsonPatch.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonPatch.Tests/obj/Release/net9.0/JsonPatch.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/obj/Release/net9.0/JsonPatch.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/obj/Release/net9.0/JsonPatch.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch.Tests/PatchExtensionTests.cs (1/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/PatchExtensionTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/PatchExtensionTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\n// ReSharper disable UnusedAutoPropertyAccessor.Local\n\nnamespace Json.Patch.Tests;\n\npublic class PatchExtensionTests\n{\n\tinternal class TestModel\n\t{\n\t\tpublic Guid Id { get; set; }\n\t\tpublic string? Name { get; set; }\n\t\tpublic int[]? Numbers { get; set; }\n\t\tpublic string[]? Strings { get; set; }\n\t\tpublic List? InnerObjects { get; set; }\n\t\tpublic JsonNode? Attributes { get; set; }\n\t}\n\n\t[Test]\n\tpublic void CreatePatch()\n\t{\n\t\tvar initial = new TestModel\n\t\t{\n\t\t\tId = Guid.NewGuid(),\n\t\t\tAttributes = JsonNode.Parse(\"[{\\\"test\\\":\\\"test123\\\"},{\\\"test\\\":\\\"test321\\\"},{\\\"test\\\":[1,2,3]},{\\\"test\\\":[1,2,4]}]\")\n\t\t};\n\t\tvar expected = new TestModel\n\t\t{\n\t\t\tId = Guid.Parse(\"40664cc7-864f-4eed-939c-78076a252df0\"),\n\t\t\tAttributes = JsonNode.Parse(\"[{\\\"test\\\":\\\"test123\\\"},{\\\"test\\\":\\\"test32132\\\"},{\\\"test1\\\":\\\"test321\\\"},{\\\"test\\\":[1,2,3]},{\\\"test\\\":[1,2,3]}]\")\n\t\t};\n\t\tvar patchExpected = JsonNode.Parse(\n\t\t\t\"[{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Id\\\",\\\"value\\\":\\\"40664cc7-864f-4eed-939c-78076a252df0\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Attributes/1/test\\\",\\\"value\\\":\\\"test32132\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"remove\\\",\\\"path\\\":\\\"/Attributes/2/test\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/Attributes/2/test1\\\",\\\"value\\\":\\\"test321\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Attributes/3/test/2\\\",\\\"value\\\":3},\" +\n\t\t\t\"{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/Attributes/4\\\",\\\"value\\\":{\\\"test\\\":[1,2,3]}}]\");\n\n\t\tvar patch = initial.CreatePatch(expected, TestEnvironment.SerializerOptions);\n\n\t\tvar serialized = JsonSerializer.SerializeToNode(patch, TestEnvironment.SerializerOptions);\n\n\t\tAssert.That(serialized.IsEquivalentTo(patchExpected), Is.True);\n\t}\n\n\t[Test]\n\tpublic void CreatePatch2()\n\t{\n\t\tvar initial = JsonNode.Parse(\"[{\\\"test\\\":\\\"test123\\\"},{\\\"test\\\":\\\"test321\\\"},{\\\"test\\\":[1,2,3]},{\\\"test\\\":[1,2,4]}]\");\n\t\tvar expected = JsonNode.Parse(\"[{\\\"test\\\":\\\"test123\\\"},{\\\"test\\\":\\\"test32132\\\"},{\\\"test1\\\":\\\"test321\\\"},{\\\"test\\\":[1,2,3]},{\\\"test\\\":[1,2,3]}]\");\n\t\tvar patchExpected = JsonSerializer.Deserialize(\n\t\t\t\"[{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/1/test\\\",\\\"value\\\":\\\"test32132\\\"},{\\\"op\\\":\\\"remove\\\",\\\"path\\\":\\\"/2/test\\\"},{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/2/test1\\\",\\\"value\\\":\\\"test321\\\"},{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/3/test/2\\\",\\\"value\\\":3},{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/4\\\",\\\"value\\\":{\\\"test\\\":[1,2,3]}}]\",\n\t\t\tTestEnvironment.SerializerOptions\n\t\t);\n\n\t\tvar patch = initial.CreatePatch(expected, TestEnvironment.SerializerOptions);\n\n\t\tVerifyPatches(patchExpected!, patch);\n\t}\n\n\t[Test]\n\tpublic void CreatePatch_ChangeTypeInArray()\n\t{\n\t\tvar initial = JsonNode.Parse(\"[{\\\"test\\\":true},{\\\"test\\\":\\\"test321\\\"},{\\\"test\\\":[1,2,3]},{\\\"test\\\":[1,2,4]},{\\\"test\\\":[1,2,3]}]\");\n\t\tvar expected = JsonNode.Parse(\"[{\\\"test\\\":false},{\\\"test\\\":\\\"test32132\\\"},{\\\"test1\\\":\\\"test321\\\"},{\\\"test\\\":[1,2,3]},{\\\"test\\\":{\\\"test\\\":123}},{\\\"test\\\":[1,2,3]}]\");\n\t\tvar patchExpected = JsonSerializer.Deserialize(\n\t\t\t\"[{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/0/test\\\",\\\"value\\\":false},{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/1/test\\\",\\\"value\\\":\\\"test32132\\\"},{\\\"op\\\":\\\"remove\\\",\\\"path\\\":\\\"/2/test\\\"},{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/2/test1\\\",\\\"value\\\":\\\"test321\\\"},{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/3/test/2\\\",\\\"value\\\":3},{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/4/test\\\",\\\"value\\\":{\\\"test\\\":123}},{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/5\\\",\\\"value\\\":{\\\"test\\\":[1,2,3]}}]\",\n\t\t\tTestEnvironment.SerializerOptions\n\t\t);\n\n\t\tvar patch = initial.CreatePatch(expected, TestEnvironment.SerializerOptions);\n\n\t\tVerifyPatches(patchExpected!, patch);\n\t}\n\n\t[Test]\n\tpublic void CreatePatch_ChangeTypeInObject()\n\t{\n\t\tvar initial = JsonNode.Parse(\"{\\\"test\\\":true, \\\"test2\\\":\\\"string\\\", \\\"test3\\\":{\\\"test123\\\":123}}\");\n\t\tvar expected = JsonNode.Parse(\"{\\\"test\\\":false, \\\"test2\\\":123, \\\"test3\\\":[123]}\");\n\t\tvar patchExpected = JsonSerializer.Deserialize(\n\t\t\t\"[{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/test\\\",\\\"value\\\":false},{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/test2\\\",\\\"value\\\":123},{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/test3\\\",\\\"value\\\":[123]}]\",\n\t\t\tTestEnvironment.SerializerOptions\n\t\t);\n\n\t\tvar patch = initial.CreatePatch(expected, TestEnvironment.SerializerOptions);\n\n\t\tVerifyPatches(patchExpected!, patch);\n\t}\n\n\tprivate static readonly JsonSerializerOptions _ignoreWritingNullSerializerOptions =\n\t\tnew()\n\t\t{\n\t\t\t\tDefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,\n\t\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default }\n\t\t\t};\n\n\t[Test]\n\tpublic void Add()\n\t{\n\t\tvar initial = new TestModel\n\t\t{\n\t\t\tId = Guid.NewGuid()\n\t\t};\n\t\tvar target = new TestModel\n\t\t{\n\t\t\tId = initial.Id,\n\t\t\tAttributes = JsonNode.Parse(\"[{\\\"test\\\":\\\"test123\\\"},{\\\"test\\\":\\\"test32132\\\"},{\\\"test1\\\":\\\"test321\\\"},{\\\"test\\\":[1,2,3]},{\\\"test\\\":[1,2,3]}]\")\n\t\t};\n\t\tvar patchExpectedStr = \"[{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/Attributes\\\",\\\"value\\\":[{\\\"test\\\":\\\"test123\\\"},{\\\"test\\\":\\\"test32132\\\"},{\\\"test1\\\":\\\"test321\\\"},{\\\"test\\\":[1,2,3]},{\\\"test\\\":[1,2,3]}]}]\";\n\t\tvar expected = JsonSerializer.Deserialize(patchExpectedStr, TestEnvironment.SerializerOptions)!;", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\n/" + }, + { + "title": "src/JsonPatch.Tests/PatchExtensionTests.cs (2/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/PatchExtensionTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/PatchExtensionTests.cs", + "startLine": 121, + "endLine": 240, + "content": "var patch = initial.CreatePatch(target, _ignoreWritingNullSerializerOptions);\n\n\t\tVerifyPatches(expected, patch);\n\t}\n\n\t[Test]\n\tpublic void Remove()\n\t{\n\t\tvar initial = new TestModel\n\t\t{\n\t\t\tId = Guid.NewGuid(),\n\t\t\tAttributes = JsonNode.Parse(\"[{\\\"test\\\":\\\"test123\\\"},{\\\"test\\\":\\\"test32132\\\"},{\\\"test1\\\":\\\"test321\\\"},{\\\"test\\\":[1,2,3]},{\\\"test\\\":[1,2,3]}]\")\n\t\t};\n\t\tvar expected = new TestModel\n\t\t{\n\t\t\tId = initial.Id\n\t\t};\n\t\tvar patchExpectedStr = \"[{\\\"op\\\":\\\"remove\\\",\\\"path\\\":\\\"/Attributes\\\"}]\";\n\t\tvar patchExpected = JsonSerializer.Deserialize(patchExpectedStr, TestEnvironment.SerializerOptions)!;\n\n\t\tvar patch = initial.CreatePatch(expected, _ignoreWritingNullSerializerOptions);\n\n\t\tVerifyPatches(patchExpected, patch);\n\t}\n\n\t[Test]\n\tpublic void Replace()\n\t{\n\t\tvar initial = new TestModel\n\t\t{\n\t\t\tId = Guid.NewGuid()\n\t\t};\n\t\tvar expected = new TestModel\n\t\t{\n\t\t\tId = Guid.Parse(\"a299e216-dbbe-40e4-b4d4-556d7e7e9c35\")\n\t\t};\n\t\tvar patchExpectedStr = \"[{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Id\\\",\\\"value\\\":\\\"a299e216-dbbe-40e4-b4d4-556d7e7e9c35\\\"}]\";\n\t\tvar patchExpected = JsonSerializer.Deserialize(patchExpectedStr, TestEnvironment.SerializerOptions);\n\t\tvar patch = initial.CreatePatch(expected, TestEnvironment.SerializerOptions);\n\n\t\tVerifyPatches(patchExpected!, patch);\n\t}\n\n\t[Test]\n\tpublic void AddArray()\n\t{\n\t\tvar initial = JsonNode.Parse(\"[1,2,3]\");\n\t\tvar expected = JsonNode.Parse(\"[1,2,3,4]\");\n\t\tvar patchExpectedStr = \"[{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/3\\\",\\\"value\\\":4}]\";\n\t\tvar patchExpected = JsonSerializer.Deserialize(patchExpectedStr, TestEnvironment.SerializerOptions);\n\t\tvar patch = initial.CreatePatch(expected, TestEnvironment.SerializerOptions);\n\n\t\tVerifyPatches(patchExpected!, patch);\n\t}\n\n\t[Test]\n\tpublic void RemoveArray()\n\t{\n\t\tvar initial = JsonNode.Parse(\"[1,2,3]\");\n\t\tvar expected = JsonNode.Parse(\"[1,2]\");\n\t\tvar patchExpectedStr = \"[{\\\"op\\\":\\\"remove\\\",\\\"path\\\":\\\"/2\\\"}]\";\n\t\tvar patchExpected = JsonSerializer.Deserialize(patchExpectedStr, TestEnvironment.SerializerOptions);\n\t\tvar patch = initial.CreatePatch(expected, TestEnvironment.SerializerOptions);\n\n\t\tVerifyPatches(patchExpected!, patch);\n\t}\n\n\t[Test]\n\tpublic void ReplaceArray()\n\t{\n\t\tvar initial = JsonNode.Parse(\"[1,2,3]\");\n\t\tvar expected = JsonNode.Parse(\"[1,2,1]\");\n\t\tvar patch = initial.CreatePatch(expected);\n\t\tvar patchExpectedStr = \"[{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/2\\\",\\\"value\\\":1}]\";\n\t\tvar patchExpected = JsonSerializer.Deserialize(patchExpectedStr, TestEnvironment.SerializerOptions);\n\n\t\tVerifyPatches(patchExpected!, patch);\n\t}\n\n\t[Test]\n\tpublic void ComplexObject()\n\t{\n\t\tvar initial = new TestModel\n\t\t{\n\t\t\tId = Guid.Parse(\"aa7daced-c9fa-489b-9bc1-540b21d277a1\"),\n\t\t\tAttributes = JsonNode.Parse(\"[{\\\"test\\\":\\\"test123\\\"},{\\\"test\\\":\\\"test32132\\\"},{\\\"test1\\\":\\\"test321\\\"},{\\\"test\\\":[1,2,3]},{\\\"test\\\":[1,2,3]}]\"),\n\t\t\tName = \"Test\",\n\t\t\tNumbers = [1, 2, 3],\n\t\t\tStrings = [\"test1\", \"test2\"],\n\t\t\tInnerObjects =\n\t\t\t[\n\t\t\t\tnew()\n\t\t\t\t{\n\t\t\t\t\tId = Guid.Parse(\"b2cab2a0-ec23-405a-a5a8-975448a10334\"),\n\t\t\t\t\tName = \"TestNameInner1\",\n\t\t\t\t\tNumbers = [3, 2, 1],\n\t\t\t\t\tStrings = [\"Test3\", \"test4\"]\n\t\t\t\t}\n\t\t\t]\n\t\t};\n\t\tvar expected = new TestModel\n\t\t{\n\t\t\tId = Guid.Parse(\"4801bd62-a8ec-4ef2-ae3c-52b9f541625f\"),\n\t\t\tAttributes = JsonNode.Parse(\"[{\\\"test1\\\":\\\"test123\\\"},{\\\"test\\\":\\\"test32132\\\"},{\\\"test1\\\":\\\"test321\\\"},{\\\"test\\\":[1,1,3]}]\"),\n\t\t\tName = \"Test4\",\n\t\t\tNumbers = [1, 2, 3, 4],\n\t\t\tStrings = [\"test2\", \"test2\"],\n\t\t\tInnerObjects =\n\t\t\t[\n\t\t\t\tnew()\n\t\t\t\t{\n\t\t\t\t\tId = Guid.Parse(\"bed584b0-7ccc-4336-adba-d0d7f7c3c3f2\"),\n\t\t\t\t\tName = \"TestNameInner1\",\n\t\t\t\t\tNumbers = [1, 2, 1],\n\t\t\t\t\tStrings = [\"Test3\", \"test4\", \"test5\"]\n\t\t\t\t}\n\t\t\t]\n\t\t};\n\t\tvar patchExpectedStr =\n\t\t\t\"[{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Id\\\",\\\"value\\\":\\\"4801bd62-a8ec-4ef2-ae3c-52b9f541625f\\\"},\" +", + "snippet": "var patch = initial.CreatePatch(target, _ignoreWritingNullSerializerOptions);\n\n\t\tVerifyPatches(expected, patch);\n\t}\n\n\t[Test]\n\tpublic void Remove()\n\t{\n\t\tvar initial = new TestModel\n\t\t{\n\t\t\tId = Guid.NewGuid(),\n\t\t\tAttribute" + }, + { + "title": "src/JsonPatch.Tests/PatchExtensionTests.cs (3/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/PatchExtensionTests.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/PatchExtensionTests.cs", + "startLine": 241, + "endLine": 360, + "content": "\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Name\\\",\\\"value\\\":\\\"Test4\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/Numbers/3\\\",\\\"value\\\":4},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Strings/0\\\",\\\"value\\\":\\\"test2\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/InnerObjects/0/Id\\\",\\\"value\\\":\\\"bed584b0-7ccc-4336-adba-d0d7f7c3c3f2\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/InnerObjects/0/Numbers/0\\\",\\\"value\\\":1},\" +\n\t\t\t\"{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/InnerObjects/0/Strings/2\\\",\\\"value\\\":\\\"test5\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"remove\\\",\\\"path\\\":\\\"/Attributes/4\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Attributes/3/test/1\\\",\\\"value\\\":1},\" +\n\t\t\t\"{\\\"op\\\":\\\"remove\\\",\\\"path\\\":\\\"/Attributes/0/test\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/Attributes/0/test1\\\",\\\"value\\\":\\\"test123\\\"}]\";\n\t\tvar patchExpected = JsonSerializer.Deserialize(patchExpectedStr, TestEnvironment.SerializerOptions);\n\n\t\tvar patchBackExpectedStr =\n\t\t\t\"[{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Id\\\",\\\"value\\\":\\\"aa7daced-c9fa-489b-9bc1-540b21d277a1\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Name\\\",\\\"value\\\":\\\"Test\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"remove\\\",\\\"path\\\":\\\"/Numbers/3\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Strings/0\\\",\\\"value\\\":\\\"test1\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/InnerObjects/0/Id\\\",\\\"value\\\":\\\"b2cab2a0-ec23-405a-a5a8-975448a10334\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/InnerObjects/0/Numbers/0\\\",\\\"value\\\":3},\" +\n\t\t\t\"{\\\"op\\\":\\\"remove\\\",\\\"path\\\":\\\"/InnerObjects/0/Strings/2\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"remove\\\",\\\"path\\\":\\\"/Attributes/0/test1\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/Attributes/0/test\\\",\\\"value\\\":\\\"test123\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Attributes/3/test/1\\\",\\\"value\\\":2},{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/Attributes/4\\\",\\\"value\\\":{\\\"test\\\":[1,2,3]}}]\";\n\t\tvar patchBackExpected = JsonSerializer.Deserialize(patchBackExpectedStr, TestEnvironment.SerializerOptions);\n\n\t\tvar patch = initial.CreatePatch(expected, TestEnvironment.SerializerOptions);\n\t\tvar patchBack = expected.CreatePatch(initial, TestEnvironment.SerializerOptions);\n\n\t\tVerifyPatches(patchExpected!, patch);\n\t\tVerifyPatches(patchBackExpected!, patchBack);\n\t}\n\n\t[Test]\n\tpublic void CreatePatch_ClearArray()\n\t{\n\t\tvar model = new TestModel\n\t\t{\n\t\t\tNumbers = [1, 2, 1],\n\t\t\tStrings = [\"asdf \"],\n\t\t\tInnerObjects = [new() { Id = Guid.NewGuid() }, new() { Id = Guid.NewGuid() }]\n\t\t};\n\t\tvar model2 = new TestModel\n\t\t{\n\t\t\tNumbers = [],\n\t\t\tStrings = [],\n\t\t\tInnerObjects = []\n\t\t};\n\n\t\tvar patch = model.CreatePatch(model2, TestEnvironment.SerializerOptions);\n\n\t\tvar final = patch.Apply(model, TestEnvironment.SerializerOptions);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(final!.Numbers!, Is.Empty);\n\t\t\tAssert.That(final.Strings!, Is.Empty);\n\t\t\tAssert.That(final.InnerObjects!, Is.Empty);\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void CreatePatch_OptimalAddWholeArrayPatchSize()\n\t{\n\t\tvar largeNumberArray = Enumerable.Range(start: 0, count: 100).ToArray();\n\t\tvar original = new TestModel\n\t\t{\n\t\t\tNumbers = []\n\t\t};\n\t\tvar target = new TestModel\n\t\t{\n\t\t\tNumbers = largeNumberArray\n\t\t};\n\t\tvar patch = original.CreatePatch(target, TestEnvironment.SerializerOptions);\n\t\tAssert.That(patch.Operations, Has.Count.EqualTo(1));\n\t}\n\n\t[Test]\n\tpublic void CreatePatch_RemoveArrayItem()\n\t{\n\t\tvar model = new TestModel\n\t\t{\n\t\t\tNumbers = [1, 2, 3],\n\t\t\tStrings = [\"123\", \"asdf\"],\n\t\t\tInnerObjects = [new() { Id = Guid.NewGuid() }, new() { Id = Guid.NewGuid() }]\n\t\t};\n\t\tvar model2 = new TestModel\n\t\t{\n\t\t\tNumbers = [1, 3],\n\t\t\tStrings = [\"asdf\"],\n\t\t\tInnerObjects = [model.InnerObjects[1]]\n\t\t};\n\n\t\tvar patch = model.CreatePatch(model2, TestEnvironment.SerializerOptions);\n\n\t\tvar final = patch.Apply(model, TestEnvironment.SerializerOptions);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(final!.Numbers!, Has.Length.EqualTo(2));\n\t\t\tAssert.That(final.Numbers![0], Is.EqualTo(1));\n\t\t\tAssert.That(final.Numbers[1], Is.EqualTo(3));\n\n\t\t\tAssert.That(final.Strings!, Has.Length.EqualTo(1));\n\t\t\tAssert.That(final.Strings![0], Is.EqualTo(\"asdf\"));\n\n\t\t\tAssert.That(final.InnerObjects!, Has.Count.EqualTo(1));\n\t\t\tAssert.That(final.InnerObjects![0].Id, Is.EqualTo(model.InnerObjects[1].Id));\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void ApplyPatch_Respect_SerializationOptions()\n\t{\n\t\tvar model = new TestModel\n\t\t{\n\t\t\tNumbers = [],\n\t\t};\n\n\t\tvar patchStr = \"[{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/numbers/-\\\",\\\"value\\\":5}]\";\n\t\tvar patch = JsonSerializer.Deserialize(patchStr, TestEnvironment.SerializerOptions)!;", + "snippet": "\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Name\\\",\\\"value\\\":\\\"Test4\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/Numbers/3\\\",\\\"value\\\":4},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Strings/0\\\",\\\"value\\\":\\\"test2\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace" + }, + { + "title": "src/JsonPatch.Tests/PatchExtensionTests.cs (4/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/PatchExtensionTests.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/PatchExtensionTests.cs", + "startLine": 361, + "endLine": 480, + "content": "var options = new JsonSerializerOptions\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tPropertyNamingPolicy = JsonNamingPolicy.CamelCase\n\t\t};\n\t\tvar final = patch.Apply(model, options);\n\n\t\tAssert.That(final?.Numbers?[0], Is.EqualTo(5));\n\t}\n\n\t[Test]\n\tpublic void CreatePatch_JsonContext()\n\t{\n\t\tvar initial = new TestModel\n\t\t{\n\t\t\tId = Guid.NewGuid(),\n\t\t\tAttributes = JsonNode.Parse(\"[{\\\"test\\\":\\\"test123\\\"},{\\\"test\\\":\\\"test321\\\"},{\\\"test\\\":[1,2,3]},{\\\"test\\\":[1,2,4]}]\")\n\t\t};\n\t\tvar expected = new TestModel\n\t\t{\n\t\t\tId = Guid.Parse(\"40664cc7-864f-4eed-939c-78076a252df0\"),\n\t\t\tAttributes = JsonNode.Parse(\"[{\\\"test\\\":\\\"test123\\\"},{\\\"test\\\":\\\"test32132\\\"},{\\\"test1\\\":\\\"test321\\\"},{\\\"test\\\":[1,2,3]},{\\\"test\\\":[1,2,3]}]\")\n\t\t};\n\t\tvar patchExpected = JsonNode.Parse(\n\t\t\t\"[{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Id\\\",\\\"value\\\":\\\"40664cc7-864f-4eed-939c-78076a252df0\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Attributes/1/test\\\",\\\"value\\\":\\\"test32132\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"remove\\\",\\\"path\\\":\\\"/Attributes/2/test\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/Attributes/2/test1\\\",\\\"value\\\":\\\"test321\\\"},\" +\n\t\t\t\"{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/Attributes/3/test/2\\\",\\\"value\\\":3},\" +\n\t\t\t\"{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/Attributes/4\\\",\\\"value\\\":{\\\"test\\\":[1,2,3]}}]\");\n\n\t\tvar patch = initial.CreatePatch(expected, TestEnvironment.SerializerOptions);\n\t\t// use source generated json serializer context\n\t\tvar patchJson = JsonSerializer.SerializeToNode(patch, TestEnvironment.SerializerOptions);\n\n\t\tJsonAssert.AreEquivalent(patchExpected, patchJson);\n\t}\n\n\t[Test]\n\tpublic void SlashInPropertyName()\n\t{\n\t\tvar initial = JsonNode.Parse(\"\"\"\n\t\t\t{\n\t\t\t \"spec\": {\n\t\t\t \"replicas\": 0,\n\t\t\t \"selector\": {\n\t\t\t \"matchLabels\": {\n\t\t\t \"app\": \"myapp\"\n\t\t\t }\n\t\t\t },\n\t\t\t \"template\": {\n\t\t\t \"metadata\": {\n\t\t\t \"creationTimestamp\": null,\n\t\t\t \"labels\": {\n\t\t\t \"app\": \"myapp\"\n\t\t\t },\n\t\t\t \"annotations\": {\n\t\t\t \"kubectl.kubernetes.io/restartedAt\": \"1719861246\",\n\t\t\t \"date\": \"1719861246\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\");\n\t\tvar final = JsonNode.Parse(\"\"\"\n\t\t\t{\n\t\t\t \"spec\": {\n\t\t\t \"replicas\": 0,\n\t\t\t \"selector\": {\n\t\t\t \"matchLabels\": {\n\t\t\t \"app\": \"myapp\"\n\t\t\t }\n\t\t\t },\n\t\t\t \"template\": {\n\t\t\t \"metadata\": {\n\t\t\t \"creationTimestamp\": null,\n\t\t\t \"labels\": {\n\t\t\t \"app\": \"myapp\"\n\t\t\t },\n\t\t\t \"annotations\": {\n\t\t\t \"kubectl.kubernetes.io/restartedAt\": \"\",\n\t\t\t \"date\": \"1719925004\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\");\n\t\tvar expected = JsonSerializer.Deserialize(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t {\n\t\t\t \"op\": \"replace\",\n\t\t\t \"path\": \"/spec/template/metadata/annotations/kubectl.kubernetes.io~1restartedAt\",\n\t\t\t \"value\": \"\"\n\t\t\t },\n\t\t\t {\n\t\t\t \"op\": \"replace\",\n\t\t\t \"path\": \"/spec/template/metadata/annotations/date\",\n\t\t\t \"value\": \"1719925004\"\n\t\t\t }\n\t\t\t]\n\t\t\t\"\"\",\n\t\t\tTestEnvironment.SerializerOptions\n\t\t);\n\n\t\tvar actual = initial.CreatePatch(final, TestEnvironment.SerializerOptions);\n\n\t\tVerifyPatches(expected!, actual);\n\t}\n\n\tprivate static readonly JsonSerializerOptions _indentedSerializerOptions =\n\t\tnew()\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tWriteIndented = true\n\t\t};", + "snippet": "var options = new JsonSerializerOptions\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tPropertyNamingPolicy = JsonNamingPolicy.CamelCase\n\t\t};\n\t\tvar final = patch.Apply(model, options);\n\n\t\tAssert.Tha" + }, + { + "title": "src/JsonPatch.Tests/PatchExtensionTests.cs (5/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/PatchExtensionTests.cs#L481-L494", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/PatchExtensionTests.cs", + "startLine": 481, + "endLine": 494, + "content": "private static void OutputPatch(JsonPatch patch)\n\t{\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(patch, _indentedSerializerOptions));\n\t}\n\n\tprivate static void VerifyPatches(JsonPatch expected, JsonPatch actual)\n\t{\n\t\tOutputPatch(expected);\n\t\tOutputPatch(actual);\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n}", + "snippet": "private static void OutputPatch(JsonPatch patch)\n\t{\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(patch, _indentedSerializerOptions));\n\t}\n\n\tprivate static void VerifyPatches(JsonPatch expected, JsonPatch actual)\n\t{\n\t\t" + }, + { + "title": "src/JsonPatch.Tests/SingleOpProcessingTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/SingleOpProcessingTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/SingleOpProcessingTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Patch.Tests;\n\npublic class SingleOpProcessingTests\n{\n\t[Test]\n\tpublic void Test1()\n\t{\n\t\tvar patch = JsonSerializer.Deserialize(@\"[\n { \"\"op\"\": \"\"replace\"\", \"\"path\"\": \"\"/baz\"\", \"\"value\"\": \"\"boo\"\" },\n { \"\"op\"\": \"\"add\"\", \"\"path\"\": \"\"/hello\"\", \"\"value\"\": [\"\"world\"\"] },\n { \"\"op\"\": \"\"remove\"\", \"\"path\"\": \"\"/foo\"\" }\n]\",\n\t\t\tTestEnvironment.SerializerOptions)!;\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(patch.Operations, Has.Count.EqualTo(3));\n\t\t\tAssert.That(patch.Operations[0].Op, Is.EqualTo(OperationType.Replace));\n\t\t\tAssert.That(patch.Operations[1].Op, Is.EqualTo(OperationType.Add));\n\t\t\tAssert.That(patch.Operations[2].Op, Is.EqualTo(OperationType.Remove));\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Add_Local()\n\t{\n\t\tvar patch = JsonSerializer.Deserialize(\n\t\t\t\"[{ \\\"op\\\": \\\"add\\\", \\\"path\\\": \\\"/hello\\\", \\\"value\\\": [\\\"world\\\"] }]\",\n\t\t\tTestEnvironment.SerializerOptions)!;\n\n\t\tvar element = JsonNode.Parse(\"{\\\"something\\\":\\\"added\\\"}\");\n\t\tvar expected = JsonNode.Parse(\"{\\\"something\\\":\\\"added\\\",\\\"hello\\\":[\\\"world\\\"]}\");\n\n\t\tvar actual = patch.Apply(element);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(actual.Error, Is.Null);\n\t\t\tAssert.That(expected.IsEquivalentTo(actual.Result), Is.True);\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Add_Nested()\n\t{\n\t\tvar patch = JsonSerializer.Deserialize(\n\t\t\t\"[{ \\\"op\\\": \\\"add\\\", \\\"path\\\": \\\"/inserted/hello\\\", \\\"value\\\": [\\\"world\\\"] }]\",\n\t\t\tTestEnvironment.SerializerOptions)!;\n\n\t\tvar element = JsonNode.Parse(\"{\\\"something\\\":\\\"added\\\",\\\"inserted\\\":{}}\");\n\t\tvar expected = JsonNode.Parse(\"{\\\"something\\\":\\\"added\\\",\\\"inserted\\\":{\\\"hello\\\":[\\\"world\\\"]}}\");\n\n\t\tvar actual = patch.Apply(element);\n\n\t\tTestConsole.WriteLine(actual.Result.AsJsonString());\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(actual.Error, Is.Null);\n\t\t\tAssert.That(expected.IsEquivalentTo(actual.Result), Is.True);\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Add_Nested_ReplacesValue()\n\t{\n\t\tvar patch = JsonSerializer.Deserialize(\n\t\t\t\"[{ \\\"op\\\": \\\"add\\\", \\\"path\\\": \\\"/inserted/hello\\\", \\\"value\\\": [\\\"world\\\"] }]\",\n\t\t\tTestEnvironment.SerializerOptions)!;\n\n\t\tvar element = JsonNode.Parse(\"{\\\"something\\\":\\\"added\\\",\\\"inserted\\\":{\\\"hello\\\":\\\"replace me\\\"}}\");\n\t\tvar expected = JsonNode.Parse(\"{\\\"something\\\":\\\"added\\\",\\\"inserted\\\":{\\\"hello\\\":[\\\"world\\\"]}}\");\n\n\t\tvar actual = patch.Apply(element);\n\n\t\tTestConsole.WriteLine(actual.Result.AsJsonString());\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(actual.Error, Is.Null);\n\t\t\tAssert.That(expected.IsEquivalentTo(actual.Result), Is.True);\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Add_NestedPathNotFound()\n\t{\n\t\tvar patch = JsonSerializer.Deserialize(\n\t\t\t\"[{ \\\"op\\\": \\\"add\\\", \\\"path\\\": \\\"/inserted/hello\\\", \\\"value\\\": [\\\"world\\\"] }]\",\n\t\t\tTestEnvironment.SerializerOptions)!;\n\n\t\tvar element = JsonNode.Parse(\"{\\\"something\\\":\\\"added\\\",\\\"insert here\\\":{}}\");\n\n\t\tvar actual = patch.Apply(element);\n\n\t\tTestConsole.WriteLine(actual.Result.AsJsonString());\n\n\t\tAssert.That(actual.Error, Is.EqualTo(\"Target path `/inserted/hello` could not be reached.\"));\n\t}\n\n\t[Test]\n\tpublic void Replace_Local()\n\t{\n\t\tvar patch = JsonSerializer.Deserialize(\n\t\t\t\"[{ \\\"op\\\": \\\"replace\\\", \\\"path\\\": \\\"/something\\\", \\\"value\\\": \\\"boo\\\" }]\",\n\t\t\tTestEnvironment.SerializerOptions)!;\n\n\t\tvar element = JsonNode.Parse(\"{\\\"something\\\":\\\"added\\\"}\");\n\t\tvar expected = JsonNode.Parse(\"{\\\"something\\\":\\\"boo\\\"}\");\n\n\t\tvar actual = patch.Apply(element);\n\n\t\tAssert.Multiple(() =>\n\t\t{", + "snippet": "using System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Patch.Tests;\n\npublic class SingleOpProcessingTests\n{\n\t[Test]\n\tpublic void Test1()\n\t{\n\t\tvar " + }, + { + "title": "src/JsonPatch.Tests/SingleOpProcessingTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/SingleOpProcessingTests.cs#L121-L145", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/SingleOpProcessingTests.cs", + "startLine": 121, + "endLine": 145, + "content": "Assert.That(actual.Error, Is.Null);\n\t\t\tAssert.That(expected.IsEquivalentTo(actual.Result), Is.True);\n\t\t});\n\t}\n\n\t[TestCase(0, 1, new[] { 2, 1, 3, 4 })]\n\t[TestCase(1, 0, new[] { 2, 1, 3, 4 })]\n\t[TestCase(1, 2, new[] { 1, 3, 2, 4 })]\n\t[TestCase(0, 2, new[] { 3, 1, 2, 4 })]\n\t[TestCase(1, 3, new[] { 1, 4, 2, 3 })]\n\t[TestCase(2, 3, new[] { 1, 2, 4, 3 })]\n\t[TestCase(3, 1, new[] { 1, 3, 4, 2 })]\n\tpublic void Move_Array(int to, int from, int[] expected)\n\t{\n\t\tvar patchStr = \"[{ \\\"op\\\": \\\"move\\\", \\\"path\\\": \\\"/Numbers/\" + to + \"\\\", \\\"from\\\": \\\"/Numbers/\" + from + \"\\\" }]\";\n\t\tvar patch = JsonSerializer.Deserialize(patchStr,\n\t\t\tTestEnvironment.SerializerOptions)!;\n\n\t\tvar element = new PatchExtensionTests.TestModel{ Numbers = [1, 2, 3, 4] };\n\n\t\tvar actual = patch.Apply(element, TestEnvironment.SerializerOptions);\n\n\t\tAssert.That(actual?.Numbers, Is.EqualTo(expected).AsCollection);\n\t}\n}", + "snippet": "Assert.That(actual.Error, Is.Null);\n\t\t\tAssert.That(expected.IsEquivalentTo(actual.Result), Is.True);\n\t\t});\n\t}\n\n\t[TestCase(0, 1, new[] { 2, 1, 3, 4 })]\n\t[TestCase(1, 0, new[] { 2, 1, 3, 4 })]\n\t[TestCase(1, 2, new[] { 1, 3" + }, + { + "title": "src/JsonPatch.Tests/Suite/JsonPatchTest.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/Suite/JsonPatchTest.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/Suite/JsonPatchTest.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Schema;\nusing TestHelpers;\n\n//using Json.Schema;\n// ReSharper disable ConditionIsAlwaysTrueOrFalse\n#pragma warning disable CS8618\n\nnamespace Json.Patch.Tests.Suite;\n\n[JsonConverter(typeof(JsonPatchTestJsonConverter))]\npublic class JsonPatchTest\n{\n\tpublic static readonly JsonSchema TestSchema = new JsonSchemaBuilder()\n\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t.Defs(\n\t\t\t(\"operationType\", new JsonSchemaBuilder().Enum(\n\t\t\t\t\t\"add\",\n\t\t\t\t\t\"remove\",\n\t\t\t\t\t\"replace\",\n\t\t\t\t\t\"move\",\n\t\t\t\t\t\"copy\",\n\t\t\t\t\t\"test\"\n\t\t\t\t)\n\t\t\t)\n\t\t)\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"doc\", true),\n\t\t\t(\"expected\", true),\n\t\t\t(\"patch\", new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"op\", new JsonSchemaBuilder().Ref(\"#/$defs/operationType\")),\n\t\t\t\t\t\t(\"path\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t\t\t.Format(Formats.JsonPointer)\n\t\t\t\t\t\t),\n\t\t\t\t\t\t(\"from\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t\t\t.Format(Formats.JsonPointer)\n\t\t\t\t\t\t),\n\t\t\t\t\t\t(\"value\", true)\n\t\t\t\t\t)\n\t\t\t\t\t.Required(\"op\")\n\t\t\t\t\t.OneOf(\n\t\t\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Properties((\"op\", new JsonSchemaBuilder().Const(\"add\")))\n\t\t\t\t\t\t\t.Required(\"path\", \"value\"),\n\t\t\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Properties((\"op\", new JsonSchemaBuilder().Const(\"remove\")))\n\t\t\t\t\t\t\t.Required(\"path\"),\n\t\t\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Properties((\"op\", new JsonSchemaBuilder().Const(\"replace\")))\n\t\t\t\t\t\t\t.Required(\"path\", \"value\"),\n\t\t\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Properties((\"op\", new JsonSchemaBuilder().Const(\"move\")))\n\t\t\t\t\t\t\t.Required(\"path\", \"from\"),\n\t\t\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Properties((\"op\", new JsonSchemaBuilder().Const(\"copy\")))\n\t\t\t\t\t\t\t.Required(\"path\", \"from\"),\n\t\t\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Properties((\"op\", new JsonSchemaBuilder().Const(\"test\")))\n\t\t\t\t\t\t\t.Required(\"path\", \"value\")\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t),\n\t\t\t(\"comment\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t(\"error\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t(\"disabled\", new JsonSchemaBuilder().Type(SchemaValueType.Boolean))\n\t\t);\n\n\tpublic JsonNode? Doc { get; set; }\n\tpublic JsonNode? ExpectedValue { get; set; }\n\tpublic string? Error { get; set; }\n\tpublic string? Comment { get; set; }\n\tpublic JsonPatch? Patch { get; set; }\n\tpublic bool Disabled { get; set; }\n\n\tpublic bool ExpectsError => Error != null;\n\tpublic bool HasExpectedValue { get; set; }\n}\n\npublic class JsonPatchTestJsonConverter : WeaklyTypedJsonConverter\n{\n\tinternal class Model\n\t{\n\t\t[JsonPropertyName(\"doc\")]\n\t\tpublic JsonNode? Doc { get; set; }\n\t\t[JsonPropertyName(\"expected\")]\n\t\tpublic JsonElement Expected { get; set; }\n\t\t[JsonPropertyName(\"error\")]\n\t\tpublic string? Error { get; set; }\n\t\t[JsonPropertyName(\"comment\")]\n\t\tpublic string? Comment { get; set; }\n\t\t[JsonPropertyName(\"patch\")]\n\t\tpublic JsonPatch Patch { get; set; }\n\t\t[JsonPropertyName(\"disabled\")]\n\t\tpublic bool Disabled { get; set; }\n\t}\n\n\tpublic override JsonPatchTest? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar node = JsonSerializer.Deserialize(ref reader, options);\n\n\t\ttry\n\t\t{\n\t\t\tvar results = JsonPatchTest.TestSchema.Evaluate(node, new EvaluationOptions\n\t\t\t{\n\t\t\t\tOutputFormat = OutputFormat.Hierarchical,\n\t\t\t\tRequireFormatValidation = true\n\t\t\t});\n\t\t\tif (results.IsValid)\n\t\t\t{", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Schema;\nusing TestHelpers;\n\n//using Json.Schema;\n// ReSharper disable ConditionIsAlway" + }, + { + "title": "src/JsonPatch.Tests/Suite/JsonPatchTest.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/Suite/JsonPatchTest.cs#L121-L172", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/Suite/JsonPatchTest.cs", + "startLine": 121, + "endLine": 172, + "content": "var model = node.Deserialize(options)!;\n\t\t\t\treturn new JsonPatchTest\n\t\t\t\t{\n\t\t\t\t\tDoc = model.Doc,\n\t\t\t\t\tExpectedValue = model.Expected.AsNode(),\n\t\t\t\t\tHasExpectedValue = model.Expected.ValueKind != JsonValueKind.Undefined,\n\t\t\t\t\tError = model.Error,\n\t\t\t\t\tComment = model.Comment,\n\t\t\t\t\tPatch = model.Patch,\n\t\t\t\t\tDisabled = model.Disabled\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(results, TestEnvironment.SerializerOptions));\n\t\t\treturn null;\n\t\t}\n\t\tcatch (Exception e) when(e is JsonException or ArgumentException)\n\t\t{\n\t\t\tTestConsole.WriteLine(e);\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, JsonPatchTest? value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\n\t\tif (value!.Doc != null)\n\t\t{\n\t\t\twriter.WritePropertyName(\"doc\");\n\t\t\tvalue.Doc.WriteTo(writer);\n\t\t}\n\t\tif (value.HasExpectedValue)\n\t\t{\n\t\t\twriter.WritePropertyName(\"expected\");\n\t\t\tJsonSerializer.Serialize(writer, value.ExpectedValue, options);\n\t\t}\n\t\tif (value.Error != null)\n\t\t\twriter.WriteString(\"error\", value.Error);\n\t\tif (value.Comment != null)\n\t\t\twriter.WriteString(\"comment\", value.Comment);\n\t\tif (value.Patch != null)\n\t\t{\n\t\t\twriter.WritePropertyName(\"patch\");\n\t\t\tJsonSerializer.Serialize(writer, value.Patch, options);\n\t\t}\n\t\tif (value.Disabled)\n\t\t\twriter.WriteBoolean(\"disabled\", value.Disabled);\n\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "var model = node.Deserialize(options)!;\n\t\t\t\treturn new JsonPatchTest\n\t\t\t\t{\n\t\t\t\t\tDoc = model.Doc,\n\t\t\t\t\tExpectedValue = model.Expected.AsNode(),\n\t\t\t\t\tHasExpectedValue = model.Expected.ValueKind != JsonValueKind.Unde" + }, + { + "title": "src/JsonPatch.Tests/Suite/JsonPatchTestSuite.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/Suite/JsonPatchTestSuite.cs#L1-L75", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/Suite/JsonPatchTestSuite.cs", + "startLine": 1, + "endLine": 75, + "content": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing NUnit.Framework.Internal;\nusing TestHelpers;\n\nnamespace Json.Patch.Tests.Suite;\n\n[TestFixture]\npublic class JsonPatchTestSuite\n{\n\tprivate const string _testFolder = \"../../../../../ref-repos/json-patch-tests\";\n\n\t// ReSharper disable once MemberCanBePrivate.Global\n\tpublic static IEnumerable TestData => LoadTests();\n\n\tprivate static IEnumerable LoadTests()\n\t{\n\t\tvar testsPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, _testFolder);\n\t\tvar fileNames = Directory.GetFiles(testsPath, \"*tests*.json\");\n\n\t\tforeach (var fileName in fileNames)\n\t\t{\n\t\t\tvar contents = File.ReadAllText(fileName);\n\t\t\tvar suite = JsonSerializer.Deserialize(contents, TestEnvironment.SerializerOptions)!;\n\n\t\t\tforeach (var test in suite.Where(t => t != null!))\n\t\t\t{\n\t\t\t\tvar testName = test.Comment ?? \"Unnamed test\";\n\t\t\t\tyield return new TestCaseData(fileName, test) { TestName = testName };\n\t\t\t}\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(TestData))]\n\tpublic void Run(string fileName, JsonPatchTest test)\n\t{\n\t\tvar isOptional = test.Disabled;\n\n\t\tPatchResult? result = null;\n\t\tusing (new TestExecutionContext.IsolatedContext())\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tresult = test.Patch!.Apply(test.Doc);\n\n\t\t\t\tAssert.That(result.IsSuccess, Is.Not.EqualTo(test.ExpectsError));\n\n\t\t\t\tif (test.HasExpectedValue)\n\t\t\t\t\tAssert.That(test.ExpectedValue.IsEquivalentTo(result.Result), Is.True);\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tTestConsole.WriteLine();\n\t\t\t\tTestConsole.WriteLine(fileName);\n\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(test, TestEnvironment.SerializerOptions));\n\t\t\t\tTestConsole.WriteLine(e.Message);\n\t\t\t\tTestConsole.WriteLine(e.StackTrace);\n\t\t\t\tif (result != null)\n\t\t\t\t{\n\t\t\t\t\tTestConsole.WriteLine(result.Result.AsJsonString(TestEnvironment.SerializerOptions));\n\t\t\t\t\tTestConsole.WriteLine(result.Error);\n\t\t\t\t}\n\t\t\t\tif (isOptional)\n\t\t\t\t\tAssert.Inconclusive(\"This is an acceptable failure. Test case failed, but was marked as 'disabled'.\");\n\t\t\t\tthrow;\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing NUnit.Framework.Internal;\nusing TestHelp" + }, + { + "title": "src/JsonPatch.Tests/TestEnvironment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/TestEnvironment.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/TestEnvironment.cs", + "startLine": 1, + "endLine": 18, + "content": "using System.Text.Encodings.Web;\nusing System.Text.Json;\n//using Json.Schema;\nusing NUnit.Framework;\n\nnamespace Json.Patch.Tests;\n\n[SetUpFixture]\npublic class TestEnvironment\n{\n\tpublic static readonly JsonSerializerOptions SerializerOptions =\n\t\tnew()\n\t\t\t{\n\t\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\t\tWriteIndented = true,\n\t\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t\t\t};\n}", + "snippet": "using System.Text.Encodings.Web;\nusing System.Text.Json;\n//using Json.Schema;\nusing NUnit.Framework;\n\nnamespace Json.Patch.Tests;\n\n[SetUpFixture]\npublic class TestEnvironment\n{\n\tpublic static readonly JsonSerializerOptio" + }, + { + "title": "src/JsonPatch.Tests/TestSerializerContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch.Tests/TestSerializerContext.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch.Tests/TestSerializerContext.cs", + "startLine": 1, + "endLine": 30, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Patch.Tests.Suite;\nusing Json.Schema;\n\nnamespace Json.Patch.Tests;\n\n[JsonSerializable(typeof(PatchExtensionTests.TestModel))]\n[JsonSerializable(typeof(List))]\n[JsonSerializable(typeof(List))]\n[JsonSerializable(typeof(List))]\n[JsonSerializable(typeof(JsonPatchTest))]\n[JsonSerializable(typeof(JsonPatchTestJsonConverter.Model))]\n[JsonSerializable(typeof(JsonPatchTest[]))]\n[JsonSerializable(typeof(Guid))]\n[JsonSerializable(typeof(string))]\n[JsonSerializable(typeof(string[]))]\n[JsonSerializable(typeof(int))]\n[JsonSerializable(typeof(int[]))]\n[JsonSerializable(typeof(List))]\n[JsonSerializable(typeof(JsonElement))]\n[JsonSerializable(typeof(JsonElement?))]\n[JsonSerializable(typeof(JsonNode))]\n[JsonSerializable(typeof(JsonPatch))]\n[JsonSerializable(typeof(PatchResult))]\n[JsonSerializable(typeof(EvaluationResults))]\ninternal partial class TestSerializerContext : JsonSerializerContext;", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Patch.Tests.Suite;\nusing Json.Schema;\n\nnamespace Json.Patch.Tests;\n\n[" + }, + { + "title": "src/JsonPatch/AddOperationHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/AddOperationHandler.cs#L1-L55", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/AddOperationHandler.cs", + "startLine": 1, + "endLine": 55, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.Patch;\n\ninternal class AddOperationHandler : IPatchOperationHandler\n{\n\tpublic static IPatchOperationHandler Instance { get; } = new AddOperationHandler();\n\n\tprivate AddOperationHandler()\n\t{\n\t}\n\n\tpublic void Process(PatchContext context, PatchOperation operation)\n\t{\n\t\tif (operation.Path.SegmentCount == 0)\n\t\t{\n\t\t\tcontext.Source = operation.Value;\n\t\t\treturn;\n\t\t}\n\n\t\tif (!operation.Path.EvaluateAndGetParent(context.Source, out var target))\n\t\t{\n\t\t\tcontext.Message = $\"Target path `{operation.Path}` could not be reached.\";\n\t\t\treturn;\n\t\t}\n\n\t\tvar lastPathSegment = operation.Path.GetLocal().GetSegment(0).ToString();\n\t\tif (target is JsonObject objTarget)\n\t\t{\n\t\t\tobjTarget[lastPathSegment] = operation.Value?.DeepClone();\n\t\t\treturn;\n\t\t}\n\n\t\tif (target is JsonArray arrTarget)\n\t\t{\n\t\t\tint index;\n\t\t\tif (lastPathSegment is ['-'])\n\t\t\t\tindex = arrTarget.Count;\n\t\t\telse if (!int.TryParse(lastPathSegment, out index))\n\t\t\t{\n\t\t\t\tcontext.Message = $\"Target path `{operation.Path}` could not be reached.\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (0 <= index && index < arrTarget.Count)\n\t\t\t\tarrTarget.Insert(index, operation.Value?.DeepClone());\n\t\t\telse if (index == arrTarget.Count)\n\t\t\t\tarrTarget.Add(operation.Value?.DeepClone());\n\t\t\telse\n\t\t\t\tcontext.Message = \"Path indicates an index greater than the bounds of the array\";\n\t\t\treturn;\n\t\t}\n\n\t\tcontext.Message = $\"Target path `{operation.Path}` could not be reached.\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.Patch;\n\ninternal class AddOperationHandler : IPatchOperationHandler\n{\n\tpublic static IPatchOperationHandler Instance { get; } = new AddOperationHandler();\n\n\tprivate AddOperat" + }, + { + "title": "src/JsonPatch/CopyOperationHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/CopyOperationHandler.cs#L1-L58", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/CopyOperationHandler.cs", + "startLine": 1, + "endLine": 58, + "content": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Patch;\n\ninternal class CopyOperationHandler : IPatchOperationHandler\n{\n\tpublic static IPatchOperationHandler Instance { get; } = new CopyOperationHandler();\n\n\tprivate CopyOperationHandler() { }\n\n\tpublic void Process(PatchContext context, PatchOperation operation)\n\t{\n\t\tif (Equals(operation.Path, operation.From)) return;\n\n\t\tif (!operation.From.EvaluateAndGetParent(context.Source, out _) ||\n\t\t\t!operation.From.TryEvaluate(context.Source, out var data))\n\t\t{\n\t\t\tcontext.Message = $\"Source path `{operation.Path}` could not be reached.\";\n\t\t\treturn;\n\t\t}\n\n\t\tif (!operation.Path.EvaluateAndGetParent(context.Source, out var target))\n\t\t{\n\t\t\tcontext.Message = $\"Target path `{operation.From}` could not be reached.\";\n\t\t\treturn;\n\t\t}\n\n\t\tif (operation.Path.SegmentCount == 0)\n\t\t{\n\t\t\tcontext.Source = data;\n\t\t\treturn;\n\t\t}\n\n\t\tvar lastPathSegment = operation.Path.GetLocal().GetSegment(0).ToString();\n\t\tif (target is JsonObject objTarget)\n\t\t{\n\t\t\tobjTarget[lastPathSegment] = data?.DeepClone();\n\t\t\treturn;\n\t\t}\n\n\t\tif (target is JsonArray arrTarget)\n\t\t{\n\t\t\tvar index = lastPathSegment.Length != 0 && lastPathSegment[0] == '-'\n\t\t\t\t? arrTarget.Count\n\t\t\t\t: int.TryParse(lastPathSegment, out var i)\n\t\t\t\t\t? i\n\t\t\t\t\t: throw new ArgumentException(\"Expected integer\");\n\t\t\tif (0 < index || index < arrTarget.Count)\n\t\t\t\tarrTarget.Insert(index, data?.DeepClone());\n\t\t\telse if (index == arrTarget.Count)\n\t\t\t\tarrTarget.Add(data?.DeepClone());\n\t\t\treturn;\n\t\t}\n\n\t\tcontext.Message = $\"Target path `{operation.From}` could not be reached.\";\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Patch;\n\ninternal class CopyOperationHandler : IPatchOperationHandler\n{\n\tpublic static IPatchOperationHandler Instance { get; } = new CopyOperationHandler();\n\n\tp" + }, + { + "title": "src/JsonPatch/DotnetCompatibility.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/DotnetCompatibility.cs#L1-L31", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/DotnetCompatibility.cs", + "startLine": 1, + "endLine": 31, + "content": "using System.Collections.Generic;\n\nnamespace Json.Patch;\n\n/// \n/// Provides compatibility extension methods that replicate .NET API behaviors on earlier framework versions.\n/// \n/// \n/// This class contains static extension methods that offer functionality introduced in later .NET\n/// versions, enabling codebases to use newer APIs when targeting older frameworks. Methods are conditionally included\n/// based on the target framework version and are intended to ease cross-version development and migration.\n/// \ninternal static class DotnetCompatibility\n{\n#if NETSTANDARD2_0\n\t/// \n\t/// Deconstructs a generic KeyValuePair into its Key and Value properties.\n\t/// \n\t/// \n\t/// This is useful for iterating over a generic dictionary collection.\n\t/// foreach (var (key, value) in myDictionary) { ... }\n\t/// https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2.deconstruct\n\t/// \n\tpublic static void Deconstruct(this KeyValuePair kvp, out TKey key, out TValue value)\n\t{\n\t\tkey = kvp.Key;\n\t\tvalue = kvp.Value;\n\t}\n#endif\n}", + "snippet": "using System.Collections.Generic;\n\nnamespace Json.Patch;\n\n/// \n/// Provides compatibility extension methods that replicate .NET API behaviors on earlier framework versions.\n/// \n/// \n/// This " + }, + { + "title": "src/JsonPatch/IPatchOperationHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/IPatchOperationHandler.cs#L1-L6", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/IPatchOperationHandler.cs", + "startLine": 1, + "endLine": 6, + "content": "namespace Json.Patch;\n\ninternal interface IPatchOperationHandler\n{\n\tvoid Process(PatchContext context, PatchOperation operation);\n}", + "snippet": "namespace Json.Patch;\n\ninternal interface IPatchOperationHandler\n{\n\tvoid Process(PatchContext context, PatchOperation operation);\n}" + }, + { + "title": "src/JsonPatch/JsonPatch.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/JsonPatch.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/JsonPatch.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Patch;\n\n/// \n/// Models a JSON Patch document.\n/// \n[JsonConverter(typeof(PatchJsonConverter))]\npublic class JsonPatch : IEquatable\n{\n\t/// \n\t/// Gets the collection of operations.\n\t/// \n\tpublic IReadOnlyList Operations { get; }\n\n\t/// \n\t/// Creates a new instance of the class.\n\t/// \n\t/// The collection of operations.\n\tpublic JsonPatch(params PatchOperation[] operations)\n\t{\n\t\tOperations = new ReadOnlyCollection(operations);\n\t}\n\n\t/// \n\t/// Creates a new instance of the class.\n\t/// \n\t/// The collection of operations.\n\tpublic JsonPatch(IEnumerable operations)\n\t{\n\t\tOperations = operations.ToList().AsReadOnly();\n\t}\n\n\t/// \n\t/// Creates a new instance of the class.\n\t/// \n\t/// The collection of operations.\n\tinternal JsonPatch(List operations)\n\t{\n\t\tOperations = operations.AsReadOnly();\n\t}\n\n\t/// \n\t/// Applies the patch to a JSON document.\n\t/// \n\t/// The JSON document.\n\t/// A result object containing the output JSON and a possible error message.\n\tpublic PatchResult Apply(JsonNode? source)\n\t{\n\t\tvar context = new PatchContext(source?.DeepClone());\n\n\t\tforeach (var operation in Operations)\n\t\t{\n\t\t\toperation.Handle(context);\n\t\t\tif (context.Message != null) break;\n\t\t\tcontext.Index++;\n\t\t}\n\n\t\treturn new PatchResult(context);\n\t}\n\n\t/// Indicates whether the current object is equal to another object of the same type.\n\t/// An object to compare with this object.\n\t/// true if the current object is equal to the other parameter; otherwise, false.\n\tpublic bool Equals(JsonPatch? other)\n\t{\n\t\tif (other is null) return false;\n\t\tif (ReferenceEquals(this, other)) return true;\n\t\treturn Operations.SequenceEqual(other.Operations);\n\t}\n\n\t/// Determines whether the specified object is equal to the current object.\n\t/// The object to compare with the current object.\n\t/// true if the specified object is equal to the current object; otherwise, false.\n\tpublic override bool Equals(object? obj)\n\t{\n\t\treturn Equals(obj as JsonPatch);\n\t}\n\n\t/// Serves as the default hash function.\n\t/// A hash code for the current object.\n\tpublic override int GetHashCode()\n\t{\n\t\treturn Operations.GetCollectionHashCode();\n\t}\n}\n\n/// \n/// Provides JSON conversion logic for .\n/// \npublic class PatchJsonConverter : WeaklyTypedJsonConverter\n{\n\t/// Reads and converts the JSON to type .\n\t/// The reader.\n\t/// The type to convert.\n\t/// An object that specifies serialization options to use.\n\t/// The converted value.\n\tpublic override JsonPatch Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar operations = JsonSerializer.Deserialize(ref reader, JsonPatchSerializerContext.Default.ListPatchOperation)!;\n\n\t\treturn new JsonPatch(operations);\n\t}\n\n\t/// Writes a specified value as JSON.\n\t/// The writer to write to.\n\t/// The value to convert to JSON.\n\t/// An object that specifies serialization options to use.\n\tpublic override void Write(Utf8JsonWriter writer, JsonPatch value, JsonSerializerOptions options)\n\t{\n\t\toptions.WriteList(writer, value.Operations, JsonPatchSerializerContext.Default.PatchOperation);\n\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing " + }, + { + "title": "src/JsonPatch/JsonPatch.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/JsonPatch.cs#L121-L122", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/JsonPatch.cs", + "startLine": 121, + "endLine": 122, + "content": "}", + "snippet": "}" + }, + { + "title": "src/JsonPatch/JsonPatchSerializerContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/JsonPatchSerializerContext.cs#L1-L19", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/JsonPatchSerializerContext.cs", + "startLine": 1, + "endLine": 19, + "content": "using System.Collections.Generic;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Pointer;\n\nnamespace Json.Patch;\n\n/// \n/// A serializer context for this library.\n/// \n[JsonSerializable(typeof(JsonPatch))]\n[JsonSerializable(typeof(PatchOperation))]\n[JsonSerializable(typeof(PatchOperationJsonConverter.Model))]\n[JsonSerializable(typeof(OperationType))]\n[JsonSerializable(typeof(PatchResult))]\n[JsonSerializable(typeof(JsonNode))]\n[JsonSerializable(typeof(JsonPointer))]\n[JsonSerializable(typeof(List))]\ninternal partial class JsonPatchSerializerContext : JsonSerializerContext;", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Pointer;\n\nnamespace Json.Patch;\n\n/// \n/// A serializer context for this library.\n/// \n[J" + }, + { + "title": "src/JsonPatch/MoveOperationHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/MoveOperationHandler.cs#L1-L82", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/MoveOperationHandler.cs", + "startLine": 1, + "endLine": 82, + "content": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Patch;\n\ninternal class MoveOperationHandler : IPatchOperationHandler\n{\n\tpublic static IPatchOperationHandler Instance { get; } = new MoveOperationHandler();\n\n\tprivate MoveOperationHandler() { }\n\n\tpublic void Process(PatchContext context, PatchOperation operation)\n\t{\n\t\tif (Equals(operation.Path, operation.From)) return;\n\n\t\tif (operation.Path.SegmentCount == 0)\n\t\t{\n\t\t\tcontext.Message = \"Cannot move root value.\";\n\t\t\treturn;\n\t\t}\n\n\t\tif (!operation.From.EvaluateAndGetParent(context.Source, out var source) ||\n\t\t\t!operation.From.TryEvaluate(context.Source, out var data))\n\t\t{\n\t\t\tcontext.Message = $\"Source path `{operation.Path}` could not be reached.\";\n\t\t\treturn;\n\t\t}\n\n\t\tif (!operation.Path.EvaluateAndGetParent(context.Source, out var target))\n\t\t{\n\t\t\tcontext.Message = $\"Target path `{operation.From}` could not be reached.\";\n\t\t\treturn;\n\t\t}\n\n\t\tvar lastFromSegment = operation.From.GetSegment(operation.From.SegmentCount - 1).ToString();\n\t\tif (source is JsonObject objSource)\n\t\t\tobjSource.Remove(lastFromSegment);\n\t\telse if (source is JsonArray arrSource)\n\t\t{\n\t\t\tvar index = lastFromSegment.Length != 0 && lastFromSegment[0] == '-'\n\t\t\t\t? arrSource.Count\n\t\t\t\t: int.TryParse(lastFromSegment, out var i)\n\t\t\t\t\t? i\n\t\t\t\t\t: throw new ArgumentException(\"Expected integer\");\n\t\t\tarrSource.RemoveAt(index);\n\t\t}\n\n\t\tif (operation.Path.SegmentCount == 0)\n\t\t{\n\t\t\tcontext.Source = data;\n\t\t\treturn;\n\t\t}\n\n\t\tvar lastPathSegment = operation.Path.GetSegment(operation.Path.SegmentCount - 1).ToString();\n\t\tif (target is JsonObject objTarget)\n\t\t{\n\t\t\tobjTarget[lastPathSegment] = data?.DeepClone();\n\t\t\treturn;\n\t\t}\n\n\t\tif (target is JsonArray arrTarget)\n\t\t{\n\t\t\tint index;\n\t\t\tif (lastPathSegment.Length != 0 && lastPathSegment[0] == '-')\n\t\t\t\tindex = arrTarget.Count;\n\t\t\telse if (!int.TryParse(lastPathSegment, out index))\n\t\t\t{\n\t\t\t\tcontext.Message = $\"Target path `{operation.Path}` could not be reached.\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (0 <= index && index < arrTarget.Count)\n\t\t\t\tarrTarget.Insert(index, data?.DeepClone());\n\t\t\telse if (index == arrTarget.Count)\n\t\t\t\tarrTarget.Add(data?.DeepClone());\n\t\t\telse\n\t\t\t\tcontext.Message = \"Path indicates an index greater than the bounds of the array\";\n\t\t\treturn;\n\t\t}\n\n\t\tcontext.Message = $\"Target path `{operation.Path}` could not be reached.\";\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Patch;\n\ninternal class MoveOperationHandler : IPatchOperationHandler\n{\n\tpublic static IPatchOperationHandler Instance { get; } = new MoveOperationHandler();\n\n\tp" + }, + { + "title": "src/JsonPatch/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonPatch/obj/Debug/net10.0/JsonPatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Debug/net10.0/JsonPatch.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Debug/net10.0/JsonPatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.2+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonPatch/obj/Debug/net8.0/JsonPatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Debug/net8.0/JsonPatch.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Debug/net8.0/JsonPatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.2+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonPatch/obj/Debug/net9.0/JsonPatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Debug/net9.0/JsonPatch.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Debug/net9.0/JsonPatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.2+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonPatch/obj/Debug/netstandard2.0/JsonPatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Debug/netstandard2.0/JsonPatch.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Debug/netstandard2.0/JsonPatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.2+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonPatch/obj/Release/net10.0/JsonPatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Release/net10.0/JsonPatch.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Release/net10.0/JsonPatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.2+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonPatch/obj/Release/net8.0/JsonPatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Release/net8.0/JsonPatch.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Release/net8.0/JsonPatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.2+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonPatch/obj/Release/net9.0/JsonPatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Release/net9.0/JsonPatch.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Release/net9.0/JsonPatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.2+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonPatch/obj/Release/netstandard2.0/JsonPatch.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/obj/Release/netstandard2.0/JsonPatch.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/obj/Release/netstandard2.0/JsonPatch.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Patch built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.2+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPatch.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPatch/OperationType.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/OperationType.cs#L1-L47", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/OperationType.cs", + "startLine": 1, + "endLine": 47, + "content": "using System.ComponentModel;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Patch;\n\n/// \n/// Enumerates the valid JSON Patch operation types.\n/// \n[JsonConverter(typeof(EnumStringConverter))]\npublic enum OperationType\n{\n\t/// \n\t/// Default value. Not valid.\n\t/// \n\tUnknown,\n\t/// \n\t/// Represents the `add` operation.\n\t/// \n\t[Description(\"add\")]\n\tAdd,\n\t/// \n\t/// Represents the `remove` operation.\n\t/// \n\t[Description(\"remove\")]\n\tRemove,\n\t/// \n\t/// Represents the `replace` operation.\n\t/// \n\t[Description(\"replace\")]\n\tReplace,\n\t/// \n\t/// Represents the `move` operation.\n\t/// \n\t[Description(\"move\")]\n\tMove,\n\t/// \n\t/// Represents the `copy` operation.\n\t/// \n\t[Description(\"copy\")]\n\tCopy,\n\t/// \n\t/// Represents the `test` operation.\n\t/// \n\t[Description(\"test\")]\n\tTest\n}", + "snippet": "using System.ComponentModel;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Patch;\n\n/// \n/// Enumerates the valid JSON Patch operation types.\n/// \n[JsonConverter(typeof(EnumStri" + }, + { + "title": "src/JsonPatch/PatchContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/PatchContext.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/PatchContext.cs", + "startLine": 1, + "endLine": 15, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.Patch;\n\ninternal class PatchContext\n{\n\tpublic JsonNode? Source { get; set; }\n\tpublic string? Message { get; set; }\n\tpublic int Index { get; set; }\n\n\tpublic PatchContext(JsonNode? source)\n\t{\n\t\tSource = source;\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.Patch;\n\ninternal class PatchContext\n{\n\tpublic JsonNode? Source { get; set; }\n\tpublic string? Message { get; set; }\n\tpublic int Index { get; set; }\n\n\tpublic PatchContext(JsonN" + }, + { + "title": "src/JsonPatch/PatchExtensions.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/PatchExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/PatchExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Patch;\n\n/// \n/// Provides extension methods for .\n/// \npublic static class PatchExtensions\n{\n\tprivate const string _aotMessage = \"To ensure AOT compatibility, be sure to add an IJsonTypeInfoResolver to the options resolver chain for the object type.\";\n\n\t/// \n\t/// Apply a patch to an object to transform its data.\n\t/// \n\t/// The patch\n\t/// The object\n\t/// Serializer options.\n\t/// The type of the object.\n\t/// New instance of patched object\n\t/// Thrown when the patch cannot be applied.\n\t[RequiresDynamicCode(_aotMessage)]\n\t[RequiresUnreferencedCode(_aotMessage)]\n\tpublic static T? Apply(this JsonPatch patch, T obj, JsonSerializerOptions? options = null)\n\t{\n\t\treturn Apply(patch, obj, options);\n\t}\n\n\t/// \n\t/// Apply a patch to an object to transform it to another type.\n\t/// \n\t/// The patch\n\t/// The object\n\t/// Serializer options.\n\t/// The type of the original object.\n\t/// The type of the target object.\n\t/// New instance of patched object\n\t/// Thrown when the patch cannot be applied.\n\t[RequiresDynamicCode(_aotMessage)]\n\t[RequiresUnreferencedCode(_aotMessage)]\n\tpublic static TTarget? Apply(this JsonPatch patch, TOriginal obj, JsonSerializerOptions? options = null)\n\t{\n\t\tvar node = JsonSerializer.SerializeToNode(obj, options);\n\t\tvar patchResult = patch.Apply(node);\n\t\tif (!patchResult.IsSuccess)\n\t\t\tthrow new InvalidOperationException($\"{patchResult.Error} Operation: {patchResult.Operation}\");\n\t\tvar result = patchResult.Result.Deserialize(options);\n\t\treturn result;\n\t}\n\n\t/// \n\t/// Creates a by analyzing the difference between original and target versions.\n\t/// \n\t/// The original object.\n\t/// The target object.\n\t/// Serializer options.\n\t/// The type of the original object.\n\t/// The type of target object.\n\t/// A that represents the transformation.\n\t[RequiresDynamicCode(_aotMessage)]\n\t[RequiresUnreferencedCode(_aotMessage)]\n\tpublic static JsonPatch CreatePatch(this TOriginal original, TTarget target, JsonSerializerOptions? options = null)\n\t{\n\t\tvar originalJson = JsonSerializer.SerializeToNode(original, options);\n\t\tvar targetJson = JsonSerializer.SerializeToNode(target, options);\n\n\t\treturn CreatePatch(originalJson, targetJson);\n\t}\n\n\t/// \n\t/// Create JsonPatch from difference between original and target\n\t/// \n\t/// Original object\n\t/// target object\n\t/// JsonPatch\n\t/// Only Object and Array type json object allowed\n\tpublic static JsonPatch CreatePatch(this JsonNode? original, JsonNode? target)\n\t{\n\t\tvar patch = new List();\n\t\tCreatePatch(patch, original, target, JsonPointer.Empty);\n\t\treturn new JsonPatch(patch);\n\t}\n\n\tprivate static void CreatePatch(List patch, JsonNode? original, JsonNode? target, JsonPointer path)\n\t{\n\t\tif (original is JsonObject originalObj && target is JsonObject targetObj)\n\t\t\tPatchForObject(originalObj, targetObj, patch, path);\n\t\telse if (original is JsonArray originalArr && target is JsonArray targetArr)\n\t\t\tPatchForArray(originalArr, targetArr, patch, path);\n\t\telse if (!original.IsEquivalentTo(target))\n\t\t\tpatch.Add(PatchOperation.Replace(path, target));\n\t}\n\n\tprivate static void PatchForObject(JsonObject original, JsonObject target, List patch, JsonPointer path)\n\t{\n\t\tforeach (var (key, origValue) in original)\n\t\t{\n\t\t\tif (target.TryGetPropertyValue(key, out var targetValue))\n\t\t\t{\n\t\t\t\tCreatePatch(patch, origValue, targetValue, path.Combine(key));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tpatch.Add(PatchOperation.Remove(path.Combine(key)));\n\t\t\t}\n\t\t}\n\t\tforeach (var (key, targetValue) in target)\n\t\t{\n\t\t\tif (!original.ContainsKey(key))\n\t\t\t{\n\t\t\t\tpatch.Add(PatchOperation.Add(path.Combine(key), targetValue));\n\t\t\t}\n\t\t}\n\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Patch;\n\n/// \n/// " + }, + { + "title": "src/JsonPatch/PatchExtensions.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/PatchExtensions.cs#L121-L153", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/PatchExtensions.cs", + "startLine": 121, + "endLine": 153, + "content": "private static void PatchForArray(JsonArray original, JsonArray target, List patch, JsonPointer path)\n\t{\n\t\tif (original.Count == 0 ^ target.Count == 0)\n\t\t{\n\t\t\tpatch.Add(PatchOperation.Replace(path, target));\n\t\t}\n\t\telse if (target.Count >= original.Count)\n\t\t{\n\t\t\tfor (int i = 0; i < target.Count; i++)\n\t\t\t{\n\t\t\t\tif (i < original.Count)\n\t\t\t\t{\n\t\t\t\t\tCreatePatch(patch, original[i], target[i], path.Combine(i));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tpatch.Add(PatchOperation.Add(path.Combine(i), target[i]));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Loop backwards because Remove operations cause array lengths to shrink.\n\t\t\tfor (int i = original.Count - 1; i >= 0; i--)\n\t\t\t{\n\t\t\t\tif (i < target.Count)\n\t\t\t\t{\n\t\t\t\t\tCreatePatch(patch, original[i], target[i], path.Combine(i));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tpatch.Add(PatchOperation.Remove(path.Combine(i)));\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "private static void PatchForArray(JsonArray original, JsonArray target, List patch, JsonPointer path)\n\t{\n\t\tif (original.Count == 0 ^ target.Count == 0)\n\t\t{\n\t\t\tpatch.Add(PatchOperation.Replace(path, target" + }, + { + "title": "src/JsonPatch/PatchOperation.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/PatchOperation.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/PatchOperation.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Patch;\n\n/// \n/// Represents a single JSON Patch operation.\n/// \n[JsonConverter(typeof(PatchOperationJsonConverter))]\npublic class PatchOperation : IEquatable\n{\n\tprivate readonly IPatchOperationHandler _handler;\n\n\t/// \n\t/// Gets the operation type.\n\t/// \n\tpublic OperationType Op { get; }\n\t/// \n\t/// Gets the source path.\n\t/// \n\tpublic JsonPointer From { get; }\n\t/// \n\t/// Gets the target path.\n\t/// \n\tpublic JsonPointer Path { get; }\n\t/// \n\t/// Gets the discrete value.\n\t/// \n\tpublic JsonNode? Value { get; }\n\n\tprivate PatchOperation(OperationType op, JsonPointer from, JsonPointer path, JsonNode? value, IPatchOperationHandler handler)\n\t{\n\t\t_handler = handler;\n\t\tOp = op;\n\t\tFrom = from;\n\t\tPath = path;\n\t\tValue = value?.DeepClone();\n\t}\n\n\t/// \n\t/// Creates an `add` operation.\n\t/// \n\t/// The source path.\n\t/// The value to add.\n\t/// An `add` operation.\n\tpublic static PatchOperation Add(JsonPointer path, JsonNode? value)\n\t{\n\t\treturn new PatchOperation(OperationType.Add, JsonPointer.Empty, path, value, AddOperationHandler.Instance);\n\t}\n\n\t/// \n\t/// Creates an `remove` operation.\n\t/// \n\t/// The source path.\n\t/// An `remove` operation.\n\tpublic static PatchOperation Remove(JsonPointer path)\n\t{\n\t\treturn new PatchOperation(OperationType.Remove, JsonPointer.Empty, path, default, RemoveOperationHandler.Instance);\n\t}\n\n\t/// \n\t/// Creates an `replace` operation.\n\t/// \n\t/// The source path.\n\t/// The value to add.\n\t/// An `replace` operation.\n\tpublic static PatchOperation Replace(JsonPointer path, JsonNode? value)\n\t{\n\t\treturn new PatchOperation(OperationType.Replace, JsonPointer.Empty, path, value, ReplaceOperationHandler.Instance);\n\t}\n\n\t/// \n\t/// Creates an `move` operation.\n\t/// \n\t/// The target path.\n\t/// The path to the value to move.\n\t/// An `move` operation.\n\tpublic static PatchOperation Move(JsonPointer from, JsonPointer path)\n\t{\n\t\treturn new PatchOperation(OperationType.Move, from, path, default, MoveOperationHandler.Instance);\n\t}\n\n\t/// \n\t/// Creates an `copy` operation.\n\t/// \n\t/// The target path.\n\t/// The path to the value to move.\n\t/// An `copy` operation.\n\tpublic static PatchOperation Copy(JsonPointer from, JsonPointer path)\n\t{\n\t\treturn new PatchOperation(OperationType.Copy, from, path, default, CopyOperationHandler.Instance);\n\t}\n\n\t/// \n\t/// Creates an `test` operation.\n\t/// \n\t/// The source path.\n\t/// The value to match.\n\t/// An `test` operation.\n\tpublic static PatchOperation Test(JsonPointer path, JsonNode? value)\n\t{\n\t\treturn new PatchOperation(OperationType.Test, JsonPointer.Empty, path, value, TestOperationHandler.Instance);\n\t}\n\n\tinternal void Handle(PatchContext context)\n\t{\n\t\t_handler.Process(context, this);\n\t}\n\n\t/// Indicates whether the current object is equal to another object of the same type.\n\t/// An object to compare with this object.\n\t/// true if the current object is equal to the other parameter; otherwise, false.\n\tpublic bool Equals(PatchOperation? other)\n\t{\n\t\tif (other is null) return false;", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Patch;\n\n/// \n/// Represents a single JSON Patch oper" + }, + { + "title": "src/JsonPatch/PatchOperation.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPatch/PatchOperation.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPatch/PatchOperation.cs", + "startLine": 121, + "endLine": 240, + "content": "return Op == other.Op &&\n\t\t\t From.Equals(other.From) &&\n\t\t\t Path.Equals(other.Path) &&\n\t\t\t Value.IsEquivalentTo(other.Value);\n\t}\n\n\t/// Indicates whether this instance and a specified object are equal.\n\t/// The object to compare with the current instance.\n\t/// true if obj and this instance are the same type and represent the same value; otherwise, false.\n\tpublic override bool Equals(object? obj)\n\t{\n\t\treturn Equals(obj as PatchOperation);\n\t}\n\n\t/// Returns the hash code for this instance.\n\t/// A 32-bit signed integer that is the hash code for this instance.\n\tpublic override int GetHashCode()\n\t{\n\t\tunchecked\n\t\t{\n\t\t\tvar hashCode = (int)Op;\n\t\t\thashCode = (hashCode * 397) ^ From.GetHashCode();\n\t\t\thashCode = (hashCode * 397) ^ Path.GetHashCode();\n\t\t\thashCode = (hashCode * 397) ^ (Value?.GetHashCode() ?? 0);\n\t\t\treturn hashCode;\n\t\t}\n\t}\n}\n\ninternal class PatchOperationJsonConverter : JsonConverter\n{\n\tinternal class Model\n\t{\n\t\t[JsonPropertyName(\"op\")]\n\t\tpublic OperationType Op { get; set; }\n\t\t[JsonPropertyName(\"from\")]\n\t\tpublic JsonPointer? From { get; set; }\n\t\t[JsonPropertyName(\"path\")]\n\t\tpublic JsonPointer? Path { get; set; }\n\t\t[JsonPropertyName(\"value\")]\n\t\tpublic JsonElement Value { get; set; }\n\t}\n\n\tpublic override PatchOperation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar model = options.Read(ref reader, JsonPatchSerializerContext.Default.Model)!;\n\n\t\tif (model.Path == null)\n\t\t\tthrow new JsonException($\"`{model.Op}` operation requires `path`\");\n\n\t\tswitch (model.Op)\n\t\t{\n\t\t\tcase OperationType.Add:\n\t\t\t\tif (model.Value.ValueKind == JsonValueKind.Undefined)\n\t\t\t\t\tthrow new JsonException(\"`add` operation requires `value`\");\n\t\t\t\treturn PatchOperation.Add(model.Path.Value, model.Value.AsNode());\n\t\t\tcase OperationType.Remove:\n\t\t\t\treturn PatchOperation.Remove(model.Path.Value);\n\t\t\tcase OperationType.Replace:\n\t\t\t\tif (model.Value.ValueKind == JsonValueKind.Undefined)\n\t\t\t\t\tthrow new JsonException(\"`replace` operation requires `value`\");\n\t\t\t\treturn PatchOperation.Replace(model.Path.Value, model.Value.AsNode());\n\t\t\tcase OperationType.Move:\n\t\t\t\tif (model.From == null)\n\t\t\t\t\tthrow new JsonException(\"`move` operation requires `from`\");\n\t\t\t\treturn PatchOperation.Move(model.From.Value, model.Path.Value);\n\t\t\tcase OperationType.Copy:\n\t\t\t\tif (model.From == null)\n\t\t\t\t\tthrow new JsonException(\"`copy` operation requires `from`\");\n\t\t\t\treturn PatchOperation.Copy(model.From.Value, model.Path.Value);\n\t\t\tcase OperationType.Test:\n\t\t\t\tif (model.Value.ValueKind == JsonValueKind.Undefined)\n\t\t\t\t\tthrow new JsonException(\"`test` operation requires `value`\");\n\t\t\t\treturn PatchOperation.Test(model.Path.Value, model.Value.AsNode());\n\t\t\tcase OperationType.Unknown:\n\t\t\tdefault:\n\t\t\t\tthrow new JsonException();\n\t\t}\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, PatchOperation value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\n\t\twriter.WritePropertyName(\"op\");\n\t\toptions.Write(writer, value.Op, JsonPatchSerializerContext.Default.OperationType);\n\n\t\twriter.WritePropertyName(\"path\");\n\t\toptions.Write(writer, value.Path, JsonPatchSerializerContext.Default.JsonPointer);\n\n\t\tswitch (value.Op)\n\t\t{\n\t\t\tcase OperationType.Add:\n\t\t\t\twriter.WritePropertyName(\"value\");\n\t\t\t\toptions.Write(writer, value.Value, JsonPatchSerializerContext.Default.JsonNode!);\n\t\t\t\tbreak;\n\t\t\tcase OperationType.Remove:\n\t\t\t\tbreak;\n\t\t\tcase OperationType.Replace:\n\t\t\t\twriter.WritePropertyName(\"value\");\n\t\t\t\toptions.Write(writer, value.Value, JsonPatchSerializerContext.Default.JsonNode!);\n\t\t\t\tbreak;\n\t\t\tcase OperationType.Move:\n\t\t\t\twriter.WritePropertyName(\"from\");\n\t\t\t\toptions.Write(writer, value.From, JsonPatchSerializerContext.Default.JsonPointer);\n\t\t\t\tbreak;\n\t\t\tcase OperationType.Copy:\n\t\t\t\twriter.WritePropertyName(\"from\");\n\t\t\t\toptions.Write(writer, value.From, JsonPatchSerializerContext.Default.JsonPointer);\n\t\t\t\tbreak;\n\t\t\tcase OperationType.Test:\n\t\t\t\twriter.WritePropertyName(\"value\");\n\t\t\t\toptions.Write(writer, value.Value, JsonPatchSerializerContext.Default.JsonNode!);\n\t\t\t\tbreak;\n\t\t\tcase OperationType.Unknown:\n\t\t\tdefault:\n\t\t\t\tthrow new ArgumentOutOfRangeException(\"value.Op\");\n\t\t}\n\n\t\twriter.WriteEndObject();", + "snippet": "return Op == other.Op &&\n\t\t\t From.Equals(other.From) &&\n\t\t\t Path.Equals(other.Path) &&\n\t\t\t Value.IsEquivalentTo(other.Value);\n\t}\n\n\t/// Indicates whether this instance and a specified object are equal.\n/// Results for a JSON Patch application.\n/// \npublic class PatchResult\n{\n\t/// \n\t/// Gets the resulting JSON document.\n\t/// \n\tpublic JsonNode? Result { get; }\n\t/// \n\t/// Gets any error that occurred.\n\t/// \n\tpublic string? Error { get; }\n\t/// \n\t/// Gets the last operation that was attempted.\n\t/// \n\tpublic int Operation { get; }\n\n\t/// \n\t/// Gets whether there was an error.\n\t/// \n\t#if NET5_0_OR_GREATER\n\t[System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, nameof(Error))]\n\t#endif\n\tpublic bool IsSuccess => Error == null;\n\n\tinternal PatchResult(PatchContext context)\n\t{\n\t\tResult = context.Source;\n\t\tError = context.Message;\n\t\tOperation = context.Index;\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.Patch;\n\n/// \n/// Results for a JSON Patch application.\n/// \npublic class PatchResult\n{\n\t/// \n\t/// Gets the resulting JSON document.\n\t/// 3 ]\");\n\n\t\tvar result = query.Evaluate(data);\n\n\t\tAssert.That(result.Matches!, Has.Count.EqualTo(1));\n\n\t\tdata[0] = \"sally\";\n\n\t\tAssert.That(result.Matches!, Has.Count.EqualTo(2));\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.Path.Tests;\n\npublic class DeferredExecutionTests\n{\n\t[Test]\n\tpublic void RepeatedQueryOnChangedDataSet()\n\t{\n\t\tvar data = new JsonArray(\"bob\", \"sam\", \"al" + }, + { + "title": "src/JsonPath.Tests/DevTest.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/DevTest.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/DevTest.cs", + "startLine": 1, + "endLine": 15, + "content": "using NUnit.Framework;\n\nnamespace Json.Path.Tests;\n\ninternal class DevTest\n{\n\t[Test]\n\tpublic void Test()\n\t{\n\t\t//var date = \"2023-08-07\";\n\t\t//var otherDate = \"2023-05-01\";\n\n\t\t//Assert.AreEqual(1, string.Compare(date, otherDate, StringComparison.Ordinal));\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nnamespace Json.Path.Tests;\n\ninternal class DevTest\n{\n\t[Test]\n\tpublic void Test()\n\t{\n\t\t//var date = \"2023-08-07\";\n\t\t//var otherDate = \"2023-05-01\";\n\n\t\t//Assert.AreEqual(1, string.Compare(date, othe" + }, + { + "title": "src/JsonPath.Tests/ExpressionTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/ExpressionTests.cs#L1-L116", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/ExpressionTests.cs", + "startLine": 1, + "endLine": 116, + "content": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests;\n\npublic class ExpressionTests\n{\n\t[TestCase(\"$[?(@.foo==(4+5))]\", \"[{\\\"foo\\\": 9}]\")]\n\t[TestCase(\"$[?(@.foo==2*(4+5))]\", \"[{\\\"foo\\\": 18}]\")]\n\t[TestCase(\"$[?(@.foo==2+(4+5))]\", \"[{\\\"foo\\\": 11}]\")]\n\t[TestCase(\"$[?(@.foo==2-(4+5))]\", \"[{\\\"foo\\\": -7}]\")]\n\t[TestCase(\"$[?(@.foo==2*4+5)]\", \"[{\\\"foo\\\": 13}]\")]\n\t[TestCase(\"$[?(@.foo==2+4*5)]\", \"[{\\\"foo\\\": 22}]\")]\n\tpublic void OrderOfOperations(string pathString, string expectedString)\n\t{\n\t\tvar target = JsonNode.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t {\"foo\": 9},\n\t\t\t {\"foo\": 18},\n\t\t\t {\"foo\": 11},\n\t\t\t {\"foo\": -7},\n\t\t\t {\"foo\": 13},\n\t\t\t {\"foo\": 22}\n\t\t\t]\n\t\t\t\"\"\");\n\n\t\tvar path = JsonPath.Parse(pathString, new PathParsingOptions { AllowMathOperations = true });\n\t\tvar expected = JsonNode.Parse(expectedString);\n\n\t\tvar actual = path.Evaluate(target).Matches.Select(x => x.Value).ToJsonArray();\n\n\t\tJsonAssert.AreEquivalent(expected, actual);\n\t}\n\n\tpublic class NoOpFunction : NodelistFunctionDefinition\n\t{\n\t\tpublic override string Name => \"noop\";\n\n\t\tpublic NodeList? Evaluate(NodeList? nodeList)\n\t\t{\n\t\t\treturn nodeList;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void ExpressionWithNoOpFunctionWorks()\n\t{\n\t\tFunctionRepository.RegisterNodelistFunction();\n\n\t\t// should do the same thing as $[?@.*]\n\t\tvar path = JsonPath.Parse(\"$[?noop(@.*)]\");\n\t\tvar data = JsonNode.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t {\"foo\": 9},\n\t\t\t {\"foo\": 18, \"bar\": false},\n\t\t\t {},\n\t\t\t 42,\n\t\t\t [\"yes\", \"no\", 0],\n\t\t\t true,\n\t\t\t null\n\t\t\t]\n\t\t\t\"\"\");\n\n\t\tvar expected = JsonNode.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t {\"foo\": 9},\n\t\t\t {\"foo\": 18, \"bar\": false},\n\t\t\t [\"yes\", \"no\", 0]\n\t\t\t]\n\t\t\t\"\"\");\n\n\t\tvar actual = path.Evaluate(data).Matches.Select(x => x.Value).ToJsonArray();\n\n\t\tJsonAssert.AreEquivalent(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ExpressionWithNestedNoOpFunctionWorks()\n\t{\n\t\tFunctionRepository.RegisterNodelistFunction();\n\n\t\t// should do the same thing as $[?@.*]\n\t\tvar path = JsonPath.Parse(\"$[?noop(noop(noop(@.*)))]\");\n\t\tvar data = JsonNode.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t {\"foo\": 9},\n\t\t\t {\"foo\": 18, \"bar\": false},\n\t\t\t {},\n\t\t\t 42,\n\t\t\t [\"yes\", \"no\", 0],\n\t\t\t true,\n\t\t\t null\n\t\t\t]\n\t\t\t\"\"\");\n\n\t\tvar expected = JsonNode.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t {\"foo\": 9},\n\t\t\t {\"foo\": 18, \"bar\": false},\n\t\t\t [\"yes\", \"no\", 0]\n\t\t\t]\n\t\t\t\"\"\");\n\n\t\tvar actual = path.Evaluate(data).Matches.Select(x => x.Value).ToJsonArray();\n\n\t\tJsonAssert.AreEquivalent(expected, actual);\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests;\n\npublic class ExpressionTests\n{\n\t[TestCase(\"$[?(@.foo==(4+5))]\", \"[{\\\"foo\\\": 9}]\")]\n" + }, + { + "title": "src/JsonPath.Tests/GithubTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/GithubTests.cs#L1-L111", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/GithubTests.cs", + "startLine": 1, + "endLine": 111, + "content": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests;\n\npublic class GithubTests\n{\n\t[TestCase(\"$.aggregations.data.buckets[0].grade.buckets[?(@.key==10)].doc_count\")]\n\t[TestCase(\"$.aggregations.data.buckets[0].grade.buckets[?(@.key==11)].doc_count\")]\n\t[TestCase(\"$.aggregations.data.buckets[0].grade.buckets[?(@.key==12)].doc_count\")]\n\t[TestCase(\"$.aggregations.data.buckets[0].grade.buckets[?(@.key==13)].doc_count\")]\n\t[TestCase(\"$.aggregations.data.buckets[0].grade.buckets[?(@.key==14)].doc_count\")]\n\t[TestCase(\"$.aggregations.data.buckets[0].grade.buckets[?(@.key==15)].doc_count\")]\n\t[TestCase(\"$.aggregations.data.buckets[0].grade.buckets[?(@.key==16)].doc_count\")]\n\t[TestCase(\"$.aggregations.data.buckets[0].grade.buckets[?(@.key==17)].doc_count\")]\n\t[TestCase(\"$.aggregations.data.buckets[0].grade.buckets[?(@.key==18)].doc_count\")]\n\t[TestCase(\"$.aggregations.data.buckets[0].grade.buckets[?(@.key==19)].doc_count\")]\n\tpublic void Issue150_ParseFailsWhenExpressionContainsLiteralNumberWith9(string pathText)\n\t{\n\t\tvar path = JsonPath.Parse(pathText);\n\t\tTestConsole.WriteLine(path);\n\t}\n\n\t[Test]\n\tpublic void Issue463_StringComparison()\n\t{\n\t\tvar data = new JsonArray\n\t\t(\n\t\t\t\"2023-04-23\",\n\t\t\t\"2023-06-07\",\n\t\t\t\"2023-07-08\",\n\t\t\t\"2023-08-09\",\n\t\t\t\"2023-09-10\",\n\t\t\t\"2024-01-01\"\n\t\t);\n\n\t\tvar path = JsonPath.Parse(\"$[?@ >= '2023-05-01']\");\n\t\tvar results = path.Evaluate(data);\n\n\t\tAssert.That(results.Matches!, Has.Count.EqualTo(5));\n\t}\n\n\t[Test]\n\tpublic void Issue495_TryParseEmptyString()\n\t{\n\t\tvar success = JsonPath.TryParse(string.Empty, out var path);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(success, Is.False);\n\t\t\tAssert.That(path, Is.Null);\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Issue787_DotSyntaxWithoutNameThrowsInTryParse()\n\t{\n\t\tvar pathText = \"$.\";\n\n\t\tAssert.That(JsonPath.TryParse(pathText, out _), Is.False);\n\t}\n\n\t[Test]\n\tpublic void Issue980_PathOnRightOfExpressionOperator()\n\t{\n\t\tvar jsonDocument = new JsonObject\n\t\t{\n\t\t\t[\"data\"] = new JsonArray\n\t\t\t{\n\t\t\t\tnew JsonObject\n\t\t\t\t{\n\t\t\t\t\t[\"elements\"] = new JsonArray\n\t\t\t\t\t{\n\t\t\t\t\t\tnew JsonObject\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t[\"name\"] = \"ID\",\n\t\t\t\t\t\t\t[\"value\"] = \"TestValue\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t[\"name\"] = new JsonObject\n\t\t\t{\n\t\t\t\t[\"id\"] = \"ID\"\n\t\t\t}\n\t\t};\n\n\t\tvar expectedResult = new JsonArray\n\t\t{\n\t\t\tnew JsonObject\n\t\t\t{\n\t\t\t\t[\"elements\"] = new JsonArray\n\t\t\t\t{\n\t\t\t\t\tnew JsonObject\n\t\t\t\t\t{\n\t\t\t\t\t\t[\"name\"] = \"ID\",\n\t\t\t\t\t\t[\"value\"] = \"TestValue\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tvar path = JsonPath.Parse(\"$.data[?@.elements[?@.name == $.name.id]]\");\n\t\tvar result = path.Evaluate(jsonDocument);\n\t\tvar matches = new JsonArray([.. from match in result.Matches select match.Value?.DeepClone()]);\n\t\tAssert.That(expectedResult.ToJsonString(), Is.EqualTo(matches.ToJsonString()));\n\t}\n\n}", + "snippet": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests;\n\npublic class GithubTests\n{\n\t[TestCase(\"$.aggregations.data.buckets[0].grade.buckets[?(@.key==10)].do" + }, + { + "title": "src/JsonPath.Tests/GoessnerModels.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/GoessnerModels.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/GoessnerModels.cs", + "startLine": 1, + "endLine": 32, + "content": "using System.Collections.Generic;\n\n// ReSharper disable UnusedAutoPropertyAccessor.Global\n#pragma warning disable CS8618\n\nnamespace Json.Path.Tests;\n\npublic class Repository\n{\n\tpublic Store Store { get; set; }\n}\n\npublic class Store\n{\n\tpublic IList Book { get; set; }\n\tpublic Bicycle Bicycle { get; set; }\n}\n\npublic class Bicycle\n{\n\tpublic string Color { get; set; }\n\tpublic decimal Price { get; set; }\n}\n\npublic class Book\n{\n\tpublic string Author { get; set; }\n\tpublic string Category { get; set; }\n\tpublic string Title { get; set; }\n\tpublic string Isbn { get; set; }\n\tpublic decimal Price { get; set; }\n}", + "snippet": "using System.Collections.Generic;\n\n// ReSharper disable UnusedAutoPropertyAccessor.Global\n#pragma warning disable CS8618\n\nnamespace Json.Path.Tests;\n\npublic class Repository\n{\n\tpublic Store Store { get; set; }\n}\n\npublic " + }, + { + "title": "src/JsonPath.Tests/InternalJsonParsingTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/InternalJsonParsingTests.cs#L1-L36", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/InternalJsonParsingTests.cs", + "startLine": 1, + "endLine": 36, + "content": "using System;\nusing System.Collections.Generic;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests;\n\npublic class InternalJsonParsingTests\n{\n\t[TestCaseSource(nameof(GetJson))]\n\tpublic static void Parse(string json)\n\t{\n\t\tint i = 0;\n\t\tif (!json.AsSpan().TryParseJson(ref i, out var node))\n\t\t\tAssert.Fail();\n\n\t\tTestConsole.WriteLine(node);\n\t}\n\n\tprivate static IEnumerable GetJson()\n\t{\n\t\treturn\n\t\t[\n\t\t\t\"-42\",\n\t\t\t\"1+5\",\n\t\t\t\"true\",\n\t\t\t\"false\",\n\t\t\t\"true and some more\",\n\t\t\t\"false this is different\",\n\t\t\t\"5.6/7\",\n\t\t\t\"\\\"a string\\\"; then this\",\n\t\t\t\"[null, true]; and some more\",\n\t\t\t\"{\\\"key\\\": \\\"value\\\"}, then the end\"\n\t\t];\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests;\n\npublic class InternalJsonParsingTests\n{\n\t[TestCaseSource(nameof(GetJson))]\n\tpublic static void Parse(" + }, + { + "title": "src/JsonPath.Tests/JsonPointerConversionTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/JsonPointerConversionTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/JsonPointerConversionTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing NUnit.Framework;\n\nnamespace Json.Path.Tests;\n\npublic class JsonPointerTests\n{\n\t[Test]\n\tpublic void Name()\n\t{\n\t\tvar path = JsonPath.Parse(\"$['foo']\");\n\n\t\tvar asPointer = path.AsJsonPointer();\n\n\t\tAssert.That(asPointer, Is.EqualTo(\"/foo\"));\n\t}\n\n\t[Test]\n\tpublic void Name_Shorthand()\n\t{\n\t\tvar path = JsonPath.Parse(\"$.foo\");\n\n\t\tvar asPointer = path.AsJsonPointer();\n\n\t\tAssert.That(asPointer, Is.EqualTo(\"/foo\"));\n\t}\n\n\t[Test]\n\tpublic void Index()\n\t{\n\t\tvar path = JsonPath.Parse(\"$[1]\");\n\n\t\tvar asPointer = path.AsJsonPointer();\n\n\t\tAssert.That(asPointer, Is.EqualTo(\"/1\"));\n\t}\n\n\t[Test]\n\tpublic void MultipleSegments()\n\t{\n\t\tvar path = JsonPath.Parse(\"$[1].foo\");\n\n\t\tvar asPointer = path.AsJsonPointer();\n\n\t\tAssert.That(asPointer, Is.EqualTo(\"/1/foo\"));\n\t}\n\n\t[Test]\n\tpublic void NameWithTilde()\n\t{\n\t\tvar path = JsonPath.Parse(\"$['~foo']\");\n\n\t\tvar asPointer = path.AsJsonPointer();\n\n\t\tAssert.That(asPointer, Is.EqualTo(\"/~0foo\"));\n\t}\n\n\t[Test]\n\tpublic void NameWithSlash()\n\t{\n\t\tvar path = JsonPath.Parse(\"$['/foo']\");\n\n\t\tvar asPointer = path.AsJsonPointer();\n\n\t\tAssert.That(asPointer, Is.EqualTo(\"/~1foo\"));\n\t}\n\n\t[Test]\n\tpublic void NameWithSurrogatePair()\n\t{\n\t\tvar path = JsonPath.Parse(\"$['\\\\uD834\\\\uDD1E']\");\n\n\t\tvar asPointer = path.AsJsonPointer();\n\n\t\tAssert.That(asPointer, Is.EqualTo(\"/𝄞\"));\n\t}\n\n\t[Test]\n\tpublic void Slice()\n\t{\n\t\tvar path = JsonPath.Parse(\"$[1:2]\");\n\n\t\tAssert.Throws(() => path.AsJsonPointer());\n\t}\n\n\t[Test]\n\tpublic void RecursiveDescent()\n\t{\n\t\tvar path = JsonPath.Parse(\"$..foo\");\n\n\t\tAssert.Throws(() => path.AsJsonPointer());\n\t}\n\n\t[Test]\n\tpublic void Wildcard()\n\t{\n\t\tvar path = JsonPath.Parse(\"$[*]\");\n\n\t\tAssert.Throws(() => path.AsJsonPointer());\n\t}\n\n\t[Test]\n\tpublic void Wildcard_Shorthand()\n\t{\n\t\tvar path = JsonPath.Parse(\"$.*\");\n\n\t\tAssert.Throws(() => path.AsJsonPointer());\n\t}\n\n\t[Test]\n\tpublic void MultipleSelectors()\n\t{\n\t\tvar path = JsonPath.Parse(\"$[1,'foo']\");\n\n\t\tAssert.Throws(() => path.AsJsonPointer());\n\t}\n\n\t[Test]\n\tpublic void MultipleSelectorsButSameValue_IndexFirst()\n\t{", + "snippet": "using System;\nusing NUnit.Framework;\n\nnamespace Json.Path.Tests;\n\npublic class JsonPointerTests\n{\n\t[Test]\n\tpublic void Name()\n\t{\n\t\tvar path = JsonPath.Parse(\"$['foo']\");\n\n\t\tvar asPointer = path.AsJsonPointer();\n\n\t\tAssert" + }, + { + "title": "src/JsonPath.Tests/JsonPointerConversionTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/JsonPointerConversionTests.cs#L121-L137", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/JsonPointerConversionTests.cs", + "startLine": 121, + "endLine": 137, + "content": "var path = JsonPath.Parse(\"$[1,'1']\");\n\n\t\tvar asPointer = path.AsJsonPointer();\n\n\t\tAssert.That(asPointer, Is.EqualTo(\"/1\"));\n\t}\n\n\t[Test]\n\tpublic void MultipleSelectorsButSameValue_NameFirst()\n\t{\n\t\tvar path = JsonPath.Parse(\"$['1',1]\");\n\n\t\tvar asPointer = path.AsJsonPointer();\n\n\t\tAssert.That(asPointer, Is.EqualTo(\"/1\"));\n\t}\n}", + "snippet": "var path = JsonPath.Parse(\"$[1,'1']\");\n\n\t\tvar asPointer = path.AsJsonPointer();\n\n\t\tAssert.That(asPointer, Is.EqualTo(\"/1\"));\n\t}\n\n\t[Test]\n\tpublic void MultipleSelectorsButSameValue_NameFirst()\n\t{\n\t\tvar path = JsonPath.Par" + }, + { + "title": "src/JsonPath.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonPath.Tests/obj/Debug/net10.0/JsonPath.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/obj/Debug/net10.0/JsonPath.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/obj/Debug/net10.0/JsonPath.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonPath.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonPath.Tests/obj/Debug/net8.0/JsonPath.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/obj/Debug/net8.0/JsonPath.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/obj/Debug/net8.0/JsonPath.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonPath.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonPath.Tests/obj/Debug/net9.0/JsonPath.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/obj/Debug/net9.0/JsonPath.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/obj/Debug/net9.0/JsonPath.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonPath.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonPath.Tests/obj/Release/net10.0/JsonPath.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/obj/Release/net10.0/JsonPath.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/obj/Release/net10.0/JsonPath.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPath.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonPath.Tests/obj/Release/net8.0/JsonPath.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/obj/Release/net8.0/JsonPath.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/obj/Release/net8.0/JsonPath.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPath.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonPath.Tests/obj/Release/net9.0/JsonPath.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/obj/Release/net9.0/JsonPath.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/obj/Release/net9.0/JsonPath.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPath.Tests/ParsedGoessnerTests.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/ParsedGoessnerTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/ParsedGoessnerTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing NUnit.Framework;\n\nnamespace Json.Path.Tests;\n\npublic class ParsedGoessnerTests\n{\n\tprivate readonly JsonNode _instance;\n\n\tpublic ParsedGoessnerTests()\n\t{\n\t\tvar model = new Repository\n\t\t{\n\t\t\tStore = new Store\n\t\t\t{\n\t\t\t\tBook =\n\t\t\t\t[\n\t\t\t\t\tnew Book\n\t\t\t\t\t{\n\t\t\t\t\t\tCategory = \"reference\",\n\t\t\t\t\t\tAuthor = \"Nigel Rees\",\n\t\t\t\t\t\tTitle = \"Sayings of the Century\",\n\t\t\t\t\t\tPrice = 8.95m\n\t\t\t\t\t},\n\t\t\t\t\tnew Book\n\t\t\t\t\t{\n\t\t\t\t\t\tCategory = \"fiction\",\n\t\t\t\t\t\tAuthor = \"Evelyn Waugh\",\n\t\t\t\t\t\tTitle = \"Sword of Honour\",\n\t\t\t\t\t\tPrice = 12.99m\n\t\t\t\t\t},\n\t\t\t\t\tnew Book\n\t\t\t\t\t{\n\t\t\t\t\t\tCategory = \"fiction\",\n\t\t\t\t\t\tAuthor = \"Herman Melville\",\n\t\t\t\t\t\tTitle = \"Moby Dick\",\n\t\t\t\t\t\tIsbn = \"0-553-21311-3\",\n\t\t\t\t\t\tPrice = 8.99m\n\t\t\t\t\t},\n\t\t\t\t\tnew Book\n\t\t\t\t\t{\n\t\t\t\t\t\tCategory = \"fiction\",\n\t\t\t\t\t\tAuthor = \"J. R. R. Tolkien\",\n\t\t\t\t\t\tTitle = \"The Lord of the Rings\",\n\t\t\t\t\t\tIsbn = \"0-395-19395-8\",\n\t\t\t\t\t\tPrice = 22.99m\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tBicycle = new Bicycle\n\t\t\t\t{\n\t\t\t\t\tColor = \"red\",\n\t\t\t\t\tPrice = 19.95m\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t_instance = JsonSerializer.SerializeToNode(model, new JsonSerializerOptions\n\t\t{\n\t\t\tPropertyNamingPolicy = JsonNamingPolicy.CamelCase,\n\t\t\tDefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull\n\t\t})!;\n\t}\n\n\t[Test]\n\tpublic void GrammarExample()\n\t{\n\t\tvar input = \"$.store.book[0].title\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(1));\n\t\t\tAssert.That(result.Matches![0].Value!.GetValue(), Is.EqualTo(\"Sayings of the Century\"));\n\t\t\tAssert.That(path.ToString(), Is.EqualTo(input));\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Example1()\n\t{\n\t\tvar input = \"$.store.book[*].author\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(4));\n\t\t\tAssert.That(result.Matches![0].Value!.GetValue(), Is.EqualTo(\"Nigel Rees\"));\n\t\t\tAssert.That(result.Matches[1].Value!.GetValue(), Is.EqualTo(\"Evelyn Waugh\"));\n\t\t\tAssert.That(result.Matches[2].Value!.GetValue(), Is.EqualTo(\"Herman Melville\"));\n\t\t\tAssert.That(result.Matches[3].Value!.GetValue(), Is.EqualTo(\"J. R. R. Tolkien\"));\n\t\t\tAssert.That(path.ToString(), Is.EqualTo(input));\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Example2()\n\t{\n\t\tvar input = \"$..author\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(4));\n\t\t\tAssert.That(result.Matches![0].Value!.GetValue(), Is.EqualTo(\"Nigel Rees\"));\n\t\t\tAssert.That(result.Matches[1].Value!.GetValue(), Is.EqualTo(\"Evelyn Waugh\"));\n\t\t\tAssert.That(result.Matches[2].Value!.GetValue(), Is.EqualTo(\"Herman Melville\"));\n\t\t\tAssert.That(result.Matches[3].Value!.GetValue(), Is.EqualTo(\"J. R. R. Tolkien\"));\n\t\t\tAssert.That(path.ToString(), Is.EqualTo(input));", + "snippet": "using System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing NUnit.Framework;\n\nnamespace Json.Path.Tests;\n\npublic class ParsedGoessnerTests\n{\n\tprivate readonly JsonNo" + }, + { + "title": "src/JsonPath.Tests/ParsedGoessnerTests.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/ParsedGoessnerTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/ParsedGoessnerTests.cs", + "startLine": 121, + "endLine": 240, + "content": "});\n\t}\n\n\t[Test]\n\tpublic void Example3()\n\t{\n\t\tvar input = \"$.store.*\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(2));\n\t\t\tAssert.That(result.Matches![0].Value!.AsArray(), Has.Count.EqualTo(4));\n\t\t\tAssert.That(result.Matches[1].Value!.AsObject(), Has.Count.EqualTo(2));\n\t\t\tAssert.That(path.ToString(), Is.EqualTo(input));\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Example4()\n\t{\n\t\tvar input = \"$.store..price\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(5));\n\t\t\tAssert.That(result.Matches![0].Value!.AsValue().GetNumber(), Is.EqualTo(8.95m));\n\t\t\tAssert.That(result.Matches[1].Value!.AsValue().GetNumber(), Is.EqualTo(12.99m));\n\t\t\tAssert.That(result.Matches[2].Value!.AsValue().GetNumber(), Is.EqualTo(8.99m));\n\t\t\tAssert.That(result.Matches[3].Value!.AsValue().GetNumber(), Is.EqualTo(22.99m));\n\t\t\tAssert.That(result.Matches[4].Value!.AsValue().GetNumber(), Is.EqualTo(19.95m));\n\t\t\tAssert.That(path.ToString(), Is.EqualTo(input));\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Example5()\n\t{\n\t\tvar input = \"$..book[2]\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(1));\n\t\t\tAssert.That(result.Matches![0].Value![\"title\"]!.GetValue(), Is.EqualTo(\"Moby Dick\"));\n\t\t\tAssert.That(path.ToString(), Is.EqualTo(input));\n\t\t});\n\t}\n\n\t[Test]\n\t[Ignore(\"This syntax is no longer valid\")]\n\tpublic void Example6A()\n\t{\n\t\tvar input = \"$..book[(@.length-1)]\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(1));\n\t\t\tAssert.That(result.Matches![0].Value![\"title\"]!.GetValue(), Is.EqualTo(\"The Lord of the Rings\"));\n\t\t\tAssert.That(path.ToString(), Is.EqualTo(input));\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Example6B()\n\t{\n\t\tvar input = \"$..book[-1:]\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(1));\n\t\t\tAssert.That(result.Matches![0].Value![\"title\"]!.GetValue(), Is.EqualTo(\"The Lord of the Rings\"));\n\t\t\tAssert.That(path.ToString(), Is.EqualTo(input));\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Example7A()\n\t{\n\t\tvar input = \"$..book[0,1]\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(2));\n\t\t\tAssert.That(result.Matches![0].Value![\"title\"]!.GetValue(), Is.EqualTo(\"Sayings of the Century\"));\n\t\t\tAssert.That(result.Matches[1].Value![\"title\"]!.GetValue(), Is.EqualTo(\"Sword of Honour\"));\n\t\t\tAssert.That(path.ToString(), Is.EqualTo(input));\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Example7B()\n\t{\n\t\tvar input = \"$..book[:2]\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);", + "snippet": "});\n\t}\n\n\t[Test]\n\tpublic void Example3()\n\t{\n\t\tvar input = \"$.store.*\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t" + }, + { + "title": "src/JsonPath.Tests/ParsedGoessnerTests.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/ParsedGoessnerTests.cs#L241-L304", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/ParsedGoessnerTests.cs", + "startLine": 241, + "endLine": 304, + "content": "Assert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(2));\n\t\t\tAssert.That(result.Matches![0].Value![\"title\"]!.GetValue(), Is.EqualTo(\"Sayings of the Century\"));\n\t\t\tAssert.That(result.Matches[1].Value![\"title\"]!.GetValue(), Is.EqualTo(\"Sword of Honour\"));\n\t\t\tAssert.That(path.ToString(), Is.EqualTo(input));\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Example8()\n\t{\n\t\tvar input = \"$..book[?(@.isbn)]\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(2));\n\t\t\tAssert.That(result.Matches![0].Value![\"title\"]!.GetValue(), Is.EqualTo(\"Moby Dick\"));\n\t\t\tAssert.That(result.Matches[1].Value![\"title\"]!.GetValue(), Is.EqualTo(\"The Lord of the Rings\"));\n\t\t\t// the parens have been deemed unnecessary now.\n\t\t\t//Assert.AreEqual(input, path.ToString());\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Example9()\n\t{\n\t\tvar input = \"$..book[?(@.price<10)]\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(2));\n\t\t\tAssert.That(result.Matches![0].Value![\"title\"]!.GetValue(), Is.EqualTo(\"Sayings of the Century\"));\n\t\t\tAssert.That(result.Matches[1].Value![\"title\"]!.GetValue(), Is.EqualTo(\"Moby Dick\"));\n\t\t\t// the parens have been deemed unnecessary now.\n\t\t\t//Assert.That(path.ToString(), Is.EqualTo(input));\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void Example10()\n\t{\n\t\tvar input = \"$..*\";\n\t\tvar path = JsonPath.Parse(input);\n\n\t\tvar result = path.Evaluate(_instance);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(27));\n\t\t\tAssert.That(path.ToString(), Is.EqualTo(input));\n\t\t});\n\t}\n}", + "snippet": "Assert.Multiple(() =>\n\t\t{\n\t\t\t//Assert.That(result.Error, Is.Null);\n\t\t\tAssert.That(result.Matches!, Has.Count.EqualTo(2));\n\t\t\tAssert.That(result.Matches![0].Value![\"title\"]!.GetValue(), Is.EqualTo(\"Sayings of the " + }, + { + "title": "src/JsonPath.Tests/ParsingTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/ParsingTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/ParsingTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests;\n\npublic class ParsingTests\n{\n\tpublic static IEnumerable SuccessCases =>\n\t\t[\n\t\t\tnew(\"$['foo']\"),\n\t\t\tnew(\"$[ 'foo']\"),\n\t\t\tnew(\"$['foo' ]\"),\n\n\t\t\tnew(\"$[1]\"),\n\t\t\tnew(\"$[ 1]\"),\n\t\t\tnew(\"$[1 ]\"),\n\t\t\tnew(\"$[42]\"),\n\t\t\tnew(\"$[-1]\"),\n\t\t\tnew(\"$[-42]\"),\n\n\t\t\tnew(\"$[*]\"),\n\t\t\tnew(\"$[ *]\"),\n\t\t\tnew(\"$[* ]\"),\n\n\t\t\tnew(\"$[:]\"),\n\t\t\tnew(\"$[1:]\"),\n\t\t\tnew(\"$[1::]\"),\n\t\t\tnew(\"$[1:2]\"),\n\t\t\tnew(\"$[1:2:]\"),\n\t\t\tnew(\"$[1::3]\"),\n\t\t\tnew(\"$[1:2:3]\"),\n\t\t\tnew(\"$[-1:2:3]\"),\n\t\t\tnew(\"$[1:-2:3]\"),\n\t\t\tnew(\"$[1:2:-3]\"),\n\t\t\tnew(\"$[ 1:2:3]\"),\n\t\t\tnew(\"$[1 :2:3]\"),\n\t\t\tnew(\"$[1: 2:3]\"),\n\t\t\tnew(\"$[1:2 :3]\"),\n\t\t\tnew(\"$[1:2: 3]\"),\n\t\t\tnew(\"$[1:2:3 ]\"),\n\n\t\t\tnew(\"$.foo\"),\n\n\t\t\tnew(\"$.*\"),\n\n\t\t\tnew(\"$..foo\"),\n\t\t\tnew(\"$..*\"),\n\t\t\tnew(\"$..[1]\"),\n\t\t\tnew(\"$..[1,2]\"),\n\n\t\t\tnew(\"$[?@.foo]\"),\n\t\t\tnew(\"$[?(@.foo)]\"),\n\t\t\tnew(\"$[?(@.foo && @.bar)]\"),\n\t\t\tnew(\"$[?(@.foo && @.bar || @.baz)]\"),\n\t\t\tnew(\"$[?(@.foo || @.bar && @.baz)]\"),\n\t\t\tnew(\"$[?(!@.foo)]\"),\n\t\t\tnew(\"$[?(@.foo && !@.bar)]\"),\n\t\t\tnew(\"$[?!(@.foo == false)]\"),\n\t\t\tnew(\"$[?(@.foo == false)]\"),\n\t\t\tnew(\"$[?(@['name'] == null || @['name'] == 'abc')]\"),\n\n\t\t\tnew(\"$[1,'foo',1:2:3,*]\"),\n\t\t];\n\n\t[TestCaseSource(nameof(SuccessCases))]\n\tpublic void ParseSuccess(string path)\n\t{\n\t\tTestConsole.WriteLine(JsonPath.Parse(path));\n\t}\n\n\tpublic static IEnumerable OptionalMathCases =>\n\t\t[\n\t\t\tnew(\"$[?(@.foo==(4+5))]\"),\n\t\t\tnew(\"$[?(@.foo==2*(4+5))]\"),\n\t\t\tnew(\"$[?(@.foo==2+(4+5))]\"),\n\t\t\tnew(\"$[?(@.foo==2-(4+5))]\"),\n\t\t\tnew(\"$[?(@.foo==2*4+5)]\"),\n\t\t\tnew(\"$[?((4+5)==@.foo)]\"),\n\t\t\tnew(\"$[?(2*(4+5)==@.foo)]\"),\n\t\t\tnew(\"$[?(2+(4+5)==@.foo)]\"),\n\t\t\tnew(\"$[?(2-(4+5)==@.foo)]\"),\n\t\t\tnew(\"$[?(2*4+5==@.foo)]\"),\n\t\t\tnew(\"$[?@.foo==(4+5)]\"),\n\t\t\tnew(\"$[?@.foo==2*(4+5)]\"),\n\t\t\tnew(\"$[?@.foo==2+(4+5)]\"),\n\t\t\tnew(\"$[?@.foo==2-(4+5)]\"),\n\t\t\tnew(\"$[?@.foo==2*4+5]\"),\n\t\t\tnew(\"$[?(4+5)==@.foo]\"),\n\t\t\tnew(\"$[?2*(4+5)==@.foo]\"),\n\t\t\tnew(\"$[?2+(4+5)==@.foo]\"),\n\t\t\tnew(\"$[?2-(4+5)==@.foo]\"),\n\t\t\tnew(\"$[?2*4+5==@.foo]\"),\n\t\t];\n\n\t[TestCaseSource(nameof(OptionalMathCases))]\n\tpublic void ParseMathWithOptions(string path)\n\t{\n\t\tTestConsole.WriteLine(JsonPath.Parse(path, new PathParsingOptions{AllowMathOperations = true}));\n\t}\n\n\t[TestCaseSource(nameof(OptionalMathCases))]\n\tpublic void ParseMathWithoutOptions(string path)\n\t{\n\t\tAssert.Throws(() => JsonPath.Parse(path));\n\t}\n\n\tpublic static IEnumerable OptionalJsonLiteralCases =>\n\t\t[\n\t\t\tnew(\"$[?@.foo==[1,2,3]]\"),\n\t\t\tnew(\"$[?@.foo=={\\\"bar\\\":\\\"object\\\"}]\"),\n\t\t];\n\n\t[TestCaseSource(nameof(OptionalJsonLiteralCases))]\n\tpublic void ParseLiteralWithOptions(string path)\n\t{\n\t\tTestConsole.WriteLine(JsonPath.Parse(path, new PathParsingOptions{AllowJsonConstructs = true}));\n\t}\n\n\t[TestCaseSource(nameof(OptionalJsonLiteralCases))]", + "snippet": "using System.Collections.Generic;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests;\n\npublic class ParsingTests\n{\n\tpublic static IEnumerable SuccessCases =>\n\t\t[\n\t\t\tnew(\"$['foo']\"),\n\t\t\tnew" + }, + { + "title": "src/JsonPath.Tests/ParsingTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/ParsingTests.cs#L121-L156", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/ParsingTests.cs", + "startLine": 121, + "endLine": 156, + "content": "public void ParseLiteralWithoutOptions(string path)\n\t{\n\t\tAssert.Throws(() => JsonPath.Parse(path));\n\t}\n\n\tpublic static IEnumerable OptionalInOpCases =>\n\t\t[\n\t\t\tnew(\"$[?5 in @.foo]\"),\n\t\t];\n\n\t[TestCaseSource(nameof(OptionalInOpCases))]\n\tpublic void ParseInOpWithOptions(string path)\n\t{\n\t\tTestConsole.WriteLine(JsonPath.Parse(path, new PathParsingOptions{AllowInOperator = true}));\n\t}\n\n\t[TestCaseSource(nameof(OptionalInOpCases))]\n\tpublic void ParseInOpWithoutOptions(string path)\n\t{\n\t\tAssert.Throws(() => JsonPath.Parse(path));\n\t}\n\n\t[TestCaseSource(nameof(SuccessCases))]\n\tpublic void ParseRelativeStarts(string path)\n\t{\n\t\tpath = $\"@{path[1..]}\"; // Turn the absolute path into a relative path\n\t\tAssert.DoesNotThrow(() => JsonPath.Parse(path, new PathParsingOptions(){AllowRelativePathStart = true}));\n\t}\n\n\t[TestCaseSource(nameof(SuccessCases))]\n\tpublic void TryParseRelativeStarts(string path)\n\t{\n\t\tpath = $\"@{path[1..]}\"; // Turn the absolute path into a relative path\n\t\tAssert.That(JsonPath.TryParse(path, out _, new PathParsingOptions(){AllowRelativePathStart = true}));\n\t}\n}", + "snippet": "public void ParseLiteralWithoutOptions(string path)\n\t{\n\t\tAssert.Throws(() => JsonPath.Parse(path));\n\t}\n\n\tpublic static IEnumerable OptionalInOpCases =>\n\t\t[\n\t\t\tnew(\"$[?5 in @.foo]\"),\n\t\t];" + }, + { + "title": "src/JsonPath.Tests/ReferenceResolutionTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/ReferenceResolutionTests.cs#L1-L50", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/ReferenceResolutionTests.cs", + "startLine": 1, + "endLine": 50, + "content": "namespace Json.Path.Tests;\n\n//public class ReferenceResolutionTests\n//{\n//\t[Test]\n//\tpublic void ProblemStatementExample()\n//\t{\n//#pragma warning disable 1998\n//\t\tvar options = new PathEvaluationOptions\n//\t\t{\n//\t\t\tExperimentalFeatures =\n//\t\t\t{\n//\t\t\t\tProcessDataReferences = true,\n//\t\t\t\tDataReferenceDownload = async uri =>\n//\t\t\t\t\turi.OriginalString == \"http://example.com/11\"\n//\t\t\t\t\t\t? JsonDocument.Parse(\"{ \\\"c\\\": { \\\"d\\\": \\\"Hello\\\" } }\")\n//\t\t\t\t\t\t: null\n//\t\t\t}\n//\t\t};\n//#pragma warning restore 1998\n\n//\t\tusing var instance = JsonDocument.Parse(\"{ \\\"a\\\": { \\\"b\\\": {\\\"$ref\\\": \\\"http://example.com/11\\\" } } }\");\n//\t\tvar path = JsonPath.Parse(\"$.a.b.c.d\");\n//\t\tvar results = path.Evaluate(instance.RootElement, options);\n\n//\t\tAssert.AreEqual(1, results.Matches.Count);\n//\t\tAssert.AreEqual(\"Hello\", results.Matches[0].Value.GetString());\n//\t}\n\n//\t[Test]\n//\tpublic void NoResolutionWhen()\n//\t{\n//#pragma warning disable 1998\n//\t\tvar options = new PathEvaluationOptions\n//\t\t{\n//\t\t\tExperimentalFeatures =\n//\t\t\t{\n//\t\t\t\tProcessDataReferences = false,\n//\t\t\t\tDataReferenceDownload = async uri => throw new Exception(\"should not be called\")\n//\t\t\t}\n//\t\t};\n//#pragma warning restore 1998\n\n//\t\tusing var instance = JsonDocument.Parse(\"{ \\\"a\\\": { \\\"b\\\": {\\\"$ref\\\": \\\"http://example.com/11\\\" } } }\");\n//\t\tvar path = JsonPath.Parse(\"$.a.b.c.d\");\n//\t\tvar results = path.Evaluate(instance.RootElement, options);\n\n//\t\tAssert.AreEqual(0, results.Matches.Count);\n//\t}\n//}", + "snippet": "namespace Json.Path.Tests;\n\n//public class ReferenceResolutionTests\n//{\n//\t[Test]\n//\tpublic void ProblemStatementExample()\n//\t{\n//#pragma warning disable 1998\n//\t\tvar options = new PathEvaluationOptions\n//\t\t{\n//\t\t\tExperi" + }, + { + "title": "src/JsonPath.Tests/SerializerOptions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/SerializerOptions.cs#L1-L14", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/SerializerOptions.cs", + "startLine": 1, + "endLine": 14, + "content": "using System.Text.Encodings.Web;\nusing System.Text.Json;\n\nnamespace Json.Path.Tests;\n\npublic static class SerializerOptions\n{\n\tpublic static readonly JsonSerializerOptions Default = new()\n\t{\n\t\tAllowTrailingCommas = true,\n\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\tPropertyNameCaseInsensitive = true\n\t};\n}", + "snippet": "using System.Text.Encodings.Web;\nusing System.Text.Json;\n\nnamespace Json.Path.Tests;\n\npublic static class SerializerOptions\n{\n\tpublic static readonly JsonSerializerOptions Default = new()\n\t{\n\t\tAllowTrailingCommas = true," + }, + { + "title": "src/JsonPath.Tests/StackOverflowTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/StackOverflowTests.cs#L1-L49", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/StackOverflowTests.cs", + "startLine": 1, + "endLine": 49, + "content": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.Path.Tests;\n\npublic class StackOverflowTests\n{\n\t// https://stackoverflow.com/q/71692141/878701\n\t[Test]\n\tpublic void Question71692141()\n\t{\n\t\tvar data = JsonNode.Parse(@\"{\n \"\"type\"\": \"\"object\"\",\n \"\"properties\"\": {\n \"\"period\"\": {\n \"\"description\"\": \"\"The period in which the rule applies\"\",\n \"\"type\"\": \"\"object\"\",\n \"\"properties\"\": {\n \"\"start\"\": {\n \"\"type\"\": \"\"string\"\",\n \"\"format\"\": \"\"date-time\"\"\n },\n \"\"end\"\": {\n \"\"type\"\": \"\"string\"\",\n \"\"format\"\": \"\"date-time\"\"\n }\n },\n \"\"required\"\": [\n \"\"start\"\"\n ],\n \"\"x-updateIndicatorProperties\"\": [\n \"\"start\"\"\n ]\n },\n \"\"productType\"\": {\n \"\"type\"\": \"\"string\"\"\n },\n \"\"x-updateIndicatorProperties\"\": [\n \"\"productType\"\"\n ]\n }\n}\");\n\t\tvar path = JsonPath.Parse(\"$..['x-updateIndicatorProperties']\");\n\n\t\tvar results = path.Evaluate(data);\n\n\t\tAssert.That(results.Matches!, Has.Count.EqualTo(2));\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.Path.Tests;\n\npublic class StackOverflowTests\n{\n\t// https://stackoverflow.com/q/71692141/878701\n\t[Test]\n\tpublic void Question71692141()\n\t{\n\t\tvar data = " + }, + { + "title": "src/JsonPath.Tests/StringifyTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/StringifyTests.cs#L1-L57", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/StringifyTests.cs", + "startLine": 1, + "endLine": 57, + "content": "using System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests;\n\npublic class StringifyTests\n{\n\tprivate static readonly PathParsingOptions _options = new()\n\t{\n\t\tAllowInOperator = true,\n\t\tAllowJsonConstructs = true,\n\t\tAllowMathOperations = true,\n\t\tAllowRelativePathStart = true,\n\t\tTolerateExtraWhitespace = true\n\t};\n\n\tpublic static void AssertStringify(string pathText, JsonNode? data, PathParsingOptions? options = null)\n\t{\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(\"Original Path: {0}\", pathText);\n\t\tif (!JsonPath.TryParse(pathText, out var path, options))\n\t\t\tAssert.Inconclusive(\"Cannot parse original string\");\n\t\tvar originalResult = path.Evaluate(data);\n\n\t\tvar backToString = path.ToString();\n\t\tTestConsole.WriteLine(\"New Path: {0}\", backToString);\n\t\tif (!JsonPath.TryParse(backToString, out var newPath, options))\n\t\t\tAssert.Inconclusive(\"Stringified semantics do not match original string\");\n\n\t\tvar newResult = newPath.Evaluate(data);\n\t\tTestConsole.WriteLine(\"Original Result: {0}\", JsonSerializer.Serialize(originalResult.Matches.Select(x => x.Value)));\n\t\tTestConsole.WriteLine(\"New Result: {0}\", JsonSerializer.Serialize(newResult.Matches.Select(x => x.Value)));\n\n\t\tif (originalResult.Matches.Count != newResult.Matches.Count)\n\t\t\tAssert.Inconclusive(\"Stringified semantics do not match original string\");\n\n\t\tforeach (var (o, n) in originalResult.Matches.Zip(newResult.Matches, (x, y) => (x, y)))\n\t\t{\n\t\t\tif (!o.Value.IsEquivalentTo(n.Value))\n\t\t\t\tAssert.Inconclusive(\"Stringified semantics do not match original string\");\n\t\t}\n\t}\n\n\t[TestCase(\"$[?@ in [42, 43, 44]]\", \"[1, 2, 43, 54, 69]\")]\n\t[TestCase(\"$[?@ + 6 == 0]\", \"[1, -2, \\\"-6\\\", -6, 69]\")]\n\t[TestCase(\"$[?(@ + 6) * 2 == 0]\", \"[1, -2, \\\"-12\\\", -12, 69]\")]\n\tpublic void InExpression(string pathText, string dataText)\n\t{\n\t\tvar data = JsonNode.Parse(dataText);\n\n\t\tAssertStringify(pathText, data, _options);\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests;\n\npublic class StringifyTests\n{\n\tprivate static readonly Path" + }, + { + "title": "src/JsonPath.Tests/Suite/CburgmerFeatureValidationTests.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/Suite/CburgmerFeatureValidationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/Suite/CburgmerFeatureValidationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests.Suite;\n\n/// \n/// These are a set of tests that GitHub user cburgmer uses to check all JSON Path implementations\n/// for feature support. Adding the suite here ensures that I support them all.\n/// \n/// This is from cburgmer's amazing reporting site: https://cburgmer.github.io/json-path-comparison/\npublic class CburgmerFeatureValidationTests\n{\n\tprivate const string _regressionResultsFile = @\"../../../../../ref-repos/json-path-comparison/regression_suite/regression_suite.yaml\";\n\tprivate static readonly Regex _idPattern = new(@\" - id: (?.*)\");\n\tprivate static readonly Regex _selectorPattern = new(@\" selector: (?.*)\");\n\tprivate static readonly Regex _documentPattern = new(@\" document: (?.*)\");\n\tprivate static readonly Regex _consensusPattern = new(@\" consensus: (?.*)\");\n\tprivate static readonly string[] _notSupported =\n\t[\n\t\t// dashes are not allowed in shorthand property names\n\t\t\"$.key-dash\",\n\t\t\"$[?(@.key-dash == 'value')]\",\n\n\t\t// shorthand property names must start with a letter\n\t\t\"$.2\",\n\t\t\"$[?(@.2 == 'second')]\",\n\t\t\"$[?(@.2 == 'third')]\",\n\t\t\"$.-1\",\n\t\t\"$.$\",\n\t\t\"$.'key'\",\n\t\t\"$.\\\"key\\\"\",\n\t\t\"$..\\\"key\\\"\",\n\t\t\"$..'key'\",\n\t\t\"$..'key'\",\n\t\t\"$.'some.key'\",\n\n\t\t// leading zeroes are not allowed for numeric literals\n\t\t\"$[?(@.key==010)]\",\n\t\t\"$[010:024:010]\",\n\n\t\t// JSON literals are not expression results\n\t\t\"$[?(@.key>0 && false)]\",\n\t\t\"$[?(@.key>0 && true)]\",\n\t\t\"$[?(@.key>0 || false)]\",\n\t\t\"$[?(@.key>0 || true)]\",\n\t\t\"$[?((@.key<44)==false)]\",\n\t\t\"$[?(true)]\",\n\t\t\"$[?(false)]\",\n\t\t\"$[?(null)]\",\n\n\t\t// trailing whitespace is disallowed\n\t\t\"$. a \",\n\n\t\t// regex operator transitioned to functions\n\t\t\"$[?(@.name=~/hello.*/)]\",\n\t\t\"$[?(@.name=~/@.pattern/)]\",\n\n\t\t// functions are only valid in expressions\n\t\t// and are not extensions on paths\n\t\t\"$.data.sum()\",\n\t\t\"$[?(@.length() == 4)]\",\n\n\t\t// relative paths were excluded\n\t\t\"@.a\",\n\n\t\t// 'in' operator was excluded\n\t\t\"$[?(@.d in [2, 3])]\",\n\t\t\"$[?(2 in @.d)]\",\n\n\t\t// only literals are supported in expressions\n\t\t\"$[?(@.d==['v1','v2'])]\",\n\t\t\"$[?(!(@.d==[\\\"v1\\\",\\\"v2\\\"]) || (@.d == true))]\",\n\n\t\t// only singular paths are allowed in comparisons\n\t\t\"$[?(@[0:1]==[1])]\", // also array literals are disallowed\n\t\t\"$[?(@.*==[1,2])]\", // also array literals are disallowed\n\t\t\"$[?(@[0:1]==1)]\",\n\t\t\"$[?(@[*]==2)]\",\n\t\t\"$[?(@.*==2)]\",\n\t\t\"$[?(@[*]>=4)]\",\n\t\t\"$.x[?(@[*]>=$.y[*])]\",\n\n\t\t// other invalid syntaxes\n\t\t\"$...key\",\n\t\t\"$.['key']\",\n\t\t\"$.[\\\"key\\\"]\",\n\t\t\"$..\",\n\t\t\"$.key..\",\n\t\t\".key\",\n\t\t\"key\",\n\t\t\"\",\n\t\t\"$[?(@.key===42)]\",\n\n\t\t// big numbers not supported\n\t\t\"$[2:-113667776004:-1]\",\n\t\t\"$[113667776004:2:-1]\",\n\t];\n\n\tprivate static readonly JsonSerializerOptions _serializerOptions = new()\n\t{\n\t\tWriteIndented = true,\n\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t};\n\tprivate static readonly JsonSerializerOptions _linearSerializerOptions = new()\n\t{\n\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t};", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Regul" + }, + { + "title": "src/JsonPath.Tests/Suite/CburgmerFeatureValidationTests.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/Suite/CburgmerFeatureValidationTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/Suite/CburgmerFeatureValidationTests.cs", + "startLine": 121, + "endLine": 240, + "content": "private static readonly PathParsingOptions _parsingOptions = new()\n\t{\n\t\tAllowMathOperations = true,\n\t\tAllowRelativePathStart = true,\n\t\tAllowJsonConstructs = true,\n\t\tTolerateExtraWhitespace = true,\n\t\tAllowInOperator = true\n\t};\n\n\t// - id: array_index\n\t// pathSegment: $[2]\n\t// document: [\"first\", \"second\", \"third\", \"forth\", \"fifth\"]\n\t// consensus: [\"third\"]\n\t// scalar-consensus: \"third\"\n\tpublic static IEnumerable TestCases\n\t{\n\t\tget\n\t\t{\n\t\t\tstatic bool TryMatch(string line, Regex pattern, out string? value)\n\t\t\t{\n\t\t\t\tvar match = pattern.Match(line);\n\t\t\t\tif (!match.Success)\n\t\t\t\t{\n\t\t\t\t\tvalue = null;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tvalue = match.Groups[\"value\"].Value;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// what I wouldn't give for a YAML parser...\n\t\t\tvar fileLines = File.ReadAllLines(_regressionResultsFile);\n\t\t\tCburgmerTestCase? currentTestCase = null;\n\t\t\tforeach (var line in fileLines)\n\t\t\t{\n\t\t\t\tif (TryMatch(line, _idPattern, out var value))\n\t\t\t\t{\n\t\t\t\t\tif (currentTestCase != null)\n\t\t\t\t\t\tyield return new TestCaseData(currentTestCase) { TestName = $\"{currentTestCase.PathString} - {currentTestCase.TestName}\" };\n\t\t\t\t\tcurrentTestCase = new CburgmerTestCase { TestName = value };\n\t\t\t\t}\n\t\t\t\telse if (TryMatch(line, _selectorPattern, out value))\n\t\t\t\t{\n\t\t\t\t\tcurrentTestCase!.PathString = JsonNode.Parse(value!)!.GetValue();\n\t\t\t\t}\n\t\t\t\telse if (TryMatch(line, _documentPattern, out value))\n\t\t\t\t{\n\t\t\t\t\tcurrentTestCase!.JsonString = value!;\n\t\t\t\t}\n\t\t\t\telse if (TryMatch(line, _consensusPattern, out value))\n\t\t\t\t{\n\t\t\t\t\tcurrentTestCase!.Consensus = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(TestCases))]\n\tpublic void Run(CburgmerTestCase testCase)\n\t{\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(testCase);\n\t\tTestConsole.WriteLine();\n\n\t\tPathResult? actual = null;\n\n\t\tException? exception = null;\n\t\tvar time = Debugger.IsAttached ? int.MaxValue : 100;\n\t\tusing var cts = new CancellationTokenSource(time);\n\t\tTask.Run(() => actual = Evaluate(testCase.JsonString, testCase.PathString), cts.Token)\n\t\t\t.ContinueWith(taskResult =>\n\t\t\t{\n\t\t\t\tif (taskResult.IsFaulted)\n\t\t\t\t\texception = taskResult.Exception!.InnerException;\n\t\t\t}, cts.Token)\n\t\t\t.Wait(cts.Token);\n\n\t\tif (actual == null)\n\t\t{\n\t\t\tif (exception != null)\n\t\t\t\tTestConsole.WriteLine(exception);\n\n\t\t\tif (testCase.Consensus == \"NOT_SUPPORTED\") return;\n\n\t\t\tif (exception != null)\n\t\t\t{\n\t\t\t\tif (_notSupported.Contains(testCase.PathString))\n\t\t\t\t\tAssert.Inconclusive(\"This case will not be supported.\");\n\t\t\t\tthrow exception;\n\t\t\t}\n\n\t\t\tif (testCase.Consensus == null)\n\t\t\t\tAssert.Inconclusive(\"Test case has no consensus result. Cannot validate.\");\n\n\t\t\tAssert.Fail($\"Could not parse path: {testCase.PathString}\");\n\t\t}\n\n\t\tTestConsole.WriteLine($\"Actual (values): {JsonSerializer.Serialize(actual!.Matches!.Select(x => x.Value), _linearSerializerOptions)}\");\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine($\"Actual: {JsonSerializer.Serialize(actual, _serializerOptions)}\");\n\t\tif (testCase.Consensus == null)\n\t\t\tAssert.Inconclusive(\"Test case has no consensus result. Cannot validate.\");\n\t\telse\n\t\t{\n\t\t\tif (testCase.Consensus == \"NOT_SUPPORTED\") return;\n\t\t\tvar expected = JsonNode.Parse(testCase.Consensus);\n\t\t\tAssert.That(expected!.AsArray().All(v => actual.Matches!.Any(m => JsonNodeEqualityComparer.Instance.Equals(v, m.Value))), Is.True);\n\t\t}\n\t}\n\n\tprivate static PathResult? Evaluate(string jsonString, string pathString)\n\t{\n\t\tvar o = JsonNode.Parse(jsonString);\n\n\t\tvar path = JsonPath.Parse(pathString, _parsingOptions);\n\t\tvar results = path.Evaluate(o);\n\n\t\treturn results;", + "snippet": "private static readonly PathParsingOptions _parsingOptions = new()\n\t{\n\t\tAllowMathOperations = true,\n\t\tAllowRelativePathStart = true,\n\t\tAllowJsonConstructs = true,\n\t\tTolerateExtraWhitespace = true,\n\t\tAllowInOperator = tru" + }, + { + "title": "src/JsonPath.Tests/Suite/CburgmerFeatureValidationTests.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/Suite/CburgmerFeatureValidationTests.cs#L241-L242", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/Suite/CburgmerFeatureValidationTests.cs", + "startLine": 241, + "endLine": 242, + "content": "}\n}", + "snippet": "}\n}" + }, + { + "title": "src/JsonPath.Tests/Suite/CburgmerTestCase.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/Suite/CburgmerTestCase.cs#L1-L19", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/Suite/CburgmerTestCase.cs", + "startLine": 1, + "endLine": 19, + "content": "namespace Json.Path.Tests.Suite;\n\n#pragma warning disable CS8618\n\npublic class CburgmerTestCase\n{\n\tpublic string? TestName { get; set; }\n\tpublic string PathString { get; set; }\n\tpublic string JsonString { get; set; }\n\tpublic string? Consensus { get; set; }\n\n\tpublic override string ToString()\n\t{\n\t\treturn $\"TestName: {TestName}\\n\" +\n\t\t\t $\"PathString: {PathString}\\n\" +\n\t\t\t $\"JsonString: {JsonString}\\n\" +\n\t\t\t $\"Consensus: {Consensus}\";\n\t}\n}", + "snippet": "namespace Json.Path.Tests.Suite;\n\n#pragma warning disable CS8618\n\npublic class CburgmerTestCase\n{\n\tpublic string? TestName { get; set; }\n\tpublic string PathString { get; set; }\n\tpublic string JsonString { get; set; }\n\tpu" + }, + { + "title": "src/JsonPath.Tests/Suite/ComplianceTestCase.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/Suite/ComplianceTestCase.cs#L1-L36", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/Suite/ComplianceTestCase.cs", + "startLine": 1, + "endLine": 36, + "content": "using System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\n\n#pragma warning disable CS8618\n// ReSharper disable UnusedAutoPropertyAccessor.Global\n\nnamespace Json.Path.Tests.Suite;\n\npublic class ComplianceTestCase\n{\n\tpublic string Name { get; set; }\n\tpublic string Selector { get; set; }\n\tpublic JsonNode? Document { get; set; }\n\tpublic JsonArray? Result { get; set; }\n\tpublic List? Results { get; set; }\n\t[JsonPropertyName(\"result_paths\")]\n\tpublic JsonArray? Location { get; set; }\n\t[JsonPropertyName(\"results_paths\")]\n\tpublic List? Locations { get; set; }\n\t[JsonPropertyName(\"invalid_selector\")]\n\tpublic bool InvalidSelector { get; set; }\n\n\tpublic override string ToString()\n\t{\n\t\treturn $\"Name: {Name}\\n\" +\n\t\t\t $\"Selector: {Selector}\\n\" +\n\t\t\t $\"Document: {JsonSerializer.Serialize(Document, SerializerOptions.Default)}\\n\" +\n\t\t\t $\"Result: {JsonSerializer.Serialize(Result, SerializerOptions.Default)}\\n\" +\n\t\t\t $\"Results: {JsonSerializer.Serialize(Results, SerializerOptions.Default)}\\n\" +\n\t\t\t $\"Paths: {JsonSerializer.Serialize(Location, SerializerOptions.Default)}\\n\" +\n\t\t\t $\"Path sets: {JsonSerializer.Serialize(Locations, SerializerOptions.Default)}\\n\" +\n\t\t\t $\"IsValid: {!InvalidSelector}\";\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\n\n#pragma warning disable CS8618\n// ReSharper disable UnusedAutoPropertyAccessor.Global\n\nnamesp" + }, + { + "title": "src/JsonPath.Tests/Suite/ComplianceTestSuite.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/Suite/ComplianceTestSuite.cs#L1-L10", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/Suite/ComplianceTestSuite.cs", + "startLine": 1, + "endLine": 10, + "content": "using System.Collections.Generic;\n\n#pragma warning disable CS8618\n\nnamespace Json.Path.Tests.Suite;\n\npublic class ComplianceTestSuite\n{\n\tpublic List Tests { get; set; }\n}", + "snippet": "using System.Collections.Generic;\n\n#pragma warning disable CS8618\n\nnamespace Json.Path.Tests.Suite;\n\npublic class ComplianceTestSuite\n{\n\tpublic List Tests { get; set; }\n}" + }, + { + "title": "src/JsonPath.Tests/Suite/ComplianceTestSuiteStringifyTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/Suite/ComplianceTestSuiteStringifyTests.cs#L1-L45", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/Suite/ComplianceTestSuiteStringifyTests.cs", + "startLine": 1, + "endLine": 45, + "content": "using System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests.Suite;\n\npublic class ComplianceTestSuiteStringifyTests\n{\n\tprivate const string _testsFile = @\"../../../../../ref-repos/jsonpath-compliance-test-suite/cts.json\";\n\n\t// - id: array_index\n\t// pathSegment: $[2]\n\t// document: [\"first\", \"second\", \"third\", \"forth\", \"fifth\"]\n\t// consensus: [\"third\"]\n\t// scalar-consensus: \"third\"\n\tpublic static IEnumerable TestCases\n\t{\n\t\tget\n\t\t{\n\t\t\tvar fileText = File.ReadAllText(_testsFile);\n\t\t\tvar suite = JsonSerializer.Deserialize(fileText, new JsonSerializerOptions\n\t\t\t{\n\t\t\t\tAllowTrailingCommas = true,\n\t\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\t\t\tPropertyNameCaseInsensitive = true\n\t\t\t});\n\t\t\treturn suite!.Tests.Where(x => !x.InvalidSelector).Select(t => new TestCaseData(t) { TestName = t.Name });\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(TestCases))]\n\tpublic void Stringify(ComplianceTestCase testCase)\n\t{\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(testCase);\n\t\tTestConsole.WriteLine();\n\n\t\tStringifyTests.AssertStringify(testCase.Selector, testCase.Document);\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests.Suite;\n\npublic class Com" + }, + { + "title": "src/JsonPath.Tests/Suite/ComplianceTestSuiteTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/Suite/ComplianceTestSuiteTests.cs#L1-L100", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/Suite/ComplianceTestSuiteTests.cs", + "startLine": 1, + "endLine": 100, + "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Tests.Suite;\n\npublic class ComplianceTestSuiteTests\n{\n\tprivate const string _testsFile = @\"../../../../../ref-repos/jsonpath-compliance-test-suite/cts.json\";\n\tprivate static readonly string[] _notSupported = [];\n\n\t// - id: array_index\n\t// pathSegment: $[2]\n\t// document: [\"first\", \"second\", \"third\", \"forth\", \"fifth\"]\n\t// consensus: [\"third\"]\n\t// scalar-consensus: \"third\"\n\tpublic static IEnumerable TestCases\n\t{\n\t\tget\n\t\t{\n\t\t\tvar fileText = File.ReadAllText(_testsFile);\n\t\t\tvar suite = JsonSerializer.Deserialize(fileText, SerializerOptions.Default);\n\t\t\treturn suite!.Tests.Select(t => new TestCaseData(t) { TestName = t.Name });\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(TestCases))]\n\tpublic void Run(ComplianceTestCase testCase)\n\t{\n\t\tif (_notSupported.Contains(testCase.Name))\n\t\t\tAssert.Inconclusive(\"This case will not be supported.\");\n\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(testCase);\n\t\tTestConsole.WriteLine();\n\n\t\tif (testCase.InvalidSelector)\n\t\t{\n\t\t\tbool tryParseResult;\n\t\t\ttry\n\t\t\t{\n\t\t\t\ttryParseResult = JsonPath.TryParse(testCase.Selector, out _);\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tTestConsole.WriteLine(e);\n\t\t\t\tAssert.Fail(\"TryParse() threw an exception\");\n\t\t\t\tthrow; // this will never run, but the compiler doesn't know that Assert.Fail() will always throw.\n\t\t\t}\n\t\t\tAssert.That(tryParseResult, Is.False);\n\n\t\t\tvar exception = Assert.Throws(() => JsonPath.Parse(testCase.Selector));\n\t\t\tTestConsole.WriteLine($\"Error: {exception!.Message}\");\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tvar path = JsonPath.Parse(testCase.Selector);\n\t\tConsole.WriteLine(\"Parse:\");\n\t\tEvaluate(path, testCase);\n\t\tConsole.WriteLine();\n\n\t\tvar success = JsonPath.TryParse(testCase.Selector, out path);\n\t\tAssert.That(success, Is.True);\n\t\tConsole.WriteLine(\"TryParse:\");\n\t\tEvaluate(path!, testCase);\n\t}\n\n\tprivate static void Evaluate(JsonPath path, ComplianceTestCase testCase)\n\t{\n\t\tvar actual = path.Evaluate(testCase.Document);\n\n\t\tvar actualValues = actual.Matches.Select(m => m.Value).ToJsonArray();\n\t\tvar actualLocations = actual.Matches.Select(m => (JsonValue) m.Location!.ToString()).ToJsonArray();\n\t\tTestConsole.WriteLine($\" Actual (values): {JsonSerializer.Serialize(actualValues, SerializerOptions.Default)}\");\n\t\tTestConsole.WriteLine($\" Actual (locations): {JsonSerializer.Serialize(actualLocations, SerializerOptions.Default)}\");\n\t\tTestConsole.WriteLine($\" Actual (full): {JsonSerializer.Serialize(actual, SerializerOptions.Default)}\");\n\t\tif (testCase.InvalidSelector)\n\t\t\tAssert.Fail($\"{testCase.Selector} is not a valid path.\");\n\n\t\tif (testCase.Result is not null)\n\t\t{\n\t\t\tAssert.That(testCase.Result.IsEquivalentTo(actualValues), Is.True, \"Unexpected results returned\");\n\t\t\tif (testCase.Location is not null)\n\t\t\t\tAssert.That(testCase.Location.IsEquivalentTo(actualLocations), Is.True, \"Unexpected results returned\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tAssert.That(() => testCase.Results!.Contains(actualValues, JsonNodeEqualityComparer.Instance), \"None of the options matched.\");\n\t\t\tif (testCase.Locations is not null)\n\t\t\t\tAssert.That(() => testCase.Locations!.Contains(actualLocations, JsonNodeEqualityComparer.Instance), \"None of the options matched.\");\n\t\t}\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Path.Te" + }, + { + "title": "src/JsonPath.Tests/TypeConverterTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath.Tests/TypeConverterTests.cs#L1-L55", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath.Tests/TypeConverterTests.cs", + "startLine": 1, + "endLine": 55, + "content": "using System.ComponentModel;\nusing NUnit.Framework;\n\nnamespace Json.Path.Tests\n{\n\tpublic class TypeConverterTests\n\t{\n\n\t\t[Test]\n\t\tpublic void ConvertFromString()\n\t\t{\n\t\t\tvar typeConverter = TypeDescriptor.GetConverter(typeof(JsonPath));\n\t\t\tvar path = typeConverter.ConvertFromInvariantString(\"$.store.book[*].author\") as JsonPath;\n\n\t\t\tAssert.That(path, Is.Not.Null);\n\t\t\tAssert.That(path!.ToString(), Is.EqualTo(\"$.store.book[*].author\"));\n\t\t}\n\n\t\t[Test]\n\t\tpublic void ConvertToString()\n\t\t{\n\t\t\tvar path = JsonPath.Parse(\"$.store.book[*].author\");\n\t\t\tvar typeConverter = TypeDescriptor.GetConverter(typeof(JsonPath));\n\t\t\tvar pathString = typeConverter.ConvertToInvariantString(path);\n\n\t\t\tAssert.That(pathString, Is.EqualTo(\"$.store.book[*].author\"));\n\t\t}\n\n\t\t[Test]\n\t\tpublic void ConvertFromJsonPath()\n\t\t{\n\t\t\tvar path = JsonPath.Parse(\"$.store.book[*].author\");\n\t\t\tvar typeConverter = TypeDescriptor.GetConverter(typeof(JsonPath));\n\t\t\tvar path2 = typeConverter.ConvertFrom(path) as JsonPath;\n\n\t\t\tAssert.That(path2, Is.Not.Null);\n\t\t\tAssert.That(path2, Is.Not.SameAs(path));\n\t\t\tAssert.That(path2!.ToString(), Is.EqualTo(\"$.store.book[*].author\"));\n\t\t}\n\n\t\t[Test]\n\t\tpublic void ConvertToJsonPath()\n\t\t{\n\t\t\tvar path = JsonPath.Parse(\"$.store.book[*].author\");\n\t\t\tvar typeConverter = TypeDescriptor.GetConverter(typeof(JsonPath));\n\t\t\tvar path2 = typeConverter.ConvertTo(path, typeof(JsonPath)) as JsonPath;\n\n\t\t\tAssert.That(path2, Is.Not.Null);\n\t\t\tAssert.That(path2, Is.Not.SameAs(path));\n\t\t\tAssert.That(path2!.ToString(), Is.EqualTo(\"$.store.book[*].author\"));\n\t\t}\n\n\t}\n}", + "snippet": "using System.ComponentModel;\nusing NUnit.Framework;\n\nnamespace Json.Path.Tests\n{\n\tpublic class TypeConverterTests\n\t{\n\n\t\t[Test]\n\t\tpublic void ConvertFromString()\n\t\t{\n\t\t\tvar typeConverter = TypeDescriptor.GetConverter(type" + }, + { + "title": "src/JsonPath/assembly.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/assembly.cs#L1-L3", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/assembly.cs", + "startLine": 1, + "endLine": 3, + "content": "using System.Runtime.CompilerServices;\n\n[assembly: InternalsVisibleTo(\"JsonPath.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d111b5991feb360746cf4535b9ec3196825996680b6599cf10748f90a58ec820431f81d21eff5229a3fd7c3e42e46a20584ac413ebe39b4c05905fd47b877bffed36bff23ad4ad14aad3deed8f24ed40a1371daad79a41172b2cdf0db4b664198f38f3a19419457131f8ee4558e628b5c986bb574d4e151b650eae6aa1f5ccbf\")]", + "snippet": "using System.Runtime.CompilerServices;\n\n[assembly: InternalsVisibleTo(\"JsonPath.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d111b5991feb360746cf4535b9ec3196825996680b6599cf10748f90a58" + }, + { + "title": "src/JsonPath/CountFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/CountFunction.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/CountFunction.cs", + "startLine": 1, + "endLine": 25, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Implements the `count()` function which returns the number of nodes\n/// in a nodelist.\n/// \npublic class CountFunction : ValueFunctionDefinition\n{\n\t/// \n\t/// Gets the function name.\n\t/// \n\tpublic override string Name => \"count\";\n\n\t/// \n\t/// Evaluates the function.\n\t/// \n\t/// A nodelist\n\t/// The number of nodes in the nodelist.\n\tpublic JsonNode? Evaluate(NodeList? nodeList)\n\t{\n\t\treturn nodeList?.Count ?? 0;\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Implements the `count()` function which returns the number of nodes\n/// in a nodelist.\n/// \npublic class CountFunction : ValueFunctionDefin" + }, + { + "title": "src/JsonPath/Expressions/AddOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/AddOperator.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/AddOperator.cs", + "startLine": 1, + "endLine": 29, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class AddOperator : IBinaryValueOperator\n{\n\tpublic int Precedence => 1;\n\n\tpublic PathValue? Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left is null || right is null) return null;\n\n\t\tif (!left.TryGetJson(out var lNode) || lNode is not JsonValue lValue ||\n\t\t !right.TryGetJson(out var rNode) || rNode is not JsonValue rValue)\n\t\t\treturn null;\n\n\t\tif (lValue.TryGetValue(out string? leftString) &&\n\t\t rValue.TryGetValue(out string? rightString))\n\t\t\treturn (JsonNode?)(leftString + rightString);\n\n\t\treturn (JsonNode?)(lValue.GetNumber() + rValue.GetNumber());\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"+\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class AddOperator : IBinaryValueOperator\n{\n\tpublic int Precedence => 1;\n\n\tpublic PathValue? Evaluate(PathValue? left, PathValue? " + }, + { + "title": "src/JsonPath/Expressions/AndOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/AndOperator.cs#L1-L16", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/AndOperator.cs", + "startLine": 1, + "endLine": 16, + "content": "namespace Json.Path.Expressions;\n\ninternal class AndOperator : IBinaryLogicalOperator\n{\n\tpublic int Precedence => 22;\n\n\tpublic bool Evaluate(bool left, bool right)\n\t{\n\t\treturn left && right;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"&&\";\n\t}\n}", + "snippet": "namespace Json.Path.Expressions;\n\ninternal class AndOperator : IBinaryLogicalOperator\n{\n\tpublic int Precedence => 22;\n\n\tpublic bool Evaluate(bool left, bool right)\n\t{\n\t\treturn left && right;\n\t}\n\n\tpublic override string T" + }, + { + "title": "src/JsonPath/Expressions/BinaryLogicalExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/BinaryLogicalExpressionNode.cs#L1-L56", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/BinaryLogicalExpressionNode.cs", + "startLine": 1, + "endLine": 56, + "content": "using System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class BinaryLogicalExpressionNode : CompositeLogicalExpressionNode\n{\n\tpublic LogicalExpressionNode Left { get; set; }\n\tpublic IBinaryLogicalOperator Operator { get; }\n\tpublic LogicalExpressionNode Right { get; set; }\n\tpublic int NestLevel { get; }\n\n\tpublic int Precedence => NestLevel * 10 + Operator.Precedence;\n\n\tpublic BinaryLogicalExpressionNode(LogicalExpressionNode left, IBinaryLogicalOperator op, LogicalExpressionNode right, int nestLevel)\n\t{\n\t\tOperator = op;\n\t\tLeft = left;\n\t\tRight = right;\n\t\tNestLevel = nestLevel;\n\t}\n\n\tpublic override bool Evaluate(JsonNode? globalParameter, JsonNode? localParameter)\n\t{\n\t\tvar left = Left.Evaluate(globalParameter, localParameter);\n\t\tvar right = Right.Evaluate(globalParameter, localParameter);\n\t\tvar result = Operator.Evaluate(left, right);\n\t\treturn result;\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tvar useGroup = Left is BinaryLogicalExpressionNode lBin && lBin.Precedence > Operator.Precedence;\n\n\t\tif (useGroup)\n\t\t\tbuilder.Append('(');\n\t\tLeft.BuildString(builder);\n\t\tif (useGroup)\n\t\t\tbuilder.Append(')');\n\t\tbuilder.Append(Operator);\n\t\t\n\t\tuseGroup = Right is BinaryLogicalExpressionNode rBin && rBin.Precedence > Operator.Precedence;\n\n\t\tif (useGroup)\n\t\t\tbuilder.Append('(');\n\t\tRight.BuildString(builder);\n\t\tif (useGroup)\n\t\t\tbuilder.Append(')');\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn $\"{Left}{Operator}{Right}\";\n\t}\n}", + "snippet": "using System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class BinaryLogicalExpressionNode : CompositeLogicalExpressionNode\n{\n\tpublic LogicalExpressionNode Left { get; set; }\n\tpublic I" + }, + { + "title": "src/JsonPath/Expressions/CompositeValueExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/CompositeValueExpressionNode.cs#L1-L55", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/CompositeValueExpressionNode.cs", + "startLine": 1, + "endLine": 55, + "content": "using System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class CompositeValueExpressionNode : ValueExpressionNode\n{\n\tpublic ValueExpressionNode Left { get; }\n\tpublic IBinaryValueOperator Operator { get; }\n\tpublic ValueExpressionNode Right { get; set; }\n\tpublic int NestLevel { get; }\n\n\tpublic int Precedence => NestLevel * 10 + Operator.Precedence;\n\n\tpublic CompositeValueExpressionNode(ValueExpressionNode left, IBinaryValueOperator op, ValueExpressionNode right, int nestLevel)\n\t{\n\t\tOperator = op;\n\t\tLeft = left;\n\t\tRight = right;\n\t\tNestLevel = nestLevel;\n\t}\n\n\tpublic override PathValue? Evaluate(JsonNode? globalParameter, JsonNode? localParameter)\n\t{\n\t\treturn Operator.Evaluate(Left.Evaluate(globalParameter, localParameter), Right.Evaluate(globalParameter, localParameter));\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tvar useGroup = Left is CompositeValueExpressionNode lBin &&\n\t\t (lBin.Precedence - Precedence) % 10 > 1;\n\n\t\tif (useGroup)\n\t\t\tbuilder.Append('(');\n\t\tLeft.BuildString(builder);\n\t\tif (useGroup)\n\t\t\tbuilder.Append(')');\n\t\n\t\tbuilder.Append(Operator);\n\n\t\tuseGroup = Right is CompositeValueExpressionNode rBin &&\n\t\t (rBin.Precedence - Precedence) % 10 > 1;\n\t\tif (useGroup)\n\t\t\tbuilder.Append('(');\n\t\tRight.BuildString(builder);\n\t\tif (useGroup)\n\t\t\tbuilder.Append(')');\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn $\"{Left}{Operator}{Right}\";\n\t}\n}", + "snippet": "using System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class CompositeValueExpressionNode : ValueExpressionNode\n{\n\tpublic ValueExpressionNode Left { get; }\n\tpublic IBinaryValueOperat" + }, + { + "title": "src/JsonPath/Expressions/DivideOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/DivideOperator.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/DivideOperator.cs", + "startLine": 1, + "endLine": 29, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class DivideOperator : IBinaryValueOperator\n{\n\tpublic int Precedence => 2;\n\n\tpublic PathValue? Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left is null || right is null) return null;\n\n\t\tif (!left.TryGetJson(out var lNode) || lNode is not JsonValue lValue ||\n\t\t !right.TryGetJson(out var rNode) || rNode is not JsonValue rValue)\n\t\t\treturn null;\n\n\t\tvar rNumber = rValue.GetNumber();\n\n\t\treturn rNumber is null or 0\n\t\t\t? null\n\t\t\t: (JsonNode?)(lValue.GetNumber() / rNumber);\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"/\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class DivideOperator : IBinaryValueOperator\n{\n\tpublic int Precedence => 2;\n\n\tpublic PathValue? Evaluate(PathValue? left, PathValu" + }, + { + "title": "src/JsonPath/Expressions/EqualToOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/EqualToOperator.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/EqualToOperator.cs", + "startLine": 1, + "endLine": 27, + "content": "using Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class EqualToOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left is null) return right is null;\n\t\tif (right is null) return false;\n\n\t\tvar lSuccess = left.TryGetJson(out var lNode) && !ReferenceEquals(lNode, ValueFunctionDefinition.Nothing);\n\t\tvar rSuccess = right.TryGetJson(out var rNode) && !ReferenceEquals(rNode, ValueFunctionDefinition.Nothing);\n\n\t\tif (!lSuccess && !rSuccess) return true;\n\t\tif (!lSuccess || !rSuccess) return false;\n\n\t\treturn lNode.IsEquivalentTo(rNode);\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"==\";\n\t}\n}", + "snippet": "using Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class EqualToOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left is n" + }, + { + "title": "src/JsonPath/Expressions/ExistsLogicalExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/ExistsLogicalExpressionNode.cs#L1-L47", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/ExistsLogicalExpressionNode.cs", + "startLine": 1, + "endLine": 47, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class ExistsLogicalExpressionNode : LeafLogicalExpressionNode\n{\n\tpublic JsonPath Path { get; }\n\n\tpublic ExistsLogicalExpressionNode(JsonPath path)\n\t{\n\t\tPath = path;\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tPath.BuildString(builder);\n\t}\n\n\tpublic override bool Evaluate(JsonNode? globalParameter, JsonNode? localParameter)\n\t{\n\t\tvar parameter = Path.Scope == PathScope.Global\n\t\t\t? globalParameter\n\t\t\t: localParameter;\n\n\t\tvar result = Path.Evaluate(globalParameter, parameter);\n\n\t\treturn result.Matches.Count != 0;\n\t}\n}\n\ninternal class ExistsLogicalExpressionParser : ILogicalExpressionParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out LogicalExpressionNode? expression, PathParsingOptions options)\n\t{\n\t\tif (!PathParser.TryParse(source, ref index, out var path, options))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\texpression = new ExistsLogicalExpressionNode(path);\n\t\treturn true;\n\t}\n}", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class ExistsLogicalExpressionNode : LeafLogicalExpressionNode\n{\n\tpublic Js" + }, + { + "title": "src/JsonPath/Expressions/ExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/ExpressionNode.cs#L1-L19", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/ExpressionNode.cs", + "startLine": 1, + "endLine": 19, + "content": "using System.Diagnostics.CodeAnalysis;\nusing System;\nusing System.Text;\n\nnamespace Json.Path.Expressions;\n\ninternal abstract class ExpressionNode\n{\n\tpublic abstract void BuildString(StringBuilder builder);\n}\n\ninternal static class ExpressionParser\n{\n\tpublic static bool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out LogicalExpressionNode? expression, PathParsingOptions options)\n\t{\n\t\treturn LogicalExpressionParser.TryParse(source, ref index, 0, out expression, options);\n\t}\n}", + "snippet": "using System.Diagnostics.CodeAnalysis;\nusing System;\nusing System.Text;\n\nnamespace Json.Path.Expressions;\n\ninternal abstract class ExpressionNode\n{\n\tpublic abstract void BuildString(StringBuilder builder);\n}\n\ninternal st" + }, + { + "title": "src/JsonPath/Expressions/FunctionExpressionParser.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/FunctionExpressionParser.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/FunctionExpressionParser.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Path.Expressions;\n\ninternal static class FunctionExpressionParser\n{\n\tpublic static bool TryParseFunction(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out List? arguments, [NotNullWhen(true)] out IPathFunctionDefinition? function, PathParsingOptions options)\n\t{\n\t\tint i = index;\n\n\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\targuments = null;\n\t\t\tfunction = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// parse function name\n\t\tif (!source.TryParseName(ref i, out var name, options))\n\t\t{\n\t\t\targuments = null;\n\t\t\tfunction = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!FunctionRepository.TryGet(name, out function))\n\t\t{\n\t\t\targuments = null;\n\t\t\tfunction = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (options.TolerateExtraWhitespace && !source.ConsumeWhitespace(ref i) || i == source.Length)\n\t\t{\n\t\t\targuments = null;\n\t\t\tfunction = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// consume (\n\t\tif (source[i] != '(')\n\t\t{\n\t\t\targuments = null;\n\t\t\tfunction = null;\n\t\t\treturn false;\n\t\t}\n\n\t\ti++;\n\n\t\t// parse list of arguments - all expressions\n\t\targuments = [];\n\t\tvar done = false;\n\n\t\tvar parameterTypeList = ((IReflectiveFunctionDefinition)function).Evaluator.ArgTypes;\n\t\tvar parameterIndex = 0;\n\n\t\twhile (i < source.Length && !done)\n\t\t{\n\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t{\n\t\t\t\targuments = null;\n\t\t\t\tfunction = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (parameterIndex >= parameterTypeList.Length)\n\t\t\t{\n\t\t\t\targuments = null;\n\t\t\t\tfunction = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (parameterTypeList[parameterIndex] == FunctionType.Value)\n\t\t\t{\n\t\t\t\tif (!ValueExpressionParser.TryParse(source, ref i, 0, out var expr, options) ||\n\t\t\t\t expr is PathValueExpressionNode { Path.IsSingular: false })\n\t\t\t\t{\n\t\t\t\t\targuments = null;\n\t\t\t\t\tfunction = null;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\targuments.Add(expr);\n\t\t\t}\n\t\t\telse if (parameterTypeList[parameterIndex] == FunctionType.Logical)\n\t\t\t{\n\n\t\t\t\tif (!LogicalExpressionParser.TryParse(source, ref i, 0, out var expr, options))\n\t\t\t\t{\n\t\t\t\t\targuments = null;\n\t\t\t\t\tfunction = null;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\targuments.Add(expr);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// this must return a path or function that returns nodelist\n\t\t\t\tif (!ValueExpressionParser.TryParse(source, ref i, 0, out var expr, options))\n\t\t\t\t{\n\t\t\t\t\targuments = null;\n\t\t\t\t\tfunction = null;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tswitch (expr)\n\t\t\t\t{\n\t\t\t\t\tcase PathValueExpressionNode:\n\t\t\t\t\tcase FunctionValueExpressionNode { Function: NodelistFunctionDefinition }:\n\t\t\t\t\t\targuments.Add(expr);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\targuments = null;\n\t\t\t\t\t\tfunction = null;\n\t\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Path.Expressions;\n\ninternal static class FunctionExpressionParser\n{\n\tpublic static bool TryParseFunction(ReadOnlySpan" + }, + { + "title": "src/JsonPath/Expressions/FunctionExpressionParser.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/FunctionExpressionParser.cs#L121-L155", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/FunctionExpressionParser.cs", + "startLine": 121, + "endLine": 155, + "content": "if (!source.ConsumeWhitespace(ref i))\n\t\t\t{\n\t\t\t\targuments = null;\n\t\t\t\tfunction = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tswitch (source[i])\n\t\t\t{\n\t\t\t\tcase ')':\n\t\t\t\t\tdone = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase ',':\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\targuments = null;\n\t\t\t\t\tfunction = null;\n\t\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\ti++;\n\t\t\tparameterIndex++;\n\t\t}\n\n\t\tif (parameterIndex != parameterTypeList.Length)\n\t\t{\n\t\t\targuments = null;\n\t\t\tfunction = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tindex = i;\n\t\treturn true;\n\t}\n}", + "snippet": "if (!source.ConsumeWhitespace(ref i))\n\t\t\t{\n\t\t\t\targuments = null;\n\t\t\t\tfunction = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tswitch (source[i])\n\t\t\t{\n\t\t\t\tcase ')':\n\t\t\t\t\tdone = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase ',':\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n" + }, + { + "title": "src/JsonPath/Expressions/FunctionLogicalExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/FunctionLogicalExpressionNode.cs#L1-L87", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/FunctionLogicalExpressionNode.cs", + "startLine": 1, + "endLine": 87, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class FunctionLogicalExpressionNode : LogicalExpressionNode\n{\n\tpublic IPathFunctionDefinition Function { get; }\n\tpublic ExpressionNode[] Parameters { get; }\n\n\tpublic FunctionLogicalExpressionNode(IPathFunctionDefinition function, IEnumerable parameters)\n\t{\n\t\tFunction = function;\n\t\tParameters = parameters.ToArray();\n\t}\n\n\tpublic override bool Evaluate(JsonNode? globalParameter, JsonNode? localParameter)\n\t{\n\t\tvar parameterValues = Parameters.Select(x =>\n\t\t{\n\t\t\treturn x switch\n\t\t\t{\n\t\t\t\tValueExpressionNode c => (object?)c.Evaluate(globalParameter, localParameter),\n\t\t\t\tLogicalExpressionNode b => b.Evaluate(globalParameter, localParameter),\n\t\t\t\t_ => throw new ArgumentOutOfRangeException(\"parameter\")\n\t\t\t};\n\t\t}).ToArray();\n\n\t\treturn Function switch\n\t\t{\n\t\t\tNodelistFunctionDefinition nFunc => nFunc.Invoke(parameterValues)?.Count != 0,\n\t\t\tLogicalFunctionDefinition lFunc => lFunc.Invoke(parameterValues) == true,\n\t\t\t_ => throw new ArgumentException(\"This shouldn't happen. Logical functions are not valid here.\")\n\t\t};\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append(Function.Name);\n\t\tbuilder.Append('(');\n\n\t\tif (Parameters.Any())\n\t\t{\n\t\t\tParameters[0].BuildString(builder);\n\t\t\tfor (int i = 1; i < Parameters.Length; i++)\n\t\t\t{\n\t\t\t\tbuilder.Append(',');\n\t\t\t\tParameters[i].BuildString(builder);\n\t\t\t}\n\t\t}\n\n\t\tbuilder.Append(')');\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn $\"{Function.Name}({string.Join(\",\", (IEnumerable)Parameters)})\";\n\t}\n}\n\ninternal class FunctionLogicalExpressionParser : ILogicalExpressionParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out LogicalExpressionNode? expression, PathParsingOptions options)\n\t{\n\t\tint i = index;\n\t\tif (!FunctionExpressionParser.TryParseFunction(source, ref i, out var parameters, out var function, options))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (function is ValueFunctionDefinition)\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\texpression = new FunctionLogicalExpressionNode(function, parameters);\n\t\tindex = i;\n\t\treturn true;\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class FunctionLogical" + }, + { + "title": "src/JsonPath/Expressions/FunctionValueExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/FunctionValueExpressionNode.cs#L1-L88", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/FunctionValueExpressionNode.cs", + "startLine": 1, + "endLine": 88, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class FunctionValueExpressionNode : LeafValueExpressionNode\n{\n\tprivate readonly ExpressionNode[] _parameters;\n\t\n\tpublic IPathFunctionDefinition Function { get; }\n\n\tpublic FunctionValueExpressionNode(IPathFunctionDefinition function, IEnumerable parameters)\n\t{\n\t\tFunction = function;\n\t\t_parameters = parameters.ToArray();\n\t}\n\n\tpublic override PathValue? Evaluate(JsonNode? globalParameter, JsonNode? localParameter)\n\t{\n\t\tvar parameterValues = _parameters.Select(x =>\n\t\t{\n\t\t\treturn x switch\n\t\t\t{\n\t\t\t\tValueExpressionNode c => (object?)c.Evaluate(globalParameter, localParameter),\n\t\t\t\tLogicalExpressionNode b => b.Evaluate(globalParameter, localParameter),\n\t\t\t\t_ => throw new ArgumentOutOfRangeException(\"parameter\")\n\t\t\t};\n\t\t}).ToArray();\n\n\t\treturn Function switch\n\t\t{\n\t\t\tValueFunctionDefinition vFunc => vFunc.Invoke(parameterValues),\n\t\t\tNodelistFunctionDefinition nFunc => nFunc.Invoke(parameterValues),\n\t\t\t_ => throw new ArgumentException(\"This shouldn't happen. Logical functions are not valid here.\")\n\t\t};\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append(Function.Name);\n\t\tbuilder.Append('(');\n\n\t\tif (_parameters.Any())\n\t\t{\n\t\t\t_parameters[0].BuildString(builder);\n\t\t\tfor (int i = 1; i < _parameters.Length; i++)\n\t\t\t{\n\t\t\t\tbuilder.Append(',');\n\t\t\t\t_parameters[i].BuildString(builder);\n\t\t\t}\n\t\t}\n\n\t\tbuilder.Append(')');\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn $\"{Function.Name}({string.Join(\",\", (IEnumerable)_parameters)})\";\n\t}\n}\n\ninternal class FunctionValueExpressionParser : IValueExpressionParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out ValueExpressionNode? expression, PathParsingOptions options)\n\t{\n\t\tint i = index;\n\t\tif (!FunctionExpressionParser.TryParseFunction(source, ref i, out var parameters, out var function, options))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (function is LogicalFunctionDefinition)\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tindex = i;\n\t\texpression = new FunctionValueExpressionNode(function, parameters);\n\t\treturn true;\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class FunctionValueEx" + }, + { + "title": "src/JsonPath/Expressions/GreaterThanOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/GreaterThanOperator.cs#L1-L35", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/GreaterThanOperator.cs", + "startLine": 1, + "endLine": 35, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class GreaterThanOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left is null) return right is null;\n\t\tif (right is null) return false;\n\n\t\tif (!left.TryGetJson(out var lNode) ||\n\t\t !right.TryGetJson(out var rNode))\n\t\t\treturn false;\n\n\t\tif (lNode is not JsonValue lValue ||\n\t\t rNode is not JsonValue rValue)\n\t\t\treturn false;\n\n\t\tif (lValue.TryGetValue(out string? leftString) &&\n\t\t rValue.TryGetValue(out string? rightString))\n\t\t\treturn string.Compare(leftString, rightString, StringComparison.Ordinal) > 0;\n\n\t\treturn lValue.GetNumber() > rValue.GetNumber();\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \">\";\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class GreaterThanOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate(PathV" + }, + { + "title": "src/JsonPath/Expressions/GreaterThanOrEqualToOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/GreaterThanOrEqualToOperator.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/GreaterThanOrEqualToOperator.cs", + "startLine": 1, + "endLine": 37, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class GreaterThanOrEqualToOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left is null) return right is null;\n\t\tif (right is null) return false;\n\n\t\tif (!left.TryGetJson(out var lNode) ||\n\t\t !right.TryGetJson(out var rNode))\n\t\t\treturn false;\n\n\t\tif (lNode.IsEquivalentTo(rNode)) return true;\n\n\t\tif (lNode is not JsonValue lValue ||\n\t\t rNode is not JsonValue rValue)\n\t\t\treturn false;\n\n\t\tif (lValue.TryGetValue(out string? leftString) &&\n\t\t rValue.TryGetValue(out string? rightString))\n\t\t\treturn string.Compare(leftString, rightString, StringComparison.Ordinal) >= 0;\n\n\t\treturn lValue.GetNumber() >= rValue.GetNumber();\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \">=\";\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class GreaterThanOrEqualToOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evalu" + }, + { + "title": "src/JsonPath/Expressions/IBinaryComparativeOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/IBinaryComparativeOperator.cs#L1-L6", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/IBinaryComparativeOperator.cs", + "startLine": 1, + "endLine": 6, + "content": "namespace Json.Path.Expressions;\n\ninternal interface IBinaryComparativeOperator : IExpressionOperator\n{\n\tbool Evaluate(PathValue? left, PathValue? right);\n}", + "snippet": "namespace Json.Path.Expressions;\n\ninternal interface IBinaryComparativeOperator : IExpressionOperator\n{\n\tbool Evaluate(PathValue? left, PathValue? right);\n}" + }, + { + "title": "src/JsonPath/Expressions/IBinaryLogicalOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/IBinaryLogicalOperator.cs#L1-L6", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/IBinaryLogicalOperator.cs", + "startLine": 1, + "endLine": 6, + "content": "namespace Json.Path.Expressions;\n\ninternal interface IBinaryLogicalOperator : IExpressionOperator\n{\n\tbool Evaluate(bool left, bool right);\n}", + "snippet": "namespace Json.Path.Expressions;\n\ninternal interface IBinaryLogicalOperator : IExpressionOperator\n{\n\tbool Evaluate(bool left, bool right);\n}" + }, + { + "title": "src/JsonPath/Expressions/IBinaryValueOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/IBinaryValueOperator.cs#L1-L11", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/IBinaryValueOperator.cs", + "startLine": 1, + "endLine": 11, + "content": "namespace Json.Path.Expressions;\n\ninternal interface IBinaryValueOperator : IExpressionOperator\n{\n\tPathValue? Evaluate(PathValue? left, PathValue? right);\n}\n\ninternal interface IExpressionOperator\n{\n\tint Precedence { get; }\n}", + "snippet": "namespace Json.Path.Expressions;\n\ninternal interface IBinaryValueOperator : IExpressionOperator\n{\n\tPathValue? Evaluate(PathValue? left, PathValue? right);\n}\n\ninternal interface IExpressionOperator\n{\n\tint Precedence { get" + }, + { + "title": "src/JsonPath/Expressions/ILogicalExpressionParser.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/ILogicalExpressionParser.cs#L1-L9", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/ILogicalExpressionParser.cs", + "startLine": 1, + "endLine": 9, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Path.Expressions;\n\ninternal interface ILogicalExpressionParser\n{\n\tbool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out LogicalExpressionNode? expression, PathParsingOptions options);\n}", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Path.Expressions;\n\ninternal interface ILogicalExpressionParser\n{\n\tbool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(t" + }, + { + "title": "src/JsonPath/Expressions/InOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/InOperator.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/InOperator.cs", + "startLine": 1, + "endLine": 37, + "content": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class InOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left is null) return right is null;\n\t\tif (right is null) return false;\n\n\t\tif (!left.TryGetJson(out var lNode) ||\n\t\t !right.TryGetJson(out var rNode))\n\t\t\treturn false;\n\n\t\tvar values = rNode switch\n\t\t{\n\t\t\tJsonArray arr => arr,\n\t\t\tJsonObject obj => obj.Select(x => x.Value),\n\t\t\t_ => null\n\t\t};\n\n\t\tif (values == null) return false;\n\n\t\treturn values.Contains(lNode, JsonNodeEqualityComparer.Instance);\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \" in \";\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class InOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate(PathValue" + }, + { + "title": "src/JsonPath/Expressions/IUnaryComparativeOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/IUnaryComparativeOperator.cs#L1-L6", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/IUnaryComparativeOperator.cs", + "startLine": 1, + "endLine": 6, + "content": "namespace Json.Path.Expressions;\n\ninternal interface IUnaryComparativeOperator : IExpressionOperator\n{\n\tbool Evaluate(PathValue? value);\n}", + "snippet": "namespace Json.Path.Expressions;\n\ninternal interface IUnaryComparativeOperator : IExpressionOperator\n{\n\tbool Evaluate(PathValue? value);\n}" + }, + { + "title": "src/JsonPath/Expressions/IUnaryLogicalOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/IUnaryLogicalOperator.cs#L1-L6", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/IUnaryLogicalOperator.cs", + "startLine": 1, + "endLine": 6, + "content": "namespace Json.Path.Expressions;\n\ninternal interface IUnaryLogicalOperator : IExpressionOperator\n{\n\tbool Evaluate(bool value);\n}", + "snippet": "namespace Json.Path.Expressions;\n\ninternal interface IUnaryLogicalOperator : IExpressionOperator\n{\n\tbool Evaluate(bool value);\n}" + }, + { + "title": "src/JsonPath/Expressions/IValueExpressionParser.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/IValueExpressionParser.cs#L1-L9", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/IValueExpressionParser.cs", + "startLine": 1, + "endLine": 9, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Path.Expressions;\n\ninternal interface IValueExpressionParser\n{\n\tbool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out ValueExpressionNode? expression, PathParsingOptions options);\n}", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Path.Expressions;\n\ninternal interface IValueExpressionParser\n{\n\tbool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(tru" + }, + { + "title": "src/JsonPath/Expressions/LessThanOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/LessThanOperator.cs#L1-L35", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/LessThanOperator.cs", + "startLine": 1, + "endLine": 35, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class LessThanOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left is null) return right is null;\n\t\tif (right is null) return false;\n\n\t\tif (!left.TryGetJson(out var lNode) ||\n\t\t !right.TryGetJson(out var rNode))\n\t\t\treturn false;\n\n\t\tif (lNode is not JsonValue lValue ||\n\t\t rNode is not JsonValue rValue)\n\t\t\treturn false;\n\n\t\tif (lValue.TryGetValue(out string? leftString) &&\n\t\t rValue.TryGetValue(out string? rightString))\n\t\t\treturn string.Compare(leftString, rightString, StringComparison.Ordinal) < 0;\n\n\t\treturn lValue.GetNumber() < rValue.GetNumber();\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"<\";\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class LessThanOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate(PathValu" + }, + { + "title": "src/JsonPath/Expressions/LessThanOrEqualToOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/LessThanOrEqualToOperator.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/LessThanOrEqualToOperator.cs", + "startLine": 1, + "endLine": 37, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class LessThanOrEqualToOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left is null) return right is null;\n\t\tif (right is null) return false;\n\n\t\tif (!left.TryGetJson(out var lNode) ||\n\t\t !right.TryGetJson(out var rNode))\n\t\t\treturn false;\n\n\t\tif (lNode.IsEquivalentTo(rNode)) return true;\n\n\t\tif (lNode is not JsonValue lValue ||\n\t\t rNode is not JsonValue rValue)\n\t\t\treturn false;\n\n\t\tif (lValue.TryGetValue(out string? leftString) &&\n\t\t rValue.TryGetValue(out string? rightString))\n\t\t\treturn string.Compare(leftString, rightString, StringComparison.Ordinal) <= 0;\n\n\t\treturn lValue.GetNumber() <= rValue.GetNumber();\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"<=\";\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class LessThanOrEqualToOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate" + }, + { + "title": "src/JsonPath/Expressions/LiteralValueExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/LiteralValueExpressionNode.cs#L1-L60", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/LiteralValueExpressionNode.cs", + "startLine": 1, + "endLine": 60, + "content": "using System.Diagnostics.CodeAnalysis;\nusing System;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing System.Text;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\n\nnamespace Json.Path.Expressions;\n\ninternal class LiteralValueExpressionNode : LeafValueExpressionNode\n{\n\tprivate static readonly JsonSerializerOptions _options = new()\n\t{\n\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t};\n\n\tprivate readonly JsonNode? _value;\n\n\tpublic LiteralValueExpressionNode(JsonNode? value)\n\t{\n\t\t_value = value;\n\t}\n\n\tpublic override PathValue? Evaluate(JsonNode? globalParameter, JsonNode? localParameter)\n\t{\n\t\treturn _value;\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append(_value.AsJsonString(_options));\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn _value.AsJsonString(_options);\n\t}\n}\n\ninternal class LiteralValueExpressionParser : IValueExpressionParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out ValueExpressionNode? expression, PathParsingOptions options)\n\t{\n\t\tif (!source.TryParseJson(ref index, out var node))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (node is not (null or JsonValue) && !options.AllowJsonConstructs)\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\texpression = new LiteralValueExpressionNode(node);\n\t\treturn true;\n\t}\n}", + "snippet": "using System.Diagnostics.CodeAnalysis;\nusing System;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing System.Text;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\n\nnamespace Json.Path.Expressions;\n\ninternal " + }, + { + "title": "src/JsonPath/Expressions/LogicalExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/LogicalExpressionNode.cs#L1-L116", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/LogicalExpressionNode.cs", + "startLine": 1, + "endLine": 116, + "content": "using System.Diagnostics.CodeAnalysis;\nusing System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal abstract class LogicalExpressionNode : ExpressionNode, IFilterExpression\n{\n\tpublic abstract bool Evaluate(JsonNode? globalParameter, JsonNode? localParameter);\n}\n\ninternal abstract class CompositeLogicalExpressionNode : LogicalExpressionNode;\n\ninternal abstract class LeafLogicalExpressionNode : LogicalExpressionNode;\n\ninternal static class LogicalExpressionParser\n{\n\tpublic static bool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out LogicalExpressionNode? expression, PathParsingOptions options)\n\t{\n\t\tint i = index;\n\n\t\tint Precedence(IBinaryLogicalOperator op) => nestLevel * 10 + op.Precedence;\n\n\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// first get an operand\n\t\tif (!LogicalOperandParser.TryParse(source, ref i, nestLevel, out var left, options))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\twhile (i < source.Length)\n\t\t{\n\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t{\n\t\t\t\texpression = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// parse operator\n\t\t\tif (!BinaryLogicalOperatorParser.TryParse(source, ref i, out var op))\n\t\t\t\tbreak; // if we don't get an op, then we're done\n\n\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t{\n\t\t\t\texpression = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// parse right\n\t\t\tif (!LogicalOperandParser.TryParse(source, ref i, nestLevel, out var right, options))\n\t\t\t{\n\t\t\t\t// if we don't get a comparison, then the syntax is wrong\n\t\t\t\texpression = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// assemble\n\t\t\tif (left is BinaryLogicalExpressionNode lBin && lBin.Precedence < Precedence(op))\n\t\t\t\tlBin.Right = new BinaryLogicalExpressionNode(lBin.Right, op, right, nestLevel);\n\t\t\telse\n\t\t\t\tleft = new BinaryLogicalExpressionNode(left, op, right, nestLevel);\n\t\t}\n\n\t\tindex = i;\n\t\texpression = left;\n\t\treturn true;\n\t}\n}\n\ninternal static class LogicalOperandParser\n{\n\tprivate static readonly ILogicalExpressionParser[] _parsers =\n\t{\n\t\tnew FunctionLogicalExpressionParser(),\n\t\tnew ValueComparisonLogicalExpressionParser(),\n\t\tnew ExistsLogicalExpressionParser(),\n\t\tnew UnaryLogicalExpressionParser()\n\t};\n\n\tpublic static bool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out LogicalExpressionNode? expression, PathParsingOptions options)\n\t{\n\t\tif (source[index] == '(')\n\t\t{\n\t\t\tint i = index + 1;\n\t\t\tif (LogicalExpressionParser.TryParse(source, ref i, nestLevel + 1, out var local, options))\n\t\t\t{\n\t\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t\t{\n\t\t\t\t\texpression = null;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (source[i] == ')')\n\t\t\t\t{\n\t\t\t\t\tindex = i + 1;\n\t\t\t\t\texpression = local;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tforeach (var parser in _parsers)\n\t\t{\n\t\t\tif (parser.TryParse(source, ref index, nestLevel, out expression, options)) return true;\n\t\t}\n\n\t\texpression = null;\n\t\treturn false;\n\t}\n}", + "snippet": "using System.Diagnostics.CodeAnalysis;\nusing System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal abstract class LogicalExpressionNode : ExpressionNode, IFilterExpression\n{\n\tpublic abstract b" + }, + { + "title": "src/JsonPath/Expressions/MultiplyOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/MultiplyOperator.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/MultiplyOperator.cs", + "startLine": 1, + "endLine": 25, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class MultiplyOperator : IBinaryValueOperator\n{\n\tpublic int Precedence => 2;\n\n\tpublic PathValue? Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left is null || right is null) return null;\n\n\t\tif (!left.TryGetJson(out var lNode) || lNode is not JsonValue lValue ||\n\t\t !right.TryGetJson(out var rNode) || rNode is not JsonValue rValue)\n\t\t\treturn null;\n\n\t\treturn (JsonNode?)(lValue.GetNumber() * rValue.GetNumber());\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"*\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class MultiplyOperator : IBinaryValueOperator\n{\n\tpublic int Precedence => 2;\n\n\tpublic PathValue? Evaluate(PathValue? left, PathVa" + }, + { + "title": "src/JsonPath/Expressions/NotEqualToOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/NotEqualToOperator.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/NotEqualToOperator.cs", + "startLine": 1, + "endLine": 27, + "content": "using Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class NotEqualToOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left is null) return right is not null;\n\t\tif (right is null) return true;\n\n\t\tvar lSuccess = left.TryGetJson(out var lNode) && !ReferenceEquals(lNode, ValueFunctionDefinition.Nothing);\n\t\tvar rSuccess = right.TryGetJson(out var rNode) && !ReferenceEquals(rNode, ValueFunctionDefinition.Nothing);\n\n\t\tif (!lSuccess && !rSuccess) return false;\n\t\tif (!lSuccess || !rSuccess) return true;\n\n\t\treturn !lNode.IsEquivalentTo(rNode);\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"!=\";\n\t}\n}", + "snippet": "using Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class NotEqualToOperator : IBinaryComparativeOperator\n{\n\tpublic int Precedence => 10;\n\n\tpublic bool Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left i" + }, + { + "title": "src/JsonPath/Expressions/NotOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/NotOperator.cs#L1-L16", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/NotOperator.cs", + "startLine": 1, + "endLine": 16, + "content": "namespace Json.Path.Expressions;\n\ninternal class NotOperator : IUnaryLogicalOperator\n{\n\tpublic int Precedence => 20;\n\n\tpublic bool Evaluate(bool value)\n\t{\n\t\treturn !value;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"!\";\n\t}\n}", + "snippet": "namespace Json.Path.Expressions;\n\ninternal class NotOperator : IUnaryLogicalOperator\n{\n\tpublic int Precedence => 20;\n\n\tpublic bool Evaluate(bool value)\n\t{\n\t\treturn !value;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\tretu" + }, + { + "title": "src/JsonPath/Expressions/Operators.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/Operators.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/Operators.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Path.Expressions;\n\ninternal static class Operators\n{\n\tpublic static readonly IBinaryValueOperator Add = new AddOperator();\n\tpublic static readonly IBinaryValueOperator Subtract = new SubtractOperator();\n\tpublic static readonly IBinaryValueOperator Multiply = new MultiplyOperator();\n\tpublic static readonly IBinaryValueOperator Divide = new DivideOperator();\n\n\tpublic static readonly IBinaryComparativeOperator EqualTo = new EqualToOperator();\n\tpublic static readonly IBinaryComparativeOperator NotEqualTo = new NotEqualToOperator();\n\tpublic static readonly IBinaryComparativeOperator LessThan = new LessThanOperator();\n\tpublic static readonly IBinaryComparativeOperator LessThanOrEqualTo = new LessThanOrEqualToOperator();\n\tpublic static readonly IBinaryComparativeOperator GreaterThan = new GreaterThanOperator();\n\tpublic static readonly IBinaryComparativeOperator GreaterThanOrEqualTo = new GreaterThanOrEqualToOperator();\n\tpublic static readonly IBinaryComparativeOperator In = new InOperator();\n\n\tpublic static readonly IBinaryLogicalOperator And = new AndOperator();\n\tpublic static readonly IBinaryLogicalOperator Or = new OrOperator();\n\n\tpublic static readonly IUnaryLogicalOperator Not = new NotOperator();\n}\n\ninternal static class ValueOperatorParser\n{\n\tpublic static bool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out IBinaryValueOperator? op)\n\t{\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t{\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tswitch (source[index])\n\t\t{\n\t\t\tcase '+':\n\t\t\t\top = Operators.Add;\n\t\t\t\tindex++;\n\t\t\t\tbreak;\n\t\t\tcase '-':\n\t\t\t\top = Operators.Subtract;\n\t\t\t\tindex++;\n\t\t\t\tbreak;\n\t\t\tcase '*':\n\t\t\t\top = Operators.Multiply;\n\t\t\t\tindex++;\n\t\t\t\tbreak;\n\t\t\tcase '/':\n\t\t\t\top = Operators.Divide;\n\t\t\t\tindex++;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\top = null;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn op != null;\n\t}\n}\n\ninternal static class ComparativeOperatorParser\n{\n\t// .ToCharArray() used because netstandard 2.0 doesn't define implicit string -> span\n\tprivate static readonly char[] _equalTo = \"==\".ToCharArray();\n\tprivate static readonly char[] _notEqualTo = \"!=\".ToCharArray();\n\tprivate static readonly char[] _lessThanOrEqualTo = \"<=\".ToCharArray();\n\tprivate static readonly char[] _greaterThanOrEqualTo = \">=\".ToCharArray();\n\tprivate const char _lessThan = '<';\n\tprivate const char _greaterThan = '>';\n\tprivate static readonly char[] _in = \"in\".ToCharArray();\n\n\tpublic static bool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out IBinaryComparativeOperator? op)\n\t{\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t{\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (index > source.Length - 2)\n\t\t{\n\t\t\t// no need to check for < or > because there would be no room for an operand\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tvar portion = source[index..(index + 2)];\n\n\t\tif (portion.Equals(_equalTo, StringComparison.Ordinal))\n\t\t{\n\t\t\top = Operators.EqualTo;\n\t\t\tindex += 2;\n\t\t}\n\t\telse if (portion.Equals(_notEqualTo, StringComparison.Ordinal))\n\t\t{\n\t\t\top = Operators.NotEqualTo;\n\t\t\tindex += 2;\n\t\t}\n\t\telse if (portion.Equals(_lessThanOrEqualTo, StringComparison.Ordinal))\n\t\t{\n\t\t\top = Operators.LessThanOrEqualTo;\n\t\t\tindex += 2;\n\t\t}\n\t\telse if (portion.Equals(_greaterThanOrEqualTo, StringComparison.Ordinal))\n\t\t{\n\t\t\top = Operators.GreaterThanOrEqualTo;\n\t\t\tindex += 2;\n\t\t}\n\t\telse if (source[index] == _lessThan)\n\t\t{\n\t\t\top = Operators.LessThan;\n\t\t\tindex++;\n\t\t}\n\t\telse if (source[index] == _greaterThan)\n\t\t{\n\t\t\top = Operators.GreaterThan;\n\t\t\tindex++;", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Path.Expressions;\n\ninternal static class Operators\n{\n\tpublic static readonly IBinaryValueOperator Add = new AddOperator();\n\tpublic static readonly IBin" + }, + { + "title": "src/JsonPath/Expressions/Operators.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/Operators.cs#L121-L195", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/Operators.cs", + "startLine": 121, + "endLine": 195, + "content": "}\n\t\telse if (portion.Equals(_in, StringComparison.Ordinal))\n\t\t{\n\t\t\top = Operators.In;\n\t\t\tindex += 2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n}\n\ninternal static class BinaryLogicalOperatorParser\n{\n\tpublic static bool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out IBinaryLogicalOperator? op)\n\t{\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t{\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (index > source.Length - 2)\n\t\t{\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tvar portion = source[index..(index + 2)];\n\n\t\tif (portion.Equals(\"&&\".AsSpan(), StringComparison.Ordinal))\n\t\t{\n\t\t\top = Operators.And;\n\t\t\tindex += 2;\n\t\t}\n\t\telse if (portion.Equals(\"||\".AsSpan(), StringComparison.Ordinal))\n\t\t{\n\t\t\top = Operators.Or;\n\t\t\tindex += 2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n}\n\ninternal static class UnaryLogicalOperatorParser\n{\n\tpublic static bool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out IUnaryLogicalOperator? op)\n\t{\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t{\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (source[index] == '!')\n\t\t{\n\t\t\top = Operators.Not;\n\t\t\tindex++;\n\t\t\treturn true;\n\t\t}\n\n\t\top = null;\n\t\treturn false;\n\t}\n}", + "snippet": "}\n\t\telse if (portion.Equals(_in, StringComparison.Ordinal))\n\t\t{\n\t\t\top = Operators.In;\n\t\t\tindex += 2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\top = null;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n}\n\ninternal static class BinaryLogicalOperatorPars" + }, + { + "title": "src/JsonPath/Expressions/OrOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/OrOperator.cs#L1-L16", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/OrOperator.cs", + "startLine": 1, + "endLine": 16, + "content": "namespace Json.Path.Expressions;\n\ninternal class OrOperator : IBinaryLogicalOperator\n{\n\tpublic int Precedence => 21;\n\n\tpublic bool Evaluate(bool left, bool right)\n\t{\n\t\treturn left || right;\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"||\";\n\t}\n}", + "snippet": "namespace Json.Path.Expressions;\n\ninternal class OrOperator : IBinaryLogicalOperator\n{\n\tpublic int Precedence => 21;\n\n\tpublic bool Evaluate(bool left, bool right)\n\t{\n\t\treturn left || right;\n\t}\n\n\tpublic override string To" + }, + { + "title": "src/JsonPath/Expressions/PathValue.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/PathValue.cs#L1-L51", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/PathValue.cs", + "startLine": 1, + "endLine": 51, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal abstract class PathValue\n{\n\tpublic bool TryGetJson(out JsonNode? node)\n\t{\n\t\tswitch (this)\n\t\t{\n\t\t\tcase JsonPathValue v:\n\t\t\t\tnode = v.Value;\n\t\t\t\treturn true;\n\t\t\tcase NodeListPathValue n:\n\t\t\t\treturn n.Value.TryGetSingleValue(out node);\n\t\t\tdefault:\n\t\t\t\tnode = null;\n\t\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic static implicit operator PathValue(JsonNode? node)\n\t{\n\t\treturn new JsonPathValue { Value = node };\n\t}\n\n\tpublic static implicit operator PathValue?(bool? node)\n\t{\n\t\treturn node == null ? null : new LogicalPathValue { Value = node.Value };\n\t}\n\n\tpublic static implicit operator PathValue?(NodeList? node)\n\t{\n\t\treturn node == null ? null : new NodeListPathValue { Value = node };\n\t}\n}\n\ninternal class JsonPathValue : PathValue\n{\n\tpublic JsonNode? Value { get; set; }\n}\n\ninternal class LogicalPathValue : PathValue\n{\n\tpublic bool Value { get; set; }\n}\n\ninternal class NodeListPathValue : PathValue\n{\n\tpublic NodeList Value { get; set; } = NodeList.Empty;\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal abstract class PathValue\n{\n\tpublic bool TryGetJson(out JsonNode? node)\n\t{\n\t\tswitch (this)\n\t\t{\n\t\t\tcase JsonPathValue v:\n\t\t\t\tnode = v.Value;\n\t\t\t\tret" + }, + { + "title": "src/JsonPath/Expressions/PathValueExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/PathValueExpressionNode.cs#L1-L58", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/PathValueExpressionNode.cs", + "startLine": 1, + "endLine": 58, + "content": "using System.Diagnostics.CodeAnalysis;\nusing System;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class PathValueExpressionNode : LeafValueExpressionNode\n{\n\tpublic JsonPath Path { get; }\n\n\tpublic PathValueExpressionNode(JsonPath path)\n\t{\n\t\tPath = path;\n\t}\n\n\tpublic override PathValue? Evaluate(JsonNode? globalParameter, JsonNode? localParameter)\n\t{\n\t\tvar parameter = Path.Scope == PathScope.Global\n\t\t\t? globalParameter\n\t\t\t: localParameter;\n\n\t\tvar result = Path.Evaluate(globalParameter, parameter);\n\n\t\treturn result.Matches;\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tPath.BuildString(builder);\n\t}\n\n\tpublic static implicit operator PathValueExpressionNode(JsonPath value)\n\t{\n\t\treturn new PathValueExpressionNode(value);\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn Path.ToString();\n\t}\n}\n\ninternal class PathValueExpressionParser : IValueExpressionParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out ValueExpressionNode? expression, PathParsingOptions options)\n\t{\n\t\tif (!PathParser.TryParse(source, ref index, out var path, options))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\texpression = new PathValueExpressionNode(path);\n\t\treturn true;\n\t}\n}", + "snippet": "using System.Diagnostics.CodeAnalysis;\nusing System;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class PathValueExpressionNode : LeafValueExpressionNode\n{\n\tpublic JsonPath" + }, + { + "title": "src/JsonPath/Expressions/SubtractOperator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/SubtractOperator.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/SubtractOperator.cs", + "startLine": 1, + "endLine": 25, + "content": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class SubtractOperator : IBinaryValueOperator\n{\n\tpublic int Precedence => 1;\n\n\tpublic PathValue? Evaluate(PathValue? left, PathValue? right)\n\t{\n\t\tif (left is null || right is null) return null;\n\n\t\tif (!left.TryGetJson(out var lNode) || lNode is not JsonValue lValue ||\n\t\t !right.TryGetJson(out var rNode) || rNode is not JsonValue rValue)\n\t\t\treturn null;\n\n\t\treturn (JsonNode?)(lValue.GetNumber() - rValue.GetNumber());\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn \"-\";\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing Json.More;\n\nnamespace Json.Path.Expressions;\n\ninternal class SubtractOperator : IBinaryValueOperator\n{\n\tpublic int Precedence => 1;\n\n\tpublic PathValue? Evaluate(PathValue? left, PathVa" + }, + { + "title": "src/JsonPath/Expressions/UnaryLogicalExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/UnaryLogicalExpressionNode.cs#L1-L81", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/UnaryLogicalExpressionNode.cs", + "startLine": 1, + "endLine": 81, + "content": "using System.Diagnostics.CodeAnalysis;\nusing System;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class UnaryLogicalExpressionNode : CompositeLogicalExpressionNode\n{\n\tpublic IUnaryLogicalOperator Operator { get; }\n\tpublic LogicalExpressionNode Value { get; }\n\n\tpublic UnaryLogicalExpressionNode(IUnaryLogicalOperator op, LogicalExpressionNode value)\n\t{\n\t\tOperator = op;\n\t\tValue = value;\n\t}\n\n\tpublic override bool Evaluate(JsonNode? globalParameter, JsonNode? localParameter)\n\t{\n\t\treturn Operator.Evaluate(Value.Evaluate(globalParameter, localParameter));\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tvar useGroup = Operator is NotOperator && Value is ValueComparisonLogicalExpressionNode or BinaryLogicalExpressionNode;\n\n\t\tbuilder.Append(Operator);\n\t\tif (useGroup)\n\t\t\tbuilder.Append('(');\n\t\tValue.BuildString(builder);\n\t\tif (useGroup)\n\t\t\tbuilder.Append(')');\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn $\"{Operator}{Value}\";\n\t}\n}\n\ninternal class UnaryLogicalExpressionParser : ILogicalExpressionParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out LogicalExpressionNode? expression, PathParsingOptions options)\n\t{\n\t\t// currently only the \"not\" operator is known\n\t\t// it expects a ! then either a comparison or logical expression\n\n\t\tvar i = index;\n\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// parse operator\n\t\tif (!UnaryLogicalOperatorParser.TryParse(source, ref i, out var op))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// parse comparison\n\t\tif (!LogicalExpressionParser.TryParse(source, ref i, nestLevel, out var right, options))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\texpression = new UnaryLogicalExpressionNode(op, right);\n\t\tindex = i;\n\t\treturn true;\n\t}\n}", + "snippet": "using System.Diagnostics.CodeAnalysis;\nusing System;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class UnaryLogicalExpressionNode : CompositeLogicalExpressionNode\n{\n\tpubli" + }, + { + "title": "src/JsonPath/Expressions/ValueComparisonLogicalExpressionNode.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/ValueComparisonLogicalExpressionNode.cs#L1-L99", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/ValueComparisonLogicalExpressionNode.cs", + "startLine": 1, + "endLine": 99, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class ValueComparisonLogicalExpressionNode : LeafLogicalExpressionNode\n{\n\tpublic ValueExpressionNode Left { get; }\n\tpublic IBinaryComparativeOperator Operator { get; }\n\tpublic ValueExpressionNode Right { get; }\n\n\tpublic ValueComparisonLogicalExpressionNode(ValueExpressionNode left, IBinaryComparativeOperator op, ValueExpressionNode right)\n\t{\n\t\tLeft = left;\n\t\tOperator = op;\n\t\tRight = right;\n\t}\n\n\tpublic override bool Evaluate(JsonNode? globalParameter, JsonNode? localParameter)\n\t{\n\t\treturn Operator.Evaluate(Left.Evaluate(globalParameter, localParameter), Right.Evaluate(globalParameter, localParameter));\n\t}\n\n\tpublic override void BuildString(StringBuilder builder)\n\t{\n\t\tLeft.BuildString(builder);\n\t\tbuilder.Append(Operator);\n\t\tRight.BuildString(builder);\n\t}\n\n\tpublic override string ToString()\n\t{\n\t\treturn $\"{Left}{Operator}{Right}\";\n\t}\n}\n\ninternal class ValueComparisonLogicalExpressionParser : ILogicalExpressionParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out LogicalExpressionNode? expression, PathParsingOptions options)\n\t{\n\t\tvar i = index;\n\n\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// parse value\n\t\tif (!ValueExpressionParser.TryParse(source, ref i, 0, out var left, options))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// parse operator\n\t\tif (!ComparativeOperatorParser.TryParse(source, ref i, out var op))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (op is InOperator && !options.AllowInOperator)\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// parse value\n\t\tif (!ValueExpressionParser.TryParse(source, ref i, 0, out var right, options))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (IsNonSingularPath(left) || IsNonSingularPath(right))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\texpression = new ValueComparisonLogicalExpressionNode(left, op, right);\n\t\tindex = i;\n\t\treturn true;\n\t}\n\n\tprivate static bool IsNonSingularPath(ValueExpressionNode node)\n\t{\n\t\treturn node is PathValueExpressionNode { Path.IsSingular: false };\n\t}\n}", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal class ValueComparisonLogicalExpressionNode : LeafLogicalExpressionNode\n{\n\t" + }, + { + "title": "src/JsonPath/Expressions/ValueExpressionNode.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/ValueExpressionNode.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/ValueExpressionNode.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Diagnostics.CodeAnalysis;\nusing System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal abstract class ValueExpressionNode : ExpressionNode\n{\n\tpublic abstract PathValue? Evaluate(JsonNode? globalParameter, JsonNode? localParameter);\n}\n\ninternal abstract class LeafValueExpressionNode : ValueExpressionNode\n{\n\t// may only need this abstraction as a parser, not in the model\n}\n\ninternal static class ValueExpressionParser\n{\n\tpublic static bool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out ValueExpressionNode? expression, PathParsingOptions options)\n\t{\n\t\tint i = index;\n\n\t\tint Precedence(IBinaryValueOperator op) => nestLevel * 10 + op.Precedence;\n\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\t// first get an operand\n\t\tif (!ValueOperandParser.TryParse(source, ref i, nestLevel, out var left, options))\n\t\t{\n\t\t\texpression = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!options.AllowMathOperations)\n\t\t{\n\t\t\tindex = i;\n\t\t\texpression = left;\n\t\t\treturn true;\n\t\t}\n\n\t\twhile (i < source.Length)\n\t\t{\n\t\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t\t{\n\t\t\t\texpression = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// parse operator\n\t\t\tif (!ValueOperatorParser.TryParse(source, ref i, out var op))\n\t\t\t\tbreak; // if we don't get an op, then we're done\n\n\t\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t\t{\n\t\t\t\texpression = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// parse right\n\t\t\tif (!ValueOperandParser.TryParse(source, ref i, nestLevel, out var right, options))\n\t\t\t{\n\t\t\t\texpression = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// assemble\n\t\t\tif (left is CompositeValueExpressionNode bin && bin.Precedence < Precedence(op))\n\t\t\t\tbin.Right = new CompositeValueExpressionNode(bin.Right, op, right, nestLevel);\n\t\t\telse\n\t\t\t\tleft = new CompositeValueExpressionNode(left, op, right, nestLevel);\n\t\t}\n\n\t\tindex = i;\n\t\texpression = left;\n\t\treturn true;\n\t}\n}\n\ninternal class ValueOperandParser\n{\n\tprivate static readonly IValueExpressionParser[] _parsers =\n\t{\n\t\tnew FunctionValueExpressionParser(),\n\t\tnew LiteralValueExpressionParser(),\n\t\tnew PathValueExpressionParser()\n\t};\n\n\tpublic static bool TryParse(ReadOnlySpan source, ref int index, int nestLevel, [NotNullWhen(true)] out ValueExpressionNode? expression, PathParsingOptions options)\n\t{\n\t\tif (source[index] == '(')\n\t\t{\n\t\t\tint i = index + 1;\n\t\t\tif (ValueExpressionParser.TryParse(source, ref i, nestLevel + 1, out var local, options))\n\t\t\t{\n\t\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t\t{\n\t\t\t\t\texpression = null;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (source[i] == ')')\n\t\t\t\t{\n\t\t\t\t\tindex = i + 1;\n\t\t\t\t\texpression = local;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tforeach (var parser in _parsers)\n\t\t{\n\t\t\tif (parser.TryParse(source, ref index, nestLevel, out expression, options)) return true;\n\t\t}\n\n\t\texpression = null;\n\t\treturn false;", + "snippet": "using System.Diagnostics.CodeAnalysis;\nusing System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path.Expressions;\n\ninternal abstract class ValueExpressionNode : ExpressionNode\n{\n\tpublic abstract PathValue? Evaluate(Js" + }, + { + "title": "src/JsonPath/Expressions/ValueExpressionNode.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Expressions/ValueExpressionNode.cs#L121-L122", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Expressions/ValueExpressionNode.cs", + "startLine": 121, + "endLine": 122, + "content": "}\n}", + "snippet": "}\n}" + }, + { + "title": "src/JsonPath/FilterSelector.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/FilterSelector.cs#L1-L97", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/FilterSelector.cs", + "startLine": 1, + "endLine": 97, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.Path.Expressions;\n\nnamespace Json.Path;\n\n/// \n/// Represents a filter expression selector.\n/// \npublic class FilterSelector : ISelector\n{\n\t/// \n\t/// Gets the expression.\n\t/// \n\tpublic IFilterExpression Expression { get; }\n\n\tinternal FilterSelector(LogicalExpressionNode expression)\n\t{\n\t\tExpression = expression;\n\t}\n\n\t/// \n\t/// Evaluates the selector.\n\t/// \n\t/// The node to evaluate.\n\t/// The root node (typically used by filter selectors, e.g. `$[?@foo < $.bar]`)\n\t/// \n\t/// A collection of nodes.\n\t///\n\t/// Semantically, this is a nodelist, but leaving as IEnumerable<Node> allows for deferred execution.\n\t/// \n\tpublic IEnumerable Evaluate(Node match, JsonNode? rootNode)\n\t{\n\t\tvar node = match.Value;\n\t\tif (node is JsonObject obj)\n\t\t{\n\t\t\tforeach (var member in obj)\n\t\t\t{\n\t\t\t\tif (Expression.Evaluate(rootNode, member.Value))\n\t\t\t\t\tyield return new Node(member.Value, match.Location!.Append(member.Key));\n\t\t\t}\n\t\t}\n\t\telse if (node is JsonArray arr)\n\t\t{\n\t\t\tfor (var i = 0; i < arr.Count; i++)\n\t\t\t{\n\t\t\t\tvar member = arr[(Index)i];\n\t\t\t\tif (Expression.Evaluate(rootNode, member))\n\t\t\t\t\tyield return new Node(member, match.Location!.Append(i));\n\t\t\t}\n\t\t}\n\t}\n\n\t/// \n\t/// Builds a string using a string builder.\n\t/// \n\t/// The string builder.\n\tpublic void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append('?');\n\t\tExpression.BuildString(builder);\n\t}\n\n\t/// Returns a string that represents the current object.\n\t/// A string that represents the current object.\n\tpublic override string ToString()\n\t{\n\t\treturn $\"?{Expression}\";\n\t}\n}\n\ninternal class FilterSelectorParser : ISelectorParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out ISelector? selector, PathParsingOptions options)\n\t{\n\t\tif (source[index] != '?')\n\t\t{\n\t\t\tselector = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tint i = index;\n\t\ti++; // consume ?\n\t\tif (!ExpressionParser.TryParse(source, ref i, out var expression, options))\n\t\t{\n\t\t\tselector = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tindex = i;\n\t\tselector = new FilterSelector(expression);\n\t\treturn true;\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Json.Path.Expressions;\n\nnamespace Json.Path;\n\n/// \n/// Represents a f" + }, + { + "title": "src/JsonPath/FunctionRepository.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/FunctionRepository.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/FunctionRepository.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Stores expression function definitions.\n/// \npublic static class FunctionRepository\n{\n\tprivate static readonly Dictionary _functions = [];\n\n\tstatic FunctionRepository()\n\t{\n\t\tRegisterValueFunction();\n\t\tRegisterValueFunction();\n\t\tRegisterLogicalFunction();\n\t\tRegisterLogicalFunction();\n\t\tRegisterValueFunction();\n\t}\n\n\t/// \n\t/// Registers a new function implementation, allowing it to be parsed.\n\t/// \n\t/// The function.\n\t[RequiresUnreferencedCode(\"Use the overloads that take a Type for AOT compatibility\")]\n\tpublic static void Register(ValueFunctionDefinition function)\n\t{\n\t\tRegister(function, function.GetType());\n\t}\n\n\t/// \n\t/// Registers a new function implementation, allowing it to be parsed.\n\t/// \n\t/// The function.\n\t/// The type of the function.\n\tpublic static void Register(ValueFunctionDefinition function,\n\t\t[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type functionType)\n\t{\n\t\t_functions[function.Name] = function;\n\n\t\tFindEvaluationMethods(function, functionType, typeof(JsonNode));\n\t}\n\n\t/// \n\t/// Registers a new function implementation, allowing it to be parsed.\n\t/// \n\t/// The function.\n\t[RequiresUnreferencedCode(\"Use the overloads that take a Type for AOT compatibility\")]\n\tpublic static void Register(LogicalFunctionDefinition function)\n\t{\n\t\tRegister(function, function.GetType());\n\t}\n\n\t/// \n\t/// Registers a new function implementation, allowing it to be parsed.\n\t/// \n\t/// The function.\n\t/// The type of the function.\n\tpublic static void Register(LogicalFunctionDefinition function,\n\t\t[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type functionType)\n\t{\n\t\t_functions[function.Name] = function;\n\n\t\tFindEvaluationMethods(function, functionType, typeof(bool));\n\t}\n\n\t/// \n\t/// Registers a new function implementation, allowing it to be parsed.\n\t/// \n\t/// The function.\n\t[RequiresUnreferencedCode(\"Use the overloads that take a Type for AOT compatibility\")]\n\tpublic static void Register(NodelistFunctionDefinition function)\n\t{\n\t\tRegister(function, function.GetType());\n\t}\n\n\t/// \n\t/// Registers a new function implementation, allowing it to be parsed.\n\t/// \n\t/// The function.\n\t/// The function type.\n\tpublic static void Register(NodelistFunctionDefinition function,\n\t\t[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type functionType)\n\t{\n\t\t_functions[function.Name] = function;\n\n\t\tFindEvaluationMethods(function, functionType, typeof(NodeList));\n\t}\n\n\t/// \n\t/// Registers a new function implementation, allowing it to be parsed.\n\t/// \n\tpublic static void RegisterValueFunction<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>() \n\t\twhere T : ValueFunctionDefinition, new ()\n\t{\n\t\tRegister(new T(), typeof(T));\n\t}\n\n\t/// \n\t/// Registers a new function implementation, allowing it to be parsed.\n\t/// \n\tpublic static void RegisterLogicalFunction<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>() \n\t\twhere T : LogicalFunctionDefinition, new()\n\t{\n\t\tRegister(new T(), typeof(T));\n\t}\n\n\t/// \n\t/// Registers a new function implementation, allowing it to be parsed.\n\t/// \n\tpublic static void RegisterNodelistFunction<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>()\n\t\twhere T : NodelistFunctionDefinition, new()\n\t{\n\t\tRegister(new T(), typeof(T));\n\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Stores expression " + }, + { + "title": "src/JsonPath/FunctionRepository.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/FunctionRepository.cs#L121-L184", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/FunctionRepository.cs", + "startLine": 121, + "endLine": 184, + "content": "/// \n\t/// Unregisters a function implementation.\n\t/// \n\t/// The type of function.\n\tpublic static void Unregister()\n\t\twhere T : IPathFunctionDefinition\n\t{\n\t\tvar function = _functions.Values.FirstOrDefault(x => x is T);\n\t\tif (function == null) return;\n\n\t\t_functions.Remove(function.Name);\n\t}\n\n\t/// \n\t/// Unregisters a function implementation.\n\t/// \n\tpublic static void Unregister(string name)\n\t{\n\t\t_functions.Remove(name);\n\t}\n\n\t/// \n\t/// Gets a function implementation by name.\n\t/// \n\t/// A function name.\n\t/// The function, if found; otherwise null.\n\t/// True if found; otherwise false.\n\tpublic static bool TryGet(string name, [NotNullWhen(true)] out IPathFunctionDefinition? function)\n\t{\n\t\treturn _functions.TryGetValue(name, out function);\n\t}\n\n\tprivate static void FindEvaluationMethods(\n\t\tIReflectiveFunctionDefinition function,\n\t\t[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type functionType,\n\t\tType returnType)\n\t{\n\t\tvar methods = functionType.GetMethods(BindingFlags.Public | BindingFlags.Instance)\n\t\t\t.Where(m => m.Name == \"Evaluate\" && m.ReturnType == returnType)\n\t\t\t.ToList();\n\n\t\tif (methods.Count == 0)\n\t\t\tthrow new ArgumentException($\"Cannot find an 'Evaluate' method that returns type '{returnType.FullName}'.\");\n\t\tif (methods.Count > 1)\n\t\t\tthrow new ArgumentException($\"Found more than one 'Evaluate' method that returns type '{returnType.FullName}'. Overloads are not permitted.\");\n\n\t\tvar method = methods[0];\n\n\t\tvar parameters = method.GetParameters()\n\t\t\t.Select(x =>\n\t\t\t{\n\t\t\t\tif (x.ParameterType == typeof(JsonNode)) return FunctionType.Value;\n\t\t\t\tif (x.ParameterType == typeof(bool)) return FunctionType.Logical;\n\t\t\t\tif (x.ParameterType == typeof(NodeList)) return FunctionType.Nodelist;\n\t\t\t\treturn (FunctionType?)null;\n\t\t\t}).ToArray();\n\n\t\tif (parameters.Any(x => x == null))\n\t\t\tthrow new ArgumentException($\"'Evaluate' method parameters may only be of types '{typeof(JsonNode)}', '{typeof(bool)}', or '{typeof(NodeList)}'.\");\n\n\t\tfunction.Evaluator = (parameters.Cast().ToArray(), method);\n\t}\n}", + "snippet": "/// \n\t/// Unregisters a function implementation.\n\t/// \n\t/// The type of function.\n\tpublic static void Unregister()\n\t\twhere T : IPathFunctionDefinition\n\t{\n\t\tvar functi" + }, + { + "title": "src/JsonPath/FunctionType.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/FunctionType.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/FunctionType.cs", + "startLine": 1, + "endLine": 26, + "content": "namespace Json.Path;\n\n/// \n/// Indicates the return type of a filter expression function.\n/// \npublic enum FunctionType\n{\n\t/// \n\t/// Holder for a default value. Not an actual valid function type.\n\t/// \n\tUnspecified,\n\t/// \n\t/// Indicates the function returns a JSON-like value that can be\n\t/// compared with equality and inequality operators.\n\t/// \n\tValue,\n\t/// \n\t/// Indicates the function returns a non-JSON boolean value that can be\n\t/// compared with logical operators.\n\t/// \n\tLogical,\n\t/// \n\t/// Indicates the function returns a nodelist.\n\t/// \n\tNodelist\n}", + "snippet": "namespace Json.Path;\n\n/// \n/// Indicates the return type of a filter expression function.\n/// \npublic enum FunctionType\n{\n\t/// \n\t/// Holder for a default value. Not an actual valid function t" + }, + { + "title": "src/JsonPath/GeneralExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/GeneralExtensions.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/GeneralExtensions.cs", + "startLine": 1, + "endLine": 30, + "content": "using System;\nusing System.Linq;\nusing Json.Path.Expressions;\n\nnamespace Json.Path;\n\ninternal static class GeneralExtensions\n{\n\tpublic static object?[] ExtractArgumentValues(this object?[] arguments, FunctionType[] parameterTypes)\n\t{\n\t\treturn arguments\n\t\t\t.Zip(parameterTypes, (a, p) => (a,p))\n\t\t\t.Select(x =>\n\t\t{\n\t\t\treturn (object?)(x.a switch\n\t\t\t{\n\t\t\t\tJsonPathValue j => j.Value,\n\t\t\t\tLogicalPathValue l => l.Value,\n\t\t\t\tNodeListPathValue n => x.p switch\n\t\t\t\t{\n\t\t\t\t\t FunctionType.Value => n.Value.Count == 1 ? n.Value[0].Value : null,\n\t\t\t\t\t FunctionType.Logical => n.Value.Count == 0,\n\t\t\t\t\t FunctionType.Nodelist => n.Value,\n\t\t\t\t\t _ => throw new ArgumentOutOfRangeException()\n\t\t\t\t},\n\t\t\t\t_ => null\n\t\t\t});\n\t\t}).ToArray();\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing Json.Path.Expressions;\n\nnamespace Json.Path;\n\ninternal static class GeneralExtensions\n{\n\tpublic static object?[] ExtractArgumentValues(this object?[] arguments, FunctionType[] param" + }, + { + "title": "src/JsonPath/IFilterExpression.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/IFilterExpression.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/IFilterExpression.cs", + "startLine": 1, + "endLine": 25, + "content": "using System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Exposes the filter expression.\n/// \npublic interface IFilterExpression\n{\n\t/// \n\t/// Evaluates the selector.\n\t/// \n\t/// The root node of the data, represented by `$`.\n\t/// The current node in the filter, represented by `@`.\n\t/// \n\t/// true if the node should be selected; false otherwise.\n\t/// \n\tbool Evaluate(JsonNode? globalParameter, JsonNode? localParameter);\n\t/// \n\t/// Builds a string using a string builder.\n\t/// \n\t/// The string builder.\n\tvoid BuildString(StringBuilder builder);\n}", + "snippet": "using System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Exposes the filter expression.\n/// \npublic interface IFilterExpression\n{\n\t/// \n\t/// Evaluates the selector.\n\t//" + }, + { + "title": "src/JsonPath/IHaveShorthand.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/IHaveShorthand.cs#L1-L9", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/IHaveShorthand.cs", + "startLine": 1, + "endLine": 9, + "content": "using System.Text;\n\nnamespace Json.Path;\n\ninternal interface IHaveShorthand\n{\n\tstring ToShorthandString();\n\tvoid AppendShorthandString(StringBuilder builder);\n}", + "snippet": "using System.Text;\n\nnamespace Json.Path;\n\ninternal interface IHaveShorthand\n{\n\tstring ToShorthandString();\n\tvoid AppendShorthandString(StringBuilder builder);\n}" + }, + { + "title": "src/JsonPath/IndexSelector.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/IndexSelector.cs#L1-L79", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/IndexSelector.cs", + "startLine": 1, + "endLine": 79, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Represents an index selector.\n/// \npublic class IndexSelector : ISelector\n{\n\t/// \n\t/// Gets the index.\n\t/// \n\tpublic int Index { get; }\n\n\tinternal IndexSelector(int index)\n\t{\n\t\tIndex = index;\n\t}\n\n\t/// Returns a string that represents the current object.\n\t/// A string that represents the current object.\n\tpublic override string ToString()\n\t{\n\t\treturn Index.ToString();\n\t}\n\n\t/// \n\t/// Evaluates the selector.\n\t/// \n\t/// The node to evaluate.\n\t/// The root node (typically used by filter selectors, e.g. `$[?@foo < $.bar]`)\n\t/// \n\t/// A collection of nodes.\n\t///\n\t/// Semantically, this is a nodelist, but leaving as IEnumerable<Node> allows for deferred execution.\n\t/// \n\tpublic IEnumerable Evaluate(Node match, JsonNode? rootNode)\n\t{\n\t\tvar node = match.Value;\n\t\tif (node is not JsonArray arr) yield break;\n\t\tif (Index >= arr.Count) yield break;\n\n\t\tif (Index < 0)\n\t\t{\n\t\t\tvar adjusted = arr.Count + Index;\n\t\t\tif (adjusted < 0) yield break;\n\t\t\tyield return new Node(arr[adjusted], match.Location!.Append(adjusted));\n\t\t}\n\t\telse yield return new Node(arr[Index], match.Location!.Append(Index));\n\t}\n\n\t/// \n\t/// Builds a string using a string builder.\n\t/// \n\t/// The string builder.\n\tpublic void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append(Index);\n\t}\n}\n\ninternal class IndexSelectorParser : ISelectorParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out ISelector? selector, PathParsingOptions options)\n\t{\n\t\tif (!source.TryGetInt(ref index, out var value))\n\t\t{\n\t\t\tselector = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tselector = new IndexSelector(value);\n\t\treturn true;\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Represents an index selector.\n/// \n/// Defines properties and methods required for an expression function.\n/// \n/// Functions must be registered with one of the static `Register()`\n/// methods defined on \npublic interface IPathFunctionDefinition\n{\n\t/// \n\t/// Gets the function name.\n\t/// \n\tstring Name { get; }\n}\n\ninternal interface IReflectiveFunctionDefinition\n{\n\tinternal (FunctionType[] ArgTypes, MethodInfo Method) Evaluator { get; set; }\n}\n\n/// \n/// Base class for defining an expression function which returns `ValueType`.\n/// \npublic abstract partial class ValueFunctionDefinition : IReflectiveFunctionDefinition, IPathFunctionDefinition\n{\n\tprivate class NothingValue;\n\n\t[JsonSerializable(typeof(NothingValue))]\n\tprivate partial class NothingValueContext : JsonSerializerContext;\n\n\t/// \n\t/// Represents the absence of a JSON value and is distinct from any JSON value, including null.\n\t/// \n\tpublic static JsonValue Nothing { get; } = JsonValue.Create(new NothingValue(), NothingValueContext.Default.NothingValue)!;\n\n\t/// \n\t/// Gets the function name.\n\t/// \n\tpublic abstract string Name { get; }\n\n\t(FunctionType[] ArgTypes, MethodInfo Method) IReflectiveFunctionDefinition.Evaluator { get; set; }\n\n\tinternal PathValue? Invoke(object?[] arguments)\n\t{\n\t\tvar (parameterTypes, method) = ((IReflectiveFunctionDefinition)this).Evaluator;\n\n\t\tif (method == null)\n\t\t\tthrow new InvalidOperationException(\"Cannot find appropriate method. This should have been caught during parsing.\");\n\n\t\tvar result = (JsonNode?)method.Invoke(this, arguments.ExtractArgumentValues(parameterTypes));\n\n\t\treturn result;\n\t}\n}\n\n/// \n/// Base class for defining an expression function which returns `LogicalType`.\n/// \npublic abstract class LogicalFunctionDefinition : IReflectiveFunctionDefinition, IPathFunctionDefinition\n{\n\t/// \n\t/// Gets the function name.\n\t/// \n\tpublic abstract string Name { get; }\n\n\t(FunctionType[] ArgTypes, MethodInfo Method) IReflectiveFunctionDefinition.Evaluator { get; set; }\n\n\tinternal bool? Invoke(object?[] arguments)\n\t{\n\t\tvar (parameterTypes, method) = ((IReflectiveFunctionDefinition)this).Evaluator;\n\n\t\tif (method == null)\n\t\t\tthrow new InvalidOperationException(\"Cannot find appropriate method. This should have been caught during parsing.\");\n\n\t\treturn (bool?)method.Invoke(this, arguments.ExtractArgumentValues(parameterTypes));\n\t}\n}\n\n/// \n/// Base class for defining an expression function which returns `NodesType`.\n/// \npublic abstract class NodelistFunctionDefinition : IReflectiveFunctionDefinition, IPathFunctionDefinition\n{\n\t/// \n\t/// Gets the function name.\n\t/// \n\tpublic abstract string Name { get; }\n\n\t(FunctionType[] ArgTypes, MethodInfo Method) IReflectiveFunctionDefinition.Evaluator { get; set; }\n\n\tinternal NodeList? Invoke(object?[] arguments)\n\t{\n\t\tvar (parameterTypes, method) = ((IReflectiveFunctionDefinition)this).Evaluator;\n\n\t\tif (method == null)\n\t\t\tthrow new InvalidOperationException(\"Cannot find appropriate method. This should have been caught during parsing.\");\n\n\t\treturn (NodeList?)method.Invoke(this, arguments.ExtractArgumentValues(parameterTypes));\n\t}\n}", + "snippet": "using System;\nusing System.Reflection;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Path.Expressions;\n\nnamespace Json.Path;\n\n/// \n/// Defines properties and methods required for" + }, + { + "title": "src/JsonPath/ISelector.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/ISelector.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/ISelector.cs", + "startLine": 1, + "endLine": 29, + "content": "using System.Collections.Generic;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Defines a path segment selector.\n/// \npublic interface ISelector\n{\n\t/// \n\t/// Evaluates the selector.\n\t/// \n\t/// The node to evaluate.\n\t/// The root node (typically used by filter selectors, e.g. `$[?@foo < $.bar]`)\n\t/// \n\t/// A collection of nodes.\n\t///\n\t/// Semantically, this is a nodelist, but leaving as IEnumerable<Node> allows for deferred execution.\n\t/// \n\tIEnumerable Evaluate(Node match, JsonNode? rootNode);\n\n\t/// \n\t/// Builds a string using a string builder.\n\t/// \n\t/// The string builder.\n\tvoid BuildString(StringBuilder builder);\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Defines a path segment selector.\n/// \npublic interface ISelector\n{\n\t/// \n\t///" + }, + { + "title": "src/JsonPath/ISelectorParser.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/ISelectorParser.cs#L1-L9", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/ISelectorParser.cs", + "startLine": 1, + "endLine": 9, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Path;\n\ninternal interface ISelectorParser\n{\n\tbool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out ISelector? selector, PathParsingOptions options);\n}", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Path;\n\ninternal interface ISelectorParser\n{\n\tbool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out ISelector? selector, PathP" + }, + { + "title": "src/JsonPath/JsonNodeExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/JsonNodeExtensions.cs#L1-L100", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/JsonNodeExtensions.cs", + "startLine": 1, + "endLine": 100, + "content": "using System.Diagnostics.CodeAnalysis;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Useful extensions for .\n/// \npublic static class JsonNodeExtensions\n{\n\t/// \n\t/// Extends to the base class.\n\t/// \n\t/// The type of value desired.\n\t/// The node that may contain the value.\n\t/// The value if successful; null otherwise.\n\t/// True if successful; false otherwise.\n\tpublic static bool TryGetValue(this JsonNode? node, [NotNullWhen(true)] out T? value)\n\t{\n\t\tif (node is not JsonValue val)\n\t\t{\n\t\t\tvalue = default;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn val.TryGetValue(out value);\n\t}\n\n\t/// \n\t/// Ensures a only represents a single value.\n\t/// \n\t/// \n\t/// \n\t/// \n\t/// Within the context of this library, a \n\t/// may be stored inside a . Some operations, such as\n\t/// expression addition, require that a single value is provided.\n\t/// \n\t/// This method checks to see if the underlying value of a `JsonNode`\n\t/// is a `NodeList`. If not, it simply sets to the JsonNode\n\t/// and returns true. If the underlying value is a `NodeList` _and_ it only\n\t/// contains a single value, it sets to that JsonNode and\n\t/// return true. Otherwise, it returns false.\n\t/// \n\t/// \n\t/// Though a bit complex, this method can be very important for functions\n\t/// that require single values as inputs rather than nodelists since function\n\t/// composition is possible (e.g. `min(max(@,0),10)`) and functions return nodelists.\n\t/// \n\tpublic static bool TryGetSingleValue(this JsonNode node, out JsonNode? value)\n\t{\n\t\tif (!node.TryGetValue(out var nodeList))\n\t\t{\n\t\t\tvalue = node;\n\t\t\treturn true;\n\t\t}\n\n\t\tif (nodeList.Count == 1)\n\t\t{\n\t\t\tvalue = nodeList[0].Value;\n\t\t\treturn true;\n\t\t}\n\n\t\tvalue = null;\n\t\treturn false;\n\t}\n\n\t/// \n\t/// Ensures a only represents a single value.\n\t/// \n\t/// \n\t/// \n\t/// \n\t/// Within the context of this library, a \n\t/// may be stored inside a . Some operations, such as\n\t/// expression addition, require that a single value is provided.\n\t/// \n\t/// This method checks to see if the underlying value of a `JsonNode`\n\t/// is a `NodeList`. If not, it simply sets to the JsonNode\n\t/// and returns true. If the underlying value is a `NodeList` _and_ it only\n\t/// contains a single value, it sets to that JsonNode and\n\t/// return true. Otherwise, it returns false.\n\t/// \n\t/// \n\t/// Though a bit complex, this method can be very important for functions\n\t/// that require single values as inputs rather than nodelists since function\n\t/// composition is possible (e.g. `min(max(@,0),10)`) and functions return nodelists.\n\t/// \n\tpublic static bool TryGetSingleValue(this NodeList nodeList, out JsonNode? value)\n\t{\n\t\tif (nodeList.Count == 1)\n\t\t{\n\t\t\tvalue = nodeList[0].Value;\n\t\t\treturn true;\n\t\t}\n\n\t\tvalue = null;\n\t\treturn false;\n\t}\n}", + "snippet": "using System.Diagnostics.CodeAnalysis;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Useful extensions for .\n/// \npublic static class JsonNodeExtensions\n{\n\t/// \n/// Represents a JSON Path.\n/// \n[JsonConverter(typeof(JsonPathConverter))]\n[TypeConverter(typeof(JsonPathTypeConverter))]\npublic class JsonPath\n{\n\t/// \n\t/// Gets a JSON Path with only a global root and no selectors, namely `$`.\n\t/// \n\tpublic static JsonPath Root { get; } = new(PathScope.Global, []);\n\n\t/// \n\t/// Gets the scope of the path.\n\t/// \n\tpublic PathScope Scope { get; }\n\n\t/// \n\t/// Gets whether the path is a singular path. That is, it can only return a nodelist\n\t/// containing at most a single value.\n\t/// \n\t/// \n\t/// A singular path can only contain segments which must meet all of the following\n\t/// conditions:\n\t///\n\t/// - is not a recursive descent (`..`)\n\t/// - contains a single selector\n\t/// - that selector is either an index selector or a name selector\n\t///\n\t/// For example, `$['foo'][1]` is a singular path. Shorthand syntax (e.g. `$.foo[1]`)\n\t/// is also allowed.\n\t/// \n\tpublic bool IsSingular => Segments.All(x => !x.IsRecursive &&\n\t x.Selectors.Length == 1 &&\n\t x.Selectors[0] is IndexSelector or NameSelector);\n\n\t/// \n\t/// Gets the segments of the path.\n\t/// \n\tpublic PathSegment[] Segments { get; }\n\n\tinternal JsonPath(PathScope scope, IEnumerable segments)\n\t{\n\t\tScope = scope;\n\t\tSegments = segments.ToArray();\n\t}\n\n\t/// \n\t/// Parses a from a string.\n\t/// \n\t/// The source string.\n\t/// (optional) The parsing options.\n\t/// The parsed path.\n\t/// Thrown if a syntax error occurred.\n\tpublic static JsonPath Parse([StringSyntax(\"jsonpath\")] string source, PathParsingOptions? options = null)\n\t{\n\t\toptions ??= new PathParsingOptions();\n\n\t\tif (options.TolerateExtraWhitespace)\n\t\t\tsource = source.Trim();\n\n\t\tint index = 0;\n\t\treturn PathParser.Parse(source.AsSpan(), ref index, options, !options.AllowRelativePathStart);\n\t}\n\n\t/// \n\t/// Parses a from a string.\n\t/// \n\t/// The source string.\n\t/// (optional) The parsing options.\n\t/// The parsed path, if successful; otherwise null.\n\t/// True if successful; otherwise false.\n\tpublic static bool TryParse([StringSyntax(\"jsonpath\")] string source, [NotNullWhen(true)] out JsonPath? path, PathParsingOptions? options = null)\n\t{\n\t\tif (source.Length == 0)\n\t\t{\n\t\t\tpath = null;\n\t\t\treturn false;\n\t\t}\n\n\t\toptions ??= new PathParsingOptions();\n\t\tif (!options.TolerateExtraWhitespace && (char.IsWhiteSpace(source[0]) || char.IsWhiteSpace(source[^1])))\n\t\t{\n\t\t\tpath = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tsource = source.Trim();\n\n\t\tint index = 0;\n\t\tif (!PathParser.TryParse(source.AsSpan(), ref index, out path, options, !options.AllowRelativePathStart)) return false;\n\t\tif (index != source.Length)\n\t\t{\n\t\t\tpath = null;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/// \n\t/// Evaluates the path against a JSON instance.\n\t/// \n\t/// The root of the JSON instance.\n\t/// Evaluation options.\n\t/// The results of the evaluation.\n\tpublic PathResult Evaluate(JsonNode? root, PathEvaluationOptions? options = null)\n\t{\n\t\tIEnumerable currentMatches = [new(root, Root)];", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization" + }, + { + "title": "src/JsonPath/JsonPath.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/JsonPath.cs#L121-L186", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/JsonPath.cs", + "startLine": 121, + "endLine": 186, + "content": "foreach (var segment in Segments)\n\t\t{\n\t\t\tcurrentMatches = currentMatches.SelectMany(x => segment.Evaluate(x, root));\n\t\t}\n\n\t\treturn new PathResult(new NodeList(currentMatches));\n\t}\n\n\tinternal PathResult Evaluate(JsonNode? globalRoot, JsonNode? localRoot)\n\t{\n\t\tIEnumerable currentMatches = [new(localRoot, Root)];\n\n\t\tforeach (var segment in Segments)\n\t\t{\n\t\t\tcurrentMatches = currentMatches.SelectMany(x => segment.Evaluate(x, globalRoot));\n\t\t}\n\n\t\treturn new PathResult(new NodeList(currentMatches));\n\t}\n\n\t/// \n\t/// Appends a new segment with the specified name to the current JSON path and returns the resulting path.\n\t/// \n\t/// This method can be used to build more complex JSON paths by successively appending named segments.\n\t/// The original JsonPath instance remains unchanged; this method returns a new instance with the additional\n\t/// segment.\n\t/// The name of the segment to append to the JSON path. This value cannot be null or empty.\n\t/// A new instance of the JsonPath class that includes the appended segment.\n\tpublic JsonPath Append(string name) => new(Scope, Segments.Append(new PathSegment(new NameSelector(name).Yield())));\n\n\t/// \n\t/// Appends an array index selector to the current JSON path, enabling access to a specific element within a JSON\n\t/// array.\n\t/// \n\t/// Use this method to navigate to a particular element in a JSON array by its index. Supplying an\n\t/// out-of-range index may result in errors when the path is evaluated against a JSON document.\n\t/// The zero-based index of the element to select from the array. Must be within the bounds of the target array.\n\t/// A new JsonPath instance that includes the appended index selector.\n\tpublic JsonPath Append(int index) => new(Scope, Segments.Append(new PathSegment(new IndexSelector(index).Yield())));\n\n\t/// Returns a string that represents the current object.\n\t/// A string that represents the current object.\n\tpublic override string ToString()\n\t{\n\t\tvar builder = new StringBuilder();\n\n\t\tBuildString(builder);\n\n\t\treturn builder.ToString();\n\t}\n\n\t/// \n\t/// Builds a string representation of the path using a .\n\t/// \n\t/// The string builder.\n\tpublic void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append(Scope == PathScope.Global ? '$' : '@');\n\n\t\tforeach (var segment in Segments)\n\t\t{\n\t\t\tsegment.BuildString(builder);\n\t\t}\n\t}\n}", + "snippet": "foreach (var segment in Segments)\n\t\t{\n\t\t\tcurrentMatches = currentMatches.SelectMany(x => segment.Evaluate(x, root));\n\t\t}\n\n\t\treturn new PathResult(new NodeList(currentMatches));\n\t}\n\n\tinternal PathResult Evaluate(JsonNode?" + }, + { + "title": "src/JsonPath/JsonPathConverter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/JsonPathConverter.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/JsonPathConverter.cs", + "startLine": 1, + "endLine": 32, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\n\nnamespace Json.Path;\n\n/// \n/// JSON converter for .\n/// \npublic class JsonPathConverter : JsonConverter\n{\n\t/// Reads and converts the JSON to type .\n\t/// The reader.\n\t/// The type to convert.\n\t/// An object that specifies serialization options to use.\n\t/// The converted value.\n\tpublic override JsonPath Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar text = reader.GetString()!;\n\t\treturn JsonPath.Parse(text);\n\t}\n\n\t/// Writes a specified value as JSON.\n\t/// The writer to write to.\n\t/// The value to convert to JSON.\n\t/// An object that specifies serialization options to use.\n\tpublic override void Write(Utf8JsonWriter writer, JsonPath value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStringValue(value.ToString());\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\n\nnamespace Json.Path;\n\n/// \n/// JSON converter for .\n/// \npublic class JsonPathConverter : JsonConverte" + }, + { + "title": "src/JsonPath/JsonPathExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/JsonPathExtensions.cs#L1-L50", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/JsonPathExtensions.cs", + "startLine": 1, + "endLine": 50, + "content": "using System;\nusing System.Linq;\n\nnamespace Json.Path;\n\n/// \n/// Provides extended functionality for .\n/// \npublic static class JsonPathExtensions\n{\n\t/// \n\t/// Renders a Singular Path as a JSON Pointer.\n\t/// \n\t/// A JSON Path which is a Singular Path.\n\t/// A string containing a JSON Pointer.\n\t/// Thrown if the path is not singular.\n\tpublic static string AsJsonPointer(this JsonPath path)\n\t{\n\t\treturn string.Concat(path.Segments.Select(x =>\n\t\t{\n\t\t\tif (x.Selectors.Length == 1 && !x.IsRecursive)\n\t\t\t{\n\t\t\t\tvar segment = x.Selectors[0] switch\n\t\t\t\t{\n\t\t\t\t\tIndexSelector index => $\"/{index}\",\n\t\t\t\t\tNameSelector name => $\"/{PointerEncode(name.Name)}\",\n\t\t\t\t\t// ReSharper disable once NotResolvedInText\n\t\t\t\t\t_ => null\n\t\t\t\t};\n\t\t\t\tif (segment != null) return segment;\n\t\t\t}\n\n\t\t\tif (x.Selectors.Length == 2)\n\t\t\t{\n\t\t\t\tvar index = x.Selectors.OfType().FirstOrDefault();\n\t\t\t\tvar name = x.Selectors.OfType().FirstOrDefault();\n\n\t\t\t\tif (index != null && name != null && name.Name == index.Index.ToString())\n\t\t\t\t\treturn $\"/{PointerEncode(name.Name)}\";\n\t\t\t}\n\n\t\t\tthrow new InvalidOperationException(\"This path cannot be represented as a JSON Pointer\");\n\t\t}));\n\t}\n\n\tprivate static string PointerEncode(string segment)\n\t{\n\t\treturn segment.Replace(\"~\", \"~0\").Replace(\"/\", \"~1\");\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\n\nnamespace Json.Path;\n\n/// \n/// Provides extended functionality for .\n/// \npublic static class JsonPathExtensions\n{\n\t/// \n\t/// Renders a " + }, + { + "title": "src/JsonPath/JsonPathTypeConverter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/JsonPathTypeConverter.cs#L1-L64", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/JsonPathTypeConverter.cs", + "startLine": 1, + "endLine": 64, + "content": "using System;\nusing System.ComponentModel;\nusing System.Globalization;\n\nnamespace Json.Path;\n\ninternal sealed class JsonPathTypeConverter : TypeConverter\n{\n\n\tprivate static StandardValuesCollection? _standardValues;\n\n\tpublic override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)\n\t{\n\t\treturn sourceType == typeof(string) || sourceType == typeof(JsonPath) || base.CanConvertFrom(context, sourceType);\n\t}\n\n\tpublic override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType)\n\t{\n\t\treturn destinationType == typeof(string) || destinationType == typeof(JsonPath) || base.CanConvertTo(context, destinationType);\n\t}\n\n\tpublic override object ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)\n\t{\n\t\tif (value is string s)\n\t\t\treturn JsonPath.Parse(s);\n\n\t\tif (value is JsonPath path)\n\t\t\treturn new JsonPath(path.Scope, path.Segments);\n\n\t\tthrow GetConvertFromException(value);\n\t}\n\n\tpublic override object ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)\n\t{\n\t\tif (value is JsonPath path)\n\t\t{\n\t\t\tif (destinationType == typeof(string))\n\t\t\t\treturn path.ToString();\n\t\t\t\n\t\t\tif (destinationType == typeof(JsonPath))\n\t\t\t\treturn new JsonPath(path.Scope, path.Segments);\n\t\t}\n\n\t\tthrow GetConvertToException(value, destinationType);\n\t}\n\n\tpublic override bool GetStandardValuesSupported(ITypeDescriptorContext? context) => true;\n\n\tpublic override bool GetStandardValuesExclusive(ITypeDescriptorContext? context) => false;\n\n\tpublic override StandardValuesCollection GetStandardValues(ITypeDescriptorContext? context)\n\t{\n\t\treturn _standardValues ??= new StandardValuesCollection(new[] { JsonPath.Root });\n\t}\n\n\tpublic override bool IsValid(ITypeDescriptorContext? context, object? value)\n\t{\n\t\tif (value is string s)\n\t\t\treturn JsonPath.TryParse(s, out _);\n\n\t\treturn value is JsonPath;\n\t}\n\n}", + "snippet": "using System;\nusing System.ComponentModel;\nusing System.Globalization;\n\nnamespace Json.Path;\n\ninternal sealed class JsonPathTypeConverter : TypeConverter\n{\n\n\tprivate static StandardValuesCollection? _standardValues;\n\n\tpu" + }, + { + "title": "src/JsonPath/LengthFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/LengthFunction.cs#L1-L34", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/LengthFunction.cs", + "startLine": 1, + "endLine": 34, + "content": "using System.Globalization;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Implements the `length()` function to get:\n/// - the length of a string\n/// - the count of values in an array\n/// - the count of values in an object\n/// \npublic class LengthFunction : ValueFunctionDefinition\n{\n\t/// \n\t/// Gets the function name.\n\t/// \n\tpublic override string Name => \"length\";\n\n\t/// \n\t/// Evaluates the function.\n\t/// \n\t/// An object, array, or string\n\t/// If an object or array, the number of items it contains; if a string, the length.\n\tpublic JsonNode? Evaluate(JsonNode? value)\n\t{\n\t\treturn value switch\n\t\t{\n\t\t\tJsonObject obj => (JsonValue)obj.Count,\n\t\t\tJsonArray arr => (JsonValue)arr.Count,\n\t\t\tJsonValue val when val.TryGetValue(out string? s) => (JsonValue)new StringInfo(s).LengthInTextElements,\n\t\t\t_ => Nothing\n\t\t};\n\t}\n}", + "snippet": "using System.Globalization;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Implements the `length()` function to get:\n/// - the length of a string\n/// - the count of values in an array\n/// - the c" + }, + { + "title": "src/JsonPath/MatchFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/MatchFunction.cs#L1-L31", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/MatchFunction.cs", + "startLine": 1, + "endLine": 31, + "content": "using System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Path;\n\n/// \n/// Implements the `match()` function which determines if a string exactly matches a regular\n/// expression (using implicit anchoring).\n/// \npublic class MatchFunction : LogicalFunctionDefinition\n{\n\t/// \n\t/// Gets the function name.\n\t/// \n\tpublic override string Name => \"match\";\n\n\t/// \n\t/// Evaluates the function.\n\t/// \n\t/// The value to test.\n\t/// The iregexp pattern to test against.\n\t/// true if the whole string is a match for the pattern; false otherwise.\n\tpublic bool Evaluate(JsonNode value, JsonNode pattern)\n\t{\n\t\tif (!value.TryGetValue(out var text)) return false;\n\t\tif (!pattern.TryGetValue(out var regex)) return false;\n\n\t\tvar dotnetTranslation = regex.HandleDotNetSupportIssues();\n\t\treturn Regex.IsMatch(text, $\"^{dotnetTranslation}$\", RegexOptions.ECMAScript);\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Path;\n\n/// \n/// Implements the `match()` function which determines if a string exactly matches a regular\n/// expression (using " + }, + { + "title": "src/JsonPath/NameSelector.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/NameSelector.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/NameSelector.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Represents a name selector.\n/// \npublic class NameSelector : ISelector, IHaveShorthand\n{\n\t/// \n\t/// Gets the name.\n\t/// \n\tpublic string Name { get; }\n\n\tinternal NameSelector(string name)\n\t{\n\t\tName = name;\n\t}\n\n\tstring IHaveShorthand.ToShorthandString()\n\t{\n\t\treturn $\".{Name}\";\n\t}\n\n\tvoid IHaveShorthand.AppendShorthandString(StringBuilder builder)\n\t{\n\t\tbuilder.Append('.');\n\t\tbuilder.Append(Name);\n\t}\n\n\t/// Returns a string that represents the current object.\n\t/// A string that represents the current object.\n\tpublic override string ToString()\n\t{\n\t\treturn $\"'{Name}'\"; // TODO escape this\n\t}\n\n\t/// \n\t/// Evaluates the selector.\n\t/// \n\t/// The node to evaluate.\n\t/// The root node (typically used by filter selectors, e.g. `$[?@foo < $.bar]`)\n\t/// \n\t/// A collection of nodes.\n\t///\n\t/// Semantically, this is a nodelist, but leaving as IEnumerable<Node> allows for deferred execution.\n\t/// \n\tpublic IEnumerable Evaluate(Node match, JsonNode? rootNode)\n\t{\n\t\tvar node = match.Value;\n\t\tif (node is not JsonObject obj) yield break;\n\n\t\tif (obj.TryGetPropertyValue(Name, out var value)) yield return new Node(value, match.Location!.Append(Name));\n\t}\n\n\t/// \n\t/// Builds a string using a string builder.\n\t/// \n\t/// The string builder.\n\tpublic void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append('\\'');\n\t\tforeach (var c in Name)\n\t\t{\n\t\t\tbuilder.Append(c switch\n\t\t\t{\n\t\t\t\t'\\'' => \"\\\\'\",\n\t\t\t\t'\\b' => \"\\\\b\",\n\t\t\t\t'\\t' => \"\\\\t\",\n\t\t\t\t'\\n' => \"\\\\n\",\n\t\t\t\t'\\f' => \"\\\\f\",\n\t\t\t\t'\\r' => \"\\\\r\",\n\t\t\t\t'\\\\' => @\"\\\\\",\n\t\t\t\t_ => c\n\t\t\t});\n\t\t}\n\t\tbuilder.Append('\\'');\n\t}\n}\n\ninternal class NameSelectorParser : ISelectorParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out ISelector? selector, PathParsingOptions options)\n\t{\n\t\tchar quoteChar;\n\t\tvar i = index;\n\t\tswitch (source[index])\n\t\t{\n\t\t\tcase '\"':\n\t\t\t\tquoteChar = '\"';\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase '\\'':\n\t\t\t\tquoteChar = '\\'';\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tselector = null;\n\t\t\t\treturn false;\n\t\t}\n\n\t\tvar done = false;\n\t\tvar escaped = false;\n\t\tvar sb = new StringBuilder();\n\t\twhile (i < source.Length && !done)\n\t\t{\n\t\t\tif (escaped)\n\t\t\t{\n\t\t\t\tif (!ReadEscaped(source, quoteChar, sb, ref i))\n\t\t\t\t{\n\t\t\t\t\tselector = null;\n\t\t\t\t\treturn false;\n\t\t\t\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// " + }, + { + "title": "src/JsonPath/NameSelector.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/NameSelector.cs#L121-L239", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/NameSelector.cs", + "startLine": 121, + "endLine": 239, + "content": "escaped = false;\n\t\t\t}\n\t\t\telse if (source[i] == '\\\\')\n\t\t\t{\n\t\t\t\tescaped = true;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse if (source[i] == quoteChar)\n\t\t\t{\n\t\t\t\tdone = true;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (!source.EnsureValidNameCharacter(i))\n\t\t\t\t{\n\t\t\t\t\tselector = null;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tsb.Append(source[i]);\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\n\t\tif (!done)\n\t\t{\n\t\t\tselector = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tindex = i;\n\t\tselector = new NameSelector(sb.ToString());\n\t\treturn true;\n\t}\n\n\tprivate static bool ReadEscaped(ReadOnlySpan source, char quoteChar, StringBuilder sb, ref int i)\n\t{\n\t\t// TODO handle multi-char escapes\n\t\tswitch (source[i])\n\t\t{\n\t\t\tcase 'b':\n\t\t\t\tsb.Append('\\b');\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase 't':\n\t\t\t\tsb.Append('\\t');\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase 'n':\n\t\t\t\tsb.Append('\\n');\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase 'f':\n\t\t\t\tsb.Append('\\f');\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase 'r':\n\t\t\t\tsb.Append('\\r');\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase '\\\\':\n\t\t\t\tsb.Append('\\\\');\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase '/':\n\t\t\t\tsb.Append('/');\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase 'u':\n\t\t\t\tvar hexStart = i;\n\t\t\t\twhile (ReadHexCode(source, ref i) && source[i] == '\\\\')\n\t\t\t\t{\n\t\t\t\t\ti++; // consume \\\n\t\t\t\t}\n\n\t\t\t\tif (hexStart == i) return false;\n\n\t\t\t\t// this is simpler than trying to parse and calc surrogates myself.\n\t\t\t\t// but it does throw an InvalidOperationException when the encoded char is invalid...\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tvar hexEncodedChars = JsonNode.Parse($\"\\\"{source[(hexStart-1)..i].ToString()}\\\"\")!;\n\t\t\t\t\tsb.Append(hexEncodedChars.GetValue());\n\t\t\t\t}\n\t\t\t\tcatch (Exception e) when (e is InvalidOperationException or JsonException)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (source[i] == quoteChar)\n\t\t\t\t{\n\t\t\t\t\tsb.Append(quoteChar);\n\t\t\t\t\ti++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// TODO add error messages\n\t\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate static bool ReadHexCode(ReadOnlySpan source, ref int i)\n\t{\n\t\t// reads uXXXX\n\t\tif (source[i] != 'u') return false;\n\n\t\tvar j = i;\n\t\tj++; // consume u\n\t\tif (j + 4 <= source.Length && source[j..(j + 4)].ToArray().All(x => char.ToUpper(x) is (>= 'A' and <= 'F') or (>= '0' and <= '9')))\n\t\t{\n\t\t\ti = j + 4;\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n}", + "snippet": "escaped = false;\n\t\t\t}\n\t\t\telse if (source[i] == '\\\\')\n\t\t\t{\n\t\t\t\tescaped = true;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse if (source[i] == quoteChar)\n\t\t\t{\n\t\t\t\tdone = true;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (!source.EnsureValidNameCharacter(i)" + }, + { + "title": "src/JsonPath/Node.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/Node.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/Node.cs", + "startLine": 1, + "endLine": 26, + "content": "using System.Diagnostics;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Represents a single match.\n/// \n[DebuggerDisplay(\"{Value} - {Location}\")]\npublic class Node\n{\n\t/// \n\t/// The value at the matching location.\n\t/// \n\tpublic JsonNode? Value { get; }\n\t/// \n\t/// The location where the value was found.\n\t/// \n\tpublic JsonPath? Location { get; }\n\n\tinternal Node(in JsonNode? value, in JsonPath? location)\n\t{\n\t\tValue = value;\n\t\tLocation = location;\n\t}\n}", + "snippet": "using System.Diagnostics;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Represents a single match.\n/// \n[DebuggerDisplay(\"{Value} - {Location}\")]\npublic class Node\n{\n\t/// \n\t///" + }, + { + "title": "src/JsonPath/NodeList.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/NodeList.cs#L1-L66", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/NodeList.cs", + "startLine": 1, + "endLine": 66, + "content": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\n\nnamespace Json.Path;\n\n/// \n/// A collection of nodes, generally resulting from an operation or query.\n/// \n[CollectionBuilder(typeof(NodeListBuilder), nameof(NodeListBuilder.Create))]\npublic class NodeList : IEnumerable\n{\n\tprivate readonly IEnumerable _nodes;\n\n\t/// \n\t/// An empty nodelist.\n\t/// \n\tpublic static readonly NodeList Empty = new(Enumerable.Empty());\n\n\t/// Gets the number of elements in the collection.\n\t/// The number of elements in the collection.\n\tpublic int Count => _nodes.Count();\n\n\t/// Gets the element at the specified index in the read-only list.\n\t/// The zero-based index of the element to get.\n\t/// The element at the specified index in the read-only list.\n\tpublic Node this[int index] => _nodes.ElementAt(index);\n\n\t/// \n\t/// Creates a new nodelist.\n\t/// \n\t/// The nodes.\n\tpublic NodeList(IEnumerable nodes)\n\t{\n\t\t_nodes = nodes;\n\t}\n\tinternal NodeList(ReadOnlySpan nodes)\n\t{\n\t\t_nodes = nodes.ToArray();\n\t}\n\n\t/// Returns an enumerator that iterates through the collection.\n\t/// An enumerator that can be used to iterate through the collection.\n\tpublic IEnumerator GetEnumerator()\n\t{\n\t\treturn _nodes.GetEnumerator();\n\t}\n\n\tIEnumerator IEnumerable.GetEnumerator()\n\t{\n\t\treturn GetEnumerator();\n\t}\n}\n\n/// \n/// Allows collection expression initialization.\n/// \npublic static class NodeListBuilder\n{\n\t/// \n\t/// Allows collection expression initialization.\n\t/// \n\tpublic static NodeList Create(ReadOnlySpan values) => new(values);\n}", + "snippet": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\n\nnamespace Json.Path;\n\n/// \n/// A collection of nodes, generally resulting from" + }, + { + "title": "src/JsonPath/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonPath/obj/Debug/net10.0/JsonPath.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Debug/net10.0/JsonPath.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Debug/net10.0/JsonPath.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Path (RFC 9535) built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.2+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPath/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonPath/obj/Debug/net8.0/JsonPath.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Debug/net8.0/JsonPath.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Debug/net8.0/JsonPath.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Path (RFC 9535) built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.2+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPath/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonPath/obj/Debug/net9.0/JsonPath.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Debug/net9.0/JsonPath.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Debug/net9.0/JsonPath.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Path (RFC 9535) built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.2+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPath/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonPath/obj/Debug/netstandard2.0/JsonPath.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Debug/netstandard2.0/JsonPath.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Debug/netstandard2.0/JsonPath.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Path (RFC 9535) built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.2+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPath/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonPath/obj/Release/net10.0/JsonPath.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Release/net10.0/JsonPath.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Release/net10.0/JsonPath.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Path (RFC 9535) built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.2+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPath/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonPath/obj/Release/net8.0/JsonPath.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Release/net8.0/JsonPath.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Release/net8.0/JsonPath.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Path (RFC 9535) built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.2+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPath/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonPath/obj/Release/net9.0/JsonPath.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Release/net9.0/JsonPath.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Release/net9.0/JsonPath.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Path (RFC 9535) built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.2+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPath/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonPath/obj/Release/netstandard2.0/JsonPath.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/obj/Release/netstandard2.0/JsonPath.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/obj/Release/netstandard2.0/JsonPath.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Path (RFC 9535) built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.0.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.0.2+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPath.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPath/PathEvaluationOptions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/PathEvaluationOptions.cs#L1-L9", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/PathEvaluationOptions.cs", + "startLine": 1, + "endLine": 9, + "content": "namespace Json.Path;\n\n/// \n/// Provides a number of options to be used during evaluation.\n/// \n/// \n/// Currently that number is zero.\n/// \npublic class PathEvaluationOptions;", + "snippet": "namespace Json.Path;\n\n/// \n/// Provides a number of options to be used during evaluation.\n/// \n/// \n/// Currently that number is zero.\n/// \npublic class PathEvaluationOptions;" + }, + { + "title": "src/JsonPath/PathParseException.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/PathParseException.cs#L1-L20", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/PathParseException.cs", + "startLine": 1, + "endLine": 20, + "content": "using System;\n\nnamespace Json.Path;\n\n/// \n/// Thrown when an error occurs attempting to parse a JSON Path.\n/// \npublic class PathParseException : Exception\n{\n\t/// \n\t/// The index at which the error occurred.\n\t/// \n\tpublic int Index { get; }\n\n\tinternal PathParseException(int index, string message)\n\t\t: base(message)\n\t{\n\t\tIndex = index;\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Path;\n\n/// \n/// Thrown when an error occurs attempting to parse a JSON Path.\n/// \npublic class PathParseException : Exception\n{\n\t/// \n\t/// The index at which the " + }, + { + "title": "src/JsonPath/PathParser.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/PathParser.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/PathParser.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Path;\n\ninternal static class PathParser\n{\n\tprivate static readonly ISelectorParser[] _parsers =\n\t{\n\t\tnew FilterSelectorParser(),\n\t\tnew SliceSelectorParser(),\n\t\tnew IndexSelectorParser(),\n\t\tnew NameSelectorParser(),\n\t\tnew WildcardSelectorParser()\n\t};\n\n\tpublic static JsonPath Parse(ReadOnlySpan source, ref int index, PathParsingOptions options, bool requireGlobal = false)\n\t{\n\t\tif (source.Length == 0)\n\t\t\tthrow new PathParseException(0, \"Input string is empty\");\n\n\t\tvar segments = new List();\n\t\tPathScope scope;\n\n\t\tif (source[index] == '$')\n\t\t\tscope = PathScope.Global;\n\t\telse if (requireGlobal)\n\t\t\tthrow new PathParseException(index, \"Path must start with '$'\");\n\t\telse if (source[index] == '@')\n\t\t\tscope = PathScope.Local;\n\t\telse\n\t\t\tthrow new PathParseException(index, \"Path must start with '$' or '@'\");\n\n\t\tindex++; // consume $ or @\n\n\t\twhile (index < source.Length)\n\t\t{\n\t\t\tsegments.Add(ParseSegment(source, ref index, options));\n\t\t}\n\n\t\treturn new JsonPath(scope, segments);\n\t}\n\n\tpublic static bool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out JsonPath? path, PathParsingOptions options, bool requireGlobal = false)\n\t{\n\t\tif (index >= source.Length)\n\t\t{\n\t\t\tpath = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tvar i = index;\n\n\t\t//if (!source.ConsumeWhitespace(ref index))\n\t\t//{\n\t\t//\tpath = null;\n\t\t//\treturn false;\n\t\t//}\n\n\t\tvar segments = new List();\n\t\tPathScope scope;\n\n\t\tif (source[i] == '$')\n\t\t\tscope = PathScope.Global;\n\t\telse if (requireGlobal)\n\t\t{\n\t\t\tpath = null;\n\t\t\treturn false;\n\t\t}\n\t\telse if (source[i] == '@')\n\t\t\tscope = PathScope.Local;\n\t\telse\n\t\t{\n\t\t\tpath = null;\n\t\t\treturn false;\n\t\t}\n\n\t\ti++; // consume $ or @\n\n\t\twhile (i < source.Length)\n\t\t{\n\t\t\tif (!TryParseSegment(source, ref i, out var pathSegment, options)) break;\n\n\t\t\tsegments.Add(pathSegment);\n\t\t}\n\n\t\tpath = new JsonPath(scope, segments);\n\t\tindex = i;\n\t\treturn true;\n\t}\n\n\tprivate static PathSegment ParseSegment(ReadOnlySpan source, ref int index, PathParsingOptions options)\n\t{\n\t\tvar selectors = new List();\n\t\tvar isRecursive = false;\n\t\tvar isShorthand = false;\n\n\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t\tthrow new PathParseException(index, \"Unexpected end of input\");\n\n\t\tif (source[index] == '[')\n\t\t\tParseBracketed(source, ref index, selectors, options);\n\t\telse if (source[index] == '.')\n\t\t{\n\t\t\tindex++; // consume .\n\n\t\t\tif (source[index] == '.')\n\t\t\t{\n\t\t\t\tisRecursive = true;\n\t\t\t\tindex++; // consume second .\n\n\t\t\t\tif (options.TolerateExtraWhitespace)\n\t\t\t\t{\n\t\t\t\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t\t\t\t\tthrow new PathParseException(index, \"Unexpected end of input\");\n\t\t\t\t}\n\t\t\t\telse if (index == source.Length)\n\t\t\t\t\tthrow new PathParseException(index, \"Unexpected end of input\");", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Path;\n\ninternal static class PathParser\n{\n\tprivate static readonly ISelectorParser[] _parsers =\n\t{\n\t\tnew FilterSelect" + }, + { + "title": "src/JsonPath/PathParser.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/PathParser.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/PathParser.cs", + "startLine": 121, + "endLine": 240, + "content": "if (source[index] == '[') \n\t\t\t\t\tParseBracketed(source, ref index, selectors, options);\n\t\t\t\telse if (source[index] == '*')\n\t\t\t\t{\n\t\t\t\t\tselectors.Add(new WildcardSelector());\n\t\t\t\t\tisShorthand = true;\n\t\t\t\t\tindex++; // consume *\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tisShorthand = true;\n\t\t\t\t\tParseName(source, ref index, selectors, options);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (source[index] == '*')\n\t\t\t{\n\t\t\t\tselectors.Add(new WildcardSelector());\n\t\t\t\tisShorthand = true;\n\t\t\t\tindex++; // consume *\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tisShorthand = true;\n\t\t\t\tParseName(source, ref index, selectors, options);\n\t\t\t}\n\t\t}\n\n\t\tif (selectors.Count == 0)\n\t\t\tthrow new PathParseException(index, \"Could not find any valid selectors.\");\n\n\t\tif (selectors.Count > 1 && isShorthand)\n\t\t\tthrow new PathParseException(index, \"Cannot have shorthand syntax with multiple selectors (something went very wrong).\");\n\n\t\treturn new PathSegment(selectors, isRecursive, isShorthand);\n\t}\n\n\tprivate static bool TryParseSegment(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out PathSegment? segment, PathParsingOptions options)\n\t{\n\t\tvar selectors = new List();\n\t\tvar isRecursive = false;\n\t\tvar isShorthand = false;\n\n\t\tvar i = index;\n\n\t\tif (!source.ConsumeWhitespace(ref i) || i == source.Length)\n\t\t{\n\t\t\tsegment = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (source[i] == '[')\n\t\t{\n\t\t\tif (!TryParseBracketed(source, ref i, selectors, options))\n\t\t\t{\n\t\t\t\tsegment = null;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\telse if (source[i] == '.')\n\t\t{\n\t\t\ti++; // consume .\n\n\t\t\tif (i >= source.Length)\n\t\t\t{\n\t\t\t\tsegment = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (source[i] == '.')\n\t\t\t{\n\t\t\t\tisRecursive = true;\n\t\t\t\ti++; // consume second .\n\n\t\t\t\tif (options.TolerateExtraWhitespace && !source.ConsumeWhitespace(ref i) || i == source.Length)\n\t\t\t\t{\n\t\t\t\t\tsegment = null;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (source[i] == '[')\n\t\t\t\t{\n\t\t\t\t\tif (!TryParseBracketed(source, ref i, selectors, options))\n\t\t\t\t\t{\n\t\t\t\t\t\tsegment = null;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (source[i] == '*')\n\t\t\t\t{\n\t\t\t\t\tselectors.Add(new WildcardSelector());\n\t\t\t\t\tisRecursive = true;\n\t\t\t\t\tisShorthand = true;\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tisRecursive = true;\n\t\t\t\t\tisShorthand = true;\n\t\t\t\t\tif (!TryParseName(source, ref i, selectors, options))\n\t\t\t\t\t{\n\t\t\t\t\t\tsegment = null;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (source[i] == '*')\n\t\t\t{\n\t\t\t\tselectors.Add(new WildcardSelector());\n\t\t\t\tisShorthand = true;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tisShorthand = true;\n\t\t\t\tif (!TryParseName(source, ref i, selectors, options))\n\t\t\t\t{\n\t\t\t\t\tsegment = null;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}", + "snippet": "if (source[index] == '[') \n\t\t\t\t\tParseBracketed(source, ref index, selectors, options);\n\t\t\t\telse if (source[index] == '*')\n\t\t\t\t{\n\t\t\t\t\tselectors.Add(new WildcardSelector());\n\t\t\t\t\tisShorthand = true;\n\t\t\t\t\tindex++; // consum" + }, + { + "title": "src/JsonPath/PathParser.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/PathParser.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/PathParser.cs", + "startLine": 241, + "endLine": 360, + "content": "}\n\n\t\tif (selectors.Count == 0)\n\t\t{\n\t\t\tsegment = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (selectors.Count > 1 && isShorthand)\n\t\t{\n\t\t\tsegment = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tindex = i;\n\t\tsegment = new PathSegment(selectors, isRecursive, isShorthand);\n\t\treturn true;\n\t}\n\n\tprivate static void ParseName(ReadOnlySpan source, ref int index, List selectors, PathParsingOptions options)\n\t{\n\t\tif (!source.TryParseName(ref index, out var name, options)) return;\n\n\t\tselectors.Add(new NameSelector(name));\n\t}\n\n\tprivate static bool TryParseName(this ReadOnlySpan source, ref int index, List selectors, PathParsingOptions options)\n\t{\n\t\tif (!source.TryParseName(ref index, out var name, options)) return false;\n\n\t\tselectors.Add(new NameSelector(name));\n\t\treturn true;\n\t}\n\n\tprivate static void ParseBracketed(ReadOnlySpan source, ref int index, List selectors, PathParsingOptions options)\n\t{\n\t\tvar done = false;\n\t\tindex++; // consume [\n\n\t\twhile (index < source.Length && !done)\n\t\t{\n\t\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t\t\tthrow new PathParseException(index, \"Unexpected end of input\");\n\n\t\t\tISelector? selector = null;\n\n\t\t\tforeach (var parser in _parsers)\n\t\t\t{\n\t\t\t\tif (parser.TryParse(source, ref index, out selector, options)) break;\n\t\t\t}\n\n\t\t\tif (selector == null)\n\t\t\t{\n\t\t\t\tvar sample = source[index..Math.Min(source.Length, index + 10)];\n\t\t\t\tvar includeEllipsis = index < source.Length - 10;\n\t\t\t\tthrow new PathParseException(index, $\"Pattern '{sample.ToString()}{(includeEllipsis ? \"...\" : string.Empty)}' not recognized.\");\n\t\t\t}\n\n\t\t\tselectors.Add(selector);\n\n\t\t\tif (!source.ConsumeWhitespace(ref index))\n\t\t\t\tthrow new PathParseException(index, \"Unexpected end of input\");\n\n\t\t\tswitch (source[index])\n\t\t\t{\n\t\t\t\tcase ']':\n\t\t\t\t\tdone = true;\n\t\t\t\t\tindex++;\n\t\t\t\t\tbreak;\n\t\t\t\tcase ',':\n\t\t\t\t\tindex++;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new PathParseException(index, \"Expected ']' or ','.\");\n\t\t\t}\n\t\t}\n\n\t\tif (!done)\n\t\t\tthrow new PathParseException(index, \"Unexpected end of input\");\n\t}\n\n\tprivate static bool TryParseBracketed(ReadOnlySpan source, ref int index, List selectors, PathParsingOptions options)\n\t{\n\t\tvar done = false;\n\t\tindex++; // consume [\n\n\t\twhile (index < source.Length && !done)\n\t\t{\n\t\t\tif (!source.ConsumeWhitespace(ref index) || index == source.Length) return false;\n\n\t\t\tISelector? selector = null;\n\n\t\t\tforeach (var parser in _parsers)\n\t\t\t{\n\t\t\t\tif (parser.TryParse(source, ref index, out selector, options)) break;\n\t\t\t}\n\n\t\t\tif (selector == null) return false;\n\n\t\t\tselectors.Add(selector);\n\n\t\t\tif (!source.ConsumeWhitespace(ref index) || index == source.Length) return false;\n\n\t\t\tswitch (source[index])\n\t\t\t{\n\t\t\t\tcase ']':\n\t\t\t\t\tdone = true;\n\t\t\t\t\tindex++;\n\t\t\t\t\tbreak;\n\t\t\t\tcase ',':\n\t\t\t\t\tindex++;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn done;\n\t}\n}", + "snippet": "}\n\n\t\tif (selectors.Count == 0)\n\t\t{\n\t\t\tsegment = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (selectors.Count > 1 && isShorthand)\n\t\t{\n\t\t\tsegment = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tindex = i;\n\t\tsegment = new PathSegment(selectors, isRec" + }, + { + "title": "src/JsonPath/PathParsingOptions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/PathParsingOptions.cs#L1-L55", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/PathParsingOptions.cs", + "startLine": 1, + "endLine": 55, + "content": "namespace Json.Path;\n\n/// \n/// Defines a set of configuration options to control parsing behavior.\n/// \npublic class PathParsingOptions\n{\n\t/// \n\t/// Gets or sets whether mathematical operators are allowed.\n\t/// \n\t/// \n\t/// These operators are an extension of the specification, so they\n\t/// are disallowed by default.\n\t/// \n\tpublic bool AllowMathOperations { get; set; }\n\n\t/// \n\t/// Gets or sets whether a JSON Path can start with the `@` symbol\n\t/// instead of `$`.\n\t/// \n\tpublic bool AllowRelativePathStart { get; set; }\n\n\t/// \n\t/// Gets or sets whether JSON objects and arrays (double-quotes only)\n\t/// are permitted in expression syntax.\n\t/// \n\t/// \n\t/// Per the specification, only numbers, strings, `null`, `true`,\n\t/// and `false` are permitted.\n\t/// \n\tpublic bool AllowJsonConstructs { get; set; }\n\n\t/// \n\t/// Gets or sets whether the JSON Path can contain whitespace in places\n\t/// the spec says it shouldn't, e.g. between a function name and the\n\t/// opening parenthesis.\n\t/// \n\t/// \n\t/// Per the specification, leading or trailing whitespace is also\n\t/// forbidden. Enabling this option permits this.\n\t/// \n\tpublic bool TolerateExtraWhitespace { get; set; }\n\n\t/// \n\t/// Gets or sets whether the `in` operator is allowed.\n\t/// \n\t/// \n\t/// These operators are an extension of the specification, so they\n\t/// are disallowed by default.\n\t///\n\t/// May also require that be set to\n\t/// `true` so that array and object literals are also permitted.\n\t/// \n\tpublic bool AllowInOperator { get; set; }\n}", + "snippet": "namespace Json.Path;\n\n/// \n/// Defines a set of configuration options to control parsing behavior.\n/// \npublic class PathParsingOptions\n{\n\t/// \n\t/// Gets or sets whether mathematical operators" + }, + { + "title": "src/JsonPath/PathResult.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/PathResult.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/PathResult.cs", + "startLine": 1, + "endLine": 18, + "content": "namespace Json.Path;\n\n/// \n/// The results of a JSON Path evaluation against a JSON instance.\n/// \npublic class PathResult\n{\n\t/// \n\t/// The list of matches.\n\t/// \n\tpublic NodeList Matches { get; }\n\n\tinternal PathResult(NodeList matches)\n\t{\n\t\tMatches = matches;\n\t}\n}", + "snippet": "namespace Json.Path;\n\n/// \n/// The results of a JSON Path evaluation against a JSON instance.\n/// \npublic class PathResult\n{\n\t/// \n\t/// The list of matches.\n\t/// \n\tpublic NodeList Ma" + }, + { + "title": "src/JsonPath/PathScope.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/PathScope.cs#L1-L16", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/PathScope.cs", + "startLine": 1, + "endLine": 16, + "content": "namespace Json.Path;\n\n/// \n/// Indicates the scope of a path.\n/// \npublic enum PathScope\n{\n\t/// \n\t/// The scope is the entire JSON document. These paths start with `$`.\n\t/// \n\tGlobal,\n\t/// \n\t/// The scope is the local JSON value. These paths start with `@`.\n\t/// \n\tLocal\n}", + "snippet": "namespace Json.Path;\n\n/// \n/// Indicates the scope of a path.\n/// \npublic enum PathScope\n{\n\t/// \n\t/// The scope is the entire JSON document. These paths start with `$`.\n\t/// \n\tGloba" + }, + { + "title": "src/JsonPath/PathSegment.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/PathSegment.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/PathSegment.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Represents a single path segment, generally indicated in the path by square brackets `[]`.\n/// \npublic class PathSegment\n{\n\t/// \n\t/// Gets the collection of selectors present in the path.\n\t/// \n\tpublic ISelector[] Selectors { get; }\n\t/// \n\t/// Indicates whether the segment is evaluated as a recursive descent operation.\n\t/// \n\tpublic bool IsRecursive { get; }\n\t/// \n\t/// Indicates whether the segment is represented in its shorthand form (e.g. `.foo` instead of `['foo']`).\n\t/// \n\tpublic bool IsShorthand { get; }\n\n\tinternal PathSegment(IEnumerable selectors, bool isRecursive = false, bool isShorthand = false)\n\t{\n\t\tSelectors = selectors.ToArray();\n\t\tIsRecursive = isRecursive;\n\t\tIsShorthand = isShorthand;\n\t}\n\n\tinternal IEnumerable Evaluate(Node match, JsonNode? rootNode)\n\t{\n\t\treturn IsRecursive\n\t\t\t? RecursivelyEvaluate(Selectors, match, rootNode)\n\t\t\t: Selectors.SelectMany(x => x.Evaluate(match, rootNode));\n\t}\n\n\tprivate static IEnumerable RecursivelyEvaluate(IEnumerable selectors, Node match, JsonNode? rootNode)\n\t{\n\t\treturn GetAllDescendants(match).SelectMany(child => selectors.SelectMany(s => s.Evaluate(child, rootNode)));\n\t}\n\n\tprivate static IEnumerable GetAllDescendants(Node match)\n\t{\n\t\tyield return match;\n\t\tif (match.Value is JsonObject obj)\n\t\t{\n\t\t\tforeach (var member in obj)\n\t\t\t{\n\t\t\t\tvar localMatch = new Node(member.Value, match.Location!.Append(member.Key));\n\t\t\t\tforeach (var descendant in GetAllDescendants(localMatch))\n\t\t\t\t{\n\t\t\t\t\tyield return descendant;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (match.Value is JsonArray arr)\n\t\t{\n\t\t\tfor (var i = 0; i < arr.Count; i++)\n\t\t\t{\n\t\t\t\tvar member = arr[i];\n\t\t\t\tvar localMatch = new Node(member, match.Location!.Append(i));\n\t\t\t\tforeach (var descendant in GetAllDescendants(localMatch))\n\t\t\t\t{\n\t\t\t\t\tyield return descendant;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/// Returns a string that represents the current object.\n\t/// A string that represents the current object.\n\tpublic override string ToString()\n\t{\n\t\tstring GetNormalized() => $\"[{string.Join(\",\", Selectors.Select(x => x.ToString()))}]\";\n\t\tstring GetShorthand() => $\"{((IHaveShorthand)Selectors[0]).ToShorthandString()}\";\n\n\t\tif (IsRecursive)\n\t\t{\n\t\t\tif (IsShorthand)\n\t\t\t\treturn \".\" + GetShorthand();\n\n\t\t\treturn \"..\" + GetNormalized();\n\t\t}\n\n\t\tif (IsShorthand)\n\t\t\treturn $\"{((IHaveShorthand)Selectors[0]).ToShorthandString()}\";\n\t\t\n\t\treturn $\"[{string.Join(\",\", Selectors.Select(x => x.ToString()))}]\";\n\t}\n\n\t/// \n\t/// Builds a string representation using a .\n\t/// \n\t/// A string builder.\n\tpublic void BuildString(StringBuilder builder)\n\t{\n\t\tvoid AppendNormalized()\n\t\t{\n\t\t\tbuilder.Append('[');\n\n\t\t\tSelectors[0].BuildString(builder);\n\n\t\t\tfor (int i = 1; i < Selectors.Length; i++)\n\t\t\t{\n\t\t\t\tbuilder.Append(',');\n\t\t\t\tSelectors[i].BuildString(builder);\n\t\t\t}\n\n\t\t\tbuilder.Append(']');\n\t\t}\n\t\tvoid AppendShorthand(StringBuilder b) => ((IHaveShorthand)Selectors[0]).AppendShorthandString(b);\n\n\t\tif (IsRecursive)\n\t\t{\n\t\t\tbuilder.Append('.');\n\t\t\tif (IsShorthand)\n\t\t\t{", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Represents a single path segment, generally indicated in the path by square b" + }, + { + "title": "src/JsonPath/PathSegment.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/PathSegment.cs#L121-L142", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/PathSegment.cs", + "startLine": 121, + "endLine": 142, + "content": "AppendShorthand(builder);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tbuilder.Append('.');\n\t\t\tAppendNormalized();\n\t\t\treturn;\n\t\t}\n\n\n\t\tif (IsShorthand)\n\t\t{\n\t\t\tAppendShorthand(builder);\n\t\t\treturn;\n\t\t}\n\n\t\tAppendNormalized();\n\n\t}\n\n\n}", + "snippet": "AppendShorthand(builder);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tbuilder.Append('.');\n\t\t\tAppendNormalized();\n\t\t\treturn;\n\t\t}\n\n\n\t\tif (IsShorthand)\n\t\t{\n\t\t\tAppendShorthand(builder);\n\t\t\treturn;\n\t\t}\n\n\t\tAppendNormalized();\n\n\t}\n\n\n}" + }, + { + "title": "src/JsonPath/SearchFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/SearchFunction.cs#L1-L31", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/SearchFunction.cs", + "startLine": 1, + "endLine": 31, + "content": "using System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Path;\n\n/// \n/// Implements the `match()` function which determines if any substring within\n/// a string matches a regular expression.\n/// \npublic class SearchFunction : LogicalFunctionDefinition\n{\n\t/// \n\t/// Gets the function name.\n\t/// \n\tpublic override string Name => \"search\";\n\n\t/// \n\t/// Evaluates the function.\n\t/// \n\t/// The value to test.\n\t/// The iregexp pattern to test against.\n\t/// true if the string contains a match for the pattern; false otherwise.\n\tpublic bool Evaluate(JsonNode value, JsonNode pattern)\n\t{\n\t\tif (!value.TryGetValue(out var text)) return false;\n\t\tif (!pattern.TryGetValue(out var regex)) return false;\n\n\t\tvar dotnetTranslation = regex.HandleDotNetSupportIssues();\n\t\treturn Regex.IsMatch(text, dotnetTranslation, RegexOptions.ECMAScript);\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Path;\n\n/// \n/// Implements the `match()` function which determines if any substring within\n/// a string matches a regular expre" + }, + { + "title": "src/JsonPath/SliceSelector.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/SliceSelector.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/SliceSelector.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Represents a slice selector in the form `start : end : step`.\n/// \npublic class SliceSelector : ISelector\n{\n\t/// \n\t/// Gets the start.\n\t/// \n\tpublic int? Start { get; }\n\t/// \n\t/// Gets the end.\n\t/// \n\tpublic int? End { get; }\n\t/// \n\t/// Gets the step.\n\t/// \n\tpublic int? Step { get; }\n\n\tinternal SliceSelector(int? start, int? end, int? step)\n\t{\n\t\tStart = start;\n\t\tEnd = end;\n\t\tStep = step;\n\t}\n\n\t/// Returns a string that represents the current object.\n\t/// A string that represents the current object.\n\tpublic override string ToString()\n\t{\n\t\treturn Step.HasValue\n\t\t\t? $\"{Start}:{End}:{Step}\"\n\t\t\t: $\"{Start}:{End}\";\n\t}\n\n\t/// \n\t/// Evaluates the selector.\n\t/// \n\t/// The node to evaluate.\n\t/// The root node (typically used by filter selectors, e.g. `$[?@foo < $.bar]`)\n\t/// \n\t/// A collection of nodes.\n\t///\n\t/// Semantically, this is a nodelist, but leaving as IEnumerable<Node> allows for deferred execution.\n\t/// \n\tpublic IEnumerable Evaluate(Node match, JsonNode? rootNode)\n\t{\n\t\tvar node = match.Value;\n\t\tif (node is not JsonArray arr) yield break;\n\t\tif (Step == 0) yield break;\n\n\t\tvar step = Step ?? 1;\n\t\tvar start = Start ?? (step >= 0 ? 0 : arr.Count);\n\t\tvar end = End ?? (step >= 0 ? arr.Count : -arr.Count - 1);\n\t\tvar (lower, upper) = Bounds(start, end, step, arr.Count);\n\n\t\tif (step > 0)\n\t\t{\n\t\t\tvar i = lower;\n\t\t\twhile (i < upper)\n\t\t\t{\n\t\t\t\tyield return new Node(arr[i], match.Location!.Append(i));\n\t\t\t\ti += step;\n\t\t\t\tif (i < 0) break; // overflow\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar i = upper;\n\t\t\twhile (lower < i)\n\t\t\t{\n\t\t\t\tyield return new Node(arr[i], match.Location!.Append(i));\n\t\t\t\ti += step;\n\t\t\t\tif (i < 0) break; // overflow\n\t\t\t}\n\t\t}\n\t}\n\n\t/// \n\t/// Builds a string using a string builder.\n\t/// \n\t/// The string builder.\n\tpublic void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append(Start);\n\t\tbuilder.Append(':');\n\t\tbuilder.Append(End);\n\t\tif (Step.HasValue)\n\t\t{\n\t\t\tbuilder.Append(':');\n\t\t\tbuilder.Append(Step);\n\t\t}\n\t}\n\n\tprivate static int Normalize(int i, int length)\n\t{\n\t\treturn i >= 0 ? i : length + i;\n\t}\n\n\tprivate static (int lower, int upper) Bounds(int start, int end, int step, int length)\n\t{\n\t\tstart = Normalize(start, length);\n\t\tend = Normalize(end, length);\n\n\t\tint lower, upper;\n\n\t\tif (step >= 0)\n\t\t{\n\t\t\tlower = Math.Min(Math.Max(start, 0), length);\n\t\t\tupper = Math.Min(Math.Max(end, 0), length);\n\t\t}\n\t\telse\n\t\t{", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Represents a slice selector in the form `st" + }, + { + "title": "src/JsonPath/SliceSelector.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/SliceSelector.cs#L121-L186", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/SliceSelector.cs", + "startLine": 121, + "endLine": 186, + "content": "upper = Math.Min(Math.Max(start, -1), length - 1);\n\t\t\tlower = Math.Min(Math.Max(end, -1), length - 1);\n\t\t}\n\n\t\treturn (lower, upper);\n\t}\n}\n\ninternal class SliceSelectorParser : ISelectorParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out ISelector? selector, PathParsingOptions options)\n\t{\n\t\tvar i = index;\n\t\tint? start = null, end = null, step = null;\n\n\t\tif (source.TryGetInt(ref i, out var value))\n\t\t\tstart = value;\n\n\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\tselector = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (source[i] != ':')\n\t\t{\n\t\t\tselector = null;\n\t\t\treturn false;\n\t\t}\n\n\t\ti++; // consume :\n\n\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\tselector = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (source.TryGetInt(ref i, out value))\n\t\t\tend = value;\n\n\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\tselector = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (source[i] == ':')\n\t\t{\n\t\t\ti++; // consume :\n\n\t\t\tif (!source.ConsumeWhitespace(ref i))\n\t\t\t{\n\t\t\t\tselector = null;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (source.TryGetInt(ref i, out value))\n\t\t\t\tstep = value;\n\t\t}\n\n\t\tindex = i;\n\t\tselector = new SliceSelector(start, end, step);\n\t\treturn true;\n\t}\n}", + "snippet": "upper = Math.Min(Math.Max(start, -1), length - 1);\n\t\t\tlower = Math.Min(Math.Max(end, -1), length - 1);\n\t\t}\n\n\t\treturn (lower, upper);\n\t}\n}\n\ninternal class SliceSelectorParser : ISelectorParser\n{\n\tpublic bool TryParse(Read" + }, + { + "title": "src/JsonPath/SpanExtensions.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/SpanExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/SpanExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\ninternal static class SpanExtensions\n{\n\tpublic static bool ConsumeWhitespace(this ReadOnlySpan span, ref int i)\n\t{\n\t\twhile (i < span.Length && char.IsWhiteSpace(span[i]))\n\t\t{\n\t\t\ti++;\n\t\t}\n\t\treturn i != span.Length;\n\t}\n\n\tpublic static bool EnsureValidNameCharacter(this ReadOnlySpan span, int i)\n\t{\n\t\treturn span[i] >= 0x20;\n\t\t//throw new PathParseException(i, \"Characters in the range U+0000..U+001F are disallowed\");\n\t}\n\n\tprivate const long _minInteger = -(2L << 52); // -(2^53)\n\tprivate const long _maxInteger = 2L << 52; // 2^53\n\n\tpublic static bool TryGetInt(this ReadOnlySpan span, ref int index, out int value)\n\t{\n\t\tvar negative = false;\n\t\tvar i = index;\n\t\tif (span[i] == '-')\n\t\t{\n\t\t\tnegative = true;\n\t\t\ti++;\n\t\t}\n\n\t\t// Now move past digits\n\t\tvar foundNumber = false;\n\t\tvar zeroStart = false;\n\t\tlong parsedValue = 0;\n\t\tvar overflowed = false;\n\t\tvalue = 0;\n\t\twhile (i < span.Length && char.IsDigit(span[i]))\n\t\t{\n\t\t\tif (zeroStart) return false;\n\n\t\t\tif (!foundNumber && span[i] == '0')\n\t\t\t\tzeroStart = true;\n\n\t\t\tfoundNumber = true;\n\t\t\tif (!overflowed)\n\t\t\t{\n\t\t\t\tparsedValue = parsedValue * 10 + span[i] - '0';\n\t\t\t\toverflowed = parsedValue is <= _minInteger or >= _maxInteger;\n\t\t\t}\n\n\t\t\ti++;\n\t\t}\n\n\t\tif (overflowed) return false;\n\n\t\tif (negative)\n\t\t{\n\t\t\tif (parsedValue == 0) return false;\n\t\t\tparsedValue = -parsedValue;\n\t\t}\n\n\t\tindex = i;\n\t\tvalue = (int)Math.Min(int.MaxValue, Math.Max(int.MinValue, parsedValue));\n\t\treturn foundNumber;\n\t}\n\n\tpublic static bool TryParseJson(this ReadOnlySpan span, ref int i, out JsonNode? node)\n\t{\n\t\tif (!span.ConsumeWhitespace(ref i))\n\t\t{\n\t\t\tnode = null;\n\t\t\treturn false;\n\t\t}\n\n\t\ttry\n\t\t{\n\t\t\tint end = i;\n\t\t\tchar endChar;\n\t\t\tswitch (span[i])\n\t\t\t{\n\t\t\t\tcase 'f':\n\t\t\t\t\tend += 5;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 't':\n\t\t\t\tcase 'n':\n\t\t\t\t\tend += 4;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '.':\n\t\t\t\tcase '-':\n\t\t\t\tcase '0':\n\t\t\t\tcase '1':\n\t\t\t\tcase '2':\n\t\t\t\tcase '3':\n\t\t\t\tcase '4':\n\t\t\t\tcase '5':\n\t\t\t\tcase '6':\n\t\t\t\tcase '7':\n\t\t\t\tcase '8':\n\t\t\t\tcase '9':\n\t\t\t\t\tend = i;\n\t\t\t\t\tvar allowDash = true;\n\t\t\t\t\twhile (end < span.Length && (span[end].In('0'..('9' + 1)) ||\n\t\t\t\t\t\t\t\t\t\t\t\t span[end].In('e', 'E', '.', '-', '+')))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!allowDash && span[end] is '-' or '+') break;\n\t\t\t\t\t\tallowDash = span[end] is 'e' or 'E';\n\t\t\t\t\t\tend++;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase '\\'':\n\t\t\t\tcase '\"':\n\t\t\t\t\tend = i + 1;\n\t\t\t\t\tendChar = span[i];\n\t\t\t\t\twhile (end < span.Length && span[end] != endChar)\n\t\t\t\t\t{", + "snippet": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\ninternal static class SpanExtensions\n{\n\tpublic static bool ConsumeWhitespace(this ReadOnlySpan span, ref int i)\n\t{\n\t\twhile (i < span.Length && char" + }, + { + "title": "src/JsonPath/SpanExtensions.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/SpanExtensions.cs#L121-L174", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/SpanExtensions.cs", + "startLine": 121, + "endLine": 174, + "content": "if (span[end] == '\\\\')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tend++;\n\t\t\t\t\t\t\tif (end >= span.Length) break;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tend++;\n\t\t\t\t\t}\n\n\t\t\t\t\tend++;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '{':\n\t\t\t\tcase '[':\n\t\t\t\t\tend = i + 1;\n\t\t\t\t\tendChar = span[i] == '{' ? '}' : ']';\n\t\t\t\t\tvar inString = false;\n\t\t\t\t\twhile (end < span.Length)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar escaped = false;\n\t\t\t\t\t\tif (span[end] == '\\\\')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tescaped = true;\n\t\t\t\t\t\t\tend++;\n\t\t\t\t\t\t\tif (end >= span.Length) break;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!escaped && span[end] == '\"')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tinString = !inString;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (!inString && span[end] == endChar) break;\n\n\t\t\t\t\t\tend++;\n\t\t\t\t\t}\n\n\t\t\t\t\tend++;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tnode = default;\n\t\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tvar block = span[i..end];\n\t\t\tif (block[0] == '\\'' && block[^1] == '\\'')\n\t\t\t\tblock = $\"\\\"{block[1..^1].ToString().Replace(\"\\\"\", \"\\\\\\\"\").Replace(\"\\\\'\", \"'\")}\\\"\".AsSpan();\n\t\t\tnode = JsonNode.Parse(block.ToString());\n\t\t\ti = end;\n\t\t\treturn true;\n\t\t}\n\t\tcatch\n\t\t{\n\t\t\tnode = default;\n\t\t\treturn false;\n\t\t}\n\t}\n}", + "snippet": "if (span[end] == '\\\\')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tend++;\n\t\t\t\t\t\t\tif (end >= span.Length) break;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tend++;\n\t\t\t\t\t}\n\n\t\t\t\t\tend++;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '{':\n\t\t\t\tcase '[':\n\t\t\t\t\tend = i + 1;\n\t\t\t\t\tendChar = span[i] == '{' ? '}' : " + }, + { + "title": "src/JsonPath/UtilityExtensions.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/UtilityExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/UtilityExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\n\nnamespace Json.Path;\n\ninternal static class UtilityExtensions\n{\n\tpublic static bool In(this T value, params T[] range)\n\t{\n\t\treturn range.Contains(value);\n\t}\n\n#if NET9_0_OR_GREATER\n\tpublic static bool In(this T value, params ReadOnlySpan range) where T : IEquatable\n\t{\n\t\treturn MemoryExtensions.Contains(range, value);\n\t}\n#endif\n\n\tpublic static bool In(this char value, Range range)\n\t{\n\t\treturn range.Start.Value <= value && value < range.End.Value;\n\t}\n\n\tpublic static IEnumerable Yield(this T item)\n\t{\n\t\tyield return item;\n\t}\n\n\tprivate static bool IsValidForPropertyName(this char ch)\n\t{\n\t\treturn ch.In('a'..('z' + 1)) ||\n\t\t\t ch.In('A'..('Z' + 1)) ||\n\t\t\t ch.In('0'..('9' + 1)) ||\n\t\t\t ch.In('_') ||\n\t\t\t ch.In(0x80..0x10FFFF);\n\t}\n\n\tprivate static bool IsValidForPropertyNameStart(this char ch)\n\t{\n\t\treturn ch.In('a'..('z' + 1)) ||\n\t\t\t ch.In('A'..('Z' + 1)) ||\n\t\t\t ch.In('_') ||\n\t\t\t ch.In(0x80..0x10FFFF);\n\t}\n\n\tpublic static bool TryParseName(this ReadOnlySpan source, ref int index, [NotNullWhen(true)] out string? name, PathParsingOptions options)\n\t{\n\t\tvar i = index;\n\n\t\tif (options.TolerateExtraWhitespace && !source.ConsumeWhitespace(ref i) || i == source.Length)\n\t\t{\n\t\t\tname = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (i < source.Length && source[i].IsValidForPropertyNameStart())\n\t\t{\n\t\t\ti++;\n\t\t\twhile (i < source.Length && source[i].IsValidForPropertyName())\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\n\t\tif (index == i)\n\t\t{\n\t\t\tname = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tname = source[index..i].ToString();\n\t\tindex = i;\n\t\treturn true;\n\t}\n\n\tpublic static string HandleDotNetSupportIssues(this string regex)\n\t{\n\t\tvar sb = new StringBuilder();\n\t\tvar escaped = false;\n\t\tvar inBrackets = false;\n\t\tforeach (var c in regex)\n\t\t{\n\t\t\tif (!escaped && !inBrackets && c == '.')\n\t\t\t{\n\t\t\t\t// The Regex class doesn't match `.` on non-BMP unicode very well,\n\t\t\t\t// so we need to translate that to something it does understand.\n\t\t\t\t// Ref: https://github.com/ietf-wg-jsonpath/iregexp/issues/22#issuecomment-1510543510\n\t\t\t\tsb.Append(@\"(?:(?![\\r\\n])\\P{Cs}|\\p{Cs}\\p{Cs})\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsb.Append(c);\n\t\t\t\tif (c == '\\\\')\n\t\t\t\t{\n\t\t\t\t\tescaped = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (!escaped && c == '[')\n\t\t\t\t{\n\t\t\t\t\tinBrackets = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (!escaped && c == ']')\n\t\t\t\t{\n\t\t\t\t\tinBrackets = false;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tescaped = false;\n\t\t}\n\n\t\tvar dotnetTranslation = sb.ToString();\n\t\treturn dotnetTranslation;\n\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\n\nnamespace Json.Path;\n\ninternal static class UtilityExtensions\n{\n\tpublic static bool In(this" + }, + { + "title": "src/JsonPath/UtilityExtensions.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/UtilityExtensions.cs#L121-L121", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/UtilityExtensions.cs", + "startLine": 121, + "endLine": 121, + "content": "}", + "snippet": "}" + }, + { + "title": "src/JsonPath/ValueFunction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/ValueFunction.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/ValueFunction.cs", + "startLine": 1, + "endLine": 26, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Implements the `value()` function which extracts a single value from a nodelist.\n/// \npublic class ValueFunction : ValueFunctionDefinition\n{\n\t/// \n\t/// Gets the function name.\n\t/// \n\tpublic override string Name => \"value\";\n\n\t/// \n\t/// Evaluates the function.\n\t/// \n\t/// A nodelist.\n\t/// If the nodelist contains a single node, that node's value; otherwise null.\n\tpublic JsonNode? Evaluate(NodeList nodeList)\n\t{\n\t\tif (nodeList.Count == 1) return nodeList[0].Value;\n\n\t\treturn Nothing;\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Implements the `value()` function which extracts a single value from a nodelist.\n/// \npublic class ValueFunction : ValueFunctionDefinition\n" + }, + { + "title": "src/JsonPath/WildcardSelector.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPath/WildcardSelector.cs#L1-L87", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPath/WildcardSelector.cs", + "startLine": 1, + "endLine": 87, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Represents a wildcard selector, `[*]` or `.*`.\n/// \npublic class WildcardSelector : ISelector, IHaveShorthand\n{\n\tinternal WildcardSelector(){}\n\n\tstring IHaveShorthand.ToShorthandString()\n\t{\n\t\treturn \".*\";\n\t}\n\n\tvoid IHaveShorthand.AppendShorthandString(StringBuilder builder)\n\t{\n\t\tbuilder.Append(\".*\");\n\t}\n\n\t/// Returns a string that represents the current object.\n\t/// A string that represents the current object.\n\tpublic override string ToString()\n\t{\n\t\treturn \"*\";\n\t}\n\n\t/// \n\t/// Evaluates the selector.\n\t/// \n\t/// The node to evaluate.\n\t/// The root node (typically used by filter selectors, e.g. `$[?@foo < $.bar]`)\n\t/// \n\t/// A collection of nodes.\n\t///\n\t/// Semantically, this is a nodelist, but leaving as IEnumerable<Node> allows for deferred execution.\n\t/// \n\tpublic IEnumerable Evaluate(Node match, JsonNode? rootNode)\n\t{\n\t\tvar node = match.Value;\n\t\tif (node is JsonObject obj)\n\t\t{\n\t\t\tforeach (var member in obj)\n\t\t\t{\n\t\t\t\tyield return new Node(member.Value, match.Location!.Append(member.Key));\n\t\t\t}\n\t\t}\n\t\telse if (node is JsonArray arr)\n\t\t{\n\t\t\tfor (var i = 0; i < arr.Count; i++)\n\t\t\t{\n\t\t\t\tvar member = arr[i];\n\t\t\t\tyield return new Node(member, match.Location!.Append(i));\n\t\t\t}\n\t\t}\n\t}\n\n\t/// \n\t/// Builds a string using a string builder.\n\t/// \n\t/// The string builder.\n\tpublic void BuildString(StringBuilder builder)\n\t{\n\t\tbuilder.Append('*');\n\t}\n}\n\ninternal class WildcardSelectorParser : ISelectorParser\n{\n\tpublic bool TryParse(ReadOnlySpan source, ref int index, [NotNullWhen(true)] out ISelector? selector, PathParsingOptions options)\n\t{\n\t\tif (source[index] != '*')\n\t\t{\n\t\t\tselector = null;\n\t\t\treturn false;\n\t\t}\n\n\t\tselector = new WildcardSelector();\n\t\tindex++;\n\t\treturn true;\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Text;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Path;\n\n/// \n/// Represents a wildcard selector, `[*]` or `." + }, + { + "title": "src/JsonPointer.Tests/GithubTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/GithubTests.cs#L1-L22", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/GithubTests.cs", + "startLine": 1, + "endLine": 22, + "content": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.Pointer.Tests;\n\npublic class GithubTests\n{\n\t[Test]\n\tpublic void Issue408_ArrayDerefThrowsIndexOutOfRange()\n\t{\n\t\tvar pointer = JsonPointer.Parse(\"/\");\n\t\tvar data = JsonNode.Parse(\"[]\");\n\n\t\tvar success = pointer.TryEvaluate(data, out var array);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(success, Is.False);\n\t\t\tAssert.That(array, Is.Null);\n\t\t});\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.Pointer.Tests;\n\npublic class GithubTests\n{\n\t[Test]\n\tpublic void Issue408_ArrayDerefThrowsIndexOutOfRange()\n\t{\n\t\tvar pointer = JsonPointer.Parse(\"/\");\n\t" + }, + { + "title": "src/JsonPointer.Tests/JsonPointerParseTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/JsonPointerParseTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/JsonPointerParseTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections;\nusing System.Linq;\nusing FluentAssertions;\nusing NUnit.Framework;\n\nnamespace Json.Pointer.Tests;\n\n[TestFixture]\npublic class JsonPointerParseTests\n{\n\tpublic static IEnumerable SpecificationExamples\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(\"\", new string[] { });\n\t\t\tyield return new TestCaseData(\"/foo\", new[] { \"foo\" });\n\t\t\tyield return new TestCaseData(\"/foo/0\", new[] { \"foo\", \"0\" });\n\t\t\tyield return new TestCaseData(\"/\", new[] { \"\" });\n\t\t\tyield return new TestCaseData(\"/a~1b\", new[] { \"a/b\" });\n\t\t\tyield return new TestCaseData(\"/c%d\", new[] { \"c%d\" });\n\t\t\tyield return new TestCaseData(\"/e^f\", new[] { \"e^f\" });\n\t\t\tyield return new TestCaseData(\"/g|h\", new[] { \"g|h\" });\n\t\t\tyield return new TestCaseData(\"/i\\\\j\", new[] { \"i\\\\j\" });\n\t\t\tyield return new TestCaseData(\"/k\\\"l\", new[] { \"k\\\"l\" });\n\t\t\tyield return new TestCaseData(\"/ \", new[] { \" \" });\n\t\t\tyield return new TestCaseData(\"/m~0n\", new[] { \"m~n\" });\n\t\t\tyield return new TestCaseData(\"/c%25d\", new[] { \"c%25d\" });\n\t\t\tyield return new TestCaseData(\"/e%5Ef\", new[] { \"e%5Ef\" });\n\t\t\tyield return new TestCaseData(\"/g%7Ch\", new[] { \"g%7Ch\" });\n\t\t\tyield return new TestCaseData(\"/i%5Cj\", new[] { \"i%5Cj\" });\n\t\t\tyield return new TestCaseData(\"/k%22l\", new[] { \"k%22l\" });\n\t\t\tyield return new TestCaseData(\"/%20\", new[] { \"%20\" });\n\t\t}\n\t}\n\tpublic static IEnumerable UrlSpecificationExamples\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(\"#\", new string[] { });\n\t\t\tyield return new TestCaseData(\"#/foo\", new[] { \"foo\" });\n\t\t\tyield return new TestCaseData(\"#/foo/0\", new[] { \"foo\", \"0\" });\n\t\t\tyield return new TestCaseData(\"#/\", new[] { \"\" });\n\t\t\tyield return new TestCaseData(\"#/a~1b\", new[] { \"a/b\" });\n\t\t\tyield return new TestCaseData(\"#/c%25d\", new[] { \"c%d\" });\n\t\t\tyield return new TestCaseData(\"#/e%5Ef\", new[] { \"e^f\" });\n\t\t\tyield return new TestCaseData(\"#/g%7Ch\", new[] { \"g|h\" });\n\t\t\tyield return new TestCaseData(\"#/i%5Cj\", new[] { \"i\\\\j\" });\n\t\t\tyield return new TestCaseData(\"#/k%22l\", new[] { \"k\\\"l\" });\n\t\t\tyield return new TestCaseData(\"#/%20\", new[] { \" \" });\n\t\t\tyield return new TestCaseData(\"#/m~0n\", new[] { \"m~n\" });\n\t\t}\n\t}\n\tpublic static IEnumerable FailureCases\n\t{\n\t\tget\n\t\t{\n\t\t\t// Normal\n\t\t\tyield return new TestCaseData(\"starts/with/segment\");\n\t\t\tyield return new TestCaseData(\"/invalid/escap~e/sequence\");\n\t\t\tyield return new TestCaseData(\"/ends/with~\");\n\t\t\t// Url\n\t\t\tyield return new TestCaseData(\"#uses/anchor/name\");\n\t\t\tyield return new TestCaseData(\"#/invalid/escap~e/sequence\");\n\t\t\tyield return new TestCaseData(\"#/ends/with~\");\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(SpecificationExamples))]\n\t[TestCaseSource(nameof(UrlSpecificationExamples))]\n\tpublic void Parse(string pointerString, string[] segments)\n\t{\n\t\tvar pointer = JsonPointer.Parse(pointerString);\n\n\t\tpointer.SegmentCount.Should().Be(segments.Length);\n\t\tfor (int i = 0; i < pointer.SegmentCount; i++)\n\t\t{\n\t\t\tvar segment = pointer.GetSegment(i).Decode();\n\t\t\tvar expected = segments[i];\n\n\t\t\tAssert.That(segment, Is.EqualTo(expected));\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(SpecificationExamples))]\n\tpublic void TryParse(string pointerString, string[] segments)\n\t{\n\t\tAssert.That(JsonPointer.TryParse(pointerString, out var pointer), Is.True);\n\n\t\tpointer.SegmentCount.Should().Be(segments.Length);\n\t\tfor (int i = 0; i < pointer.SegmentCount; i++)\n\t\t{\n\t\t\tvar segment = pointer.GetSegment(i).Decode();\n\t\t\tvar expected = segments[i];\n\n\t\t\tAssert.That(segment, Is.EqualTo(expected));\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(FailureCases))]\n\tpublic void ParseFailure(string pointerString)\n\t{\n\t\tAssert.Throws(() => JsonPointer.Parse(pointerString));\n\t}\n\n\t[TestCaseSource(nameof(FailureCases))]\n\tpublic void TryParseFailure(string pointerString)\n\t{\n\t\tAssert.That(JsonPointer.TryParse(pointerString, out _), Is.False);\n\t}\n\n\t[Test]\n\tpublic void ParseShouldStoreNonUrlForm()\n\t{\n\t\tvar pointer = JsonPointer.Parse(\"#/foo\");\n\t\tvar expected = \"/foo\";\n\n\t\tvar actual = pointer.ToString();\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}", + "snippet": "using System.Collections;\nusing System.Linq;\nusing FluentAssertions;\nusing NUnit.Framework;\n\nnamespace Json.Pointer.Tests;\n\n[TestFixture]\npublic class JsonPointerParseTests\n{\n\tpublic static IEnumerable SpecificationExamp" + }, + { + "title": "src/JsonPointer.Tests/JsonPointerParseTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/JsonPointerParseTests.cs#L121-L155", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/JsonPointerParseTests.cs", + "startLine": 121, + "endLine": 155, + "content": "[Test]\n\tpublic void TryParseShouldStoreNonUrlForm()\n\t{\n\t\tAssert.That(JsonPointer.TryParse(\"#/foo\", out var pointer), Is.True);\n\t\tvar expected = \"/foo\";\n\n\t\tvar actual = pointer.ToString();\n\n\t\tAssert.That(actual, Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void TrailingSlash()\n\t{\n\t\tvar result = JsonPointer.TryParse(\"/foo/\", out var pointer);\n\n\t\tAssert.That(result, Is.True);\n\t\tAssert.That(pointer.SegmentCount, Is.EqualTo(2));\n\n\t\tAssert.That(pointer.GetSegment(0).ToString(), Is.EqualTo(\"foo\"));\n\t\tAssert.That(pointer.GetSegment(1).ToString(), Is.EqualTo(\"\"));\n\t}\n\n\t[TestCaseSource(nameof(SpecificationExamples))]\n\tpublic void CreateThenToString(string pointerString, string[] segments)\n\t{\n#pragma warning disable CS0618 // Type or member is obsolete\n\t\tvar pointer = JsonPointer.Create(segments.Select(x => (SegmentValueStandIn)x).ToArray());\n#pragma warning restore CS0618 // Type or member is obsolete\n\n\t\tvar backToString = pointer.ToString();\n\t\tAssert.That(backToString, Is.EqualTo(pointerString));\n\t}\n}", + "snippet": "[Test]\n\tpublic void TryParseShouldStoreNonUrlForm()\n\t{\n\t\tAssert.That(JsonPointer.TryParse(\"#/foo\", out var pointer), Is.True);\n\t\tvar expected = \"/foo\";\n\n\t\tvar actual = pointer.ToString();\n\n\t\tAssert.That(actual, Is.EqualT" + }, + { + "title": "src/JsonPointer.Tests/JsonPointerSegmentTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/JsonPointerSegmentTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/JsonPointerSegmentTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing NUnit.Framework;\n\nnamespace Json.Pointer.Tests;\n\npublic class JsonPointerSegmentTests\n{\n [Test]\n public void SegmentEqualsString()\n {\n var pointer = JsonPointer.Parse(\"/foo/bar\");\n var segment = pointer[1];\n\n Assert.That(segment == \"bar\", Is.True);\n Assert.That(segment == \"baz\", Is.False);\n Assert.That(segment != \"baz\", Is.True);\n Assert.That(segment != \"bar\", Is.False);\n }\n\n [Test]\n public void SegmentEqualsSpan()\n {\n var pointer = JsonPointer.Parse(\"/foo/bar\");\n var segment = pointer[1];\n var span = \"bar\".AsSpan();\n\n Assert.That(segment == span, Is.True);\n Assert.That(segment == \"baz\".AsSpan(), Is.False);\n Assert.That(segment != \"baz\".AsSpan(), Is.True);\n Assert.That(segment != span, Is.False);\n }\n\n [Test]\n public void SegmentEqualsSegment()\n {\n var pointer1 = JsonPointer.Parse(\"/foo/bar\");\n var pointer2 = JsonPointer.Parse(\"/baz/bar\");\n var segment1 = pointer1[1];\n var segment2 = pointer2[1];\n\n Assert.That(segment1 == segment2, Is.True);\n Assert.That(segment1 == pointer1[0], Is.False);\n Assert.That(segment1 != pointer1[0], Is.True);\n Assert.That(segment1 != segment2, Is.False);\n }\n\n [Test]\n public void SegmentToString()\n {\n var pointer = JsonPointer.Parse(\"/foo/bar\");\n var segment = pointer[1];\n\n Assert.That(segment.ToString(), Is.EqualTo(\"bar\"));\n }\n\n [Test]\n public void SegmentAsSpan()\n {\n var pointer = JsonPointer.Parse(\"/foo/bar\");\n var segment = pointer[1];\n var span = segment.AsSpan();\n\n Assert.That(span.SequenceEqual(\"bar\".AsSpan()), Is.True);\n }\n\n [Test]\n public void PointerIndexer()\n {\n var pointer = JsonPointer.Parse(\"/foo/bar\");\n\n Assert.That(pointer[0] == \"foo\", Is.True);\n Assert.That(pointer[1] == \"bar\", Is.True);\n Assert.Throws(() => _ = pointer[2]);\n Assert.Throws(() => _ = pointer[-1]);\n }\n\n [Test]\n public void PointerTryGetSegment()\n {\n var pointer = JsonPointer.Parse(\"/foo/bar\");\n\n Assert.That(pointer.TryGetSegment(0, out var segment0), Is.True);\n Assert.That(segment0 == \"foo\", Is.True);\n\n Assert.That(pointer.TryGetSegment(1, out var segment1), Is.True);\n Assert.That(segment1 == \"bar\", Is.True);\n\n Assert.That(pointer.TryGetSegment(2, out _), Is.False);\n Assert.That(pointer.TryGetSegment(-1, out _), Is.False);\n }\n\n [Test]\n public void SegmentEqualsWithEncodedValues()\n {\n var pointer = JsonPointer.Parse(\"/foo~0bar/foo~1bar/foo~0~1bar\");\n \n // Test ~0 (tilde)\n Assert.That(pointer[0] == \"foo~bar\", Is.True);\n Assert.That(pointer[0] == \"foo~0bar\", Is.False);\n \n // Test ~1 (forward slash)\n Assert.That(pointer[1] == \"foo/bar\", Is.True);\n Assert.That(pointer[1] == \"foo~1bar\", Is.False);\n \n // Test ~0~1 (tilde followed by forward slash)\n Assert.That(pointer[2] == \"foo~/bar\", Is.True);\n Assert.That(pointer[2] == \"foo~0~1bar\", Is.False);\n }\n\n [Test]\n public void SegmentEqualsWithUnencodedValues()\n {\n var pointer = JsonPointer.Parse(\"/foo~0bar/foo~1bar/foo~0~1bar\");\n \n // Test unencoded tilde\n Assert.That(pointer[0] == \"foo~bar\", Is.True);\n Assert.That(pointer[0] == \"foo~0bar\", Is.False);\n \n // Test unencoded forward slash\n Assert.That(pointer[1] == \"foo/bar\", Is.True);", + "snippet": "using System;\nusing NUnit.Framework;\n\nnamespace Json.Pointer.Tests;\n\npublic class JsonPointerSegmentTests\n{\n [Test]\n public void SegmentEqualsString()\n {\n var pointer = JsonPointer.Parse(\"/foo/bar\");\n " + }, + { + "title": "src/JsonPointer.Tests/JsonPointerSegmentTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/JsonPointerSegmentTests.cs#L121-L162", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/JsonPointerSegmentTests.cs", + "startLine": 121, + "endLine": 162, + "content": "Assert.That(pointer[1] == \"foo~1bar\", Is.False);\n \n // Test unencoded tilde followed by forward slash\n Assert.That(pointer[2] == \"foo~/bar\", Is.True);\n Assert.That(pointer[2] == \"foo~0~1bar\", Is.False);\n }\n\n [Test]\n public void SegmentEqualsWithMixedEncodedAndUnencodedValues()\n {\n var pointer = JsonPointer.Parse(\"/foo~0bar/foo~1bar/foo~0~1bar\");\n \n // Test encoded tilde against unencoded\n Assert.That(pointer[0] == \"foo~bar\", Is.True);\n Assert.That(pointer[0] == \"foo~0bar\", Is.False);\n \n // Test unencoded forward slash against encoded\n Assert.That(pointer[1] == \"foo/bar\", Is.True);\n Assert.That(pointer[1] == \"foo~1bar\", Is.False);\n \n // Test encoded tilde+slash against unencoded\n Assert.That(pointer[2] == \"foo~/bar\", Is.True);\n Assert.That(pointer[2] == \"foo~0~1bar\", Is.False);\n }\n\n [Test]\n public void SegmentEqualsWithEmptyValues()\n {\n var pointer = JsonPointer.Parse(\"//\");\n \n Assert.That(pointer[0] == \"\", Is.True);\n Assert.That(pointer[1] == \"\", Is.True);\n }\n\n [Test]\n public void SegmentEqualsWithSpecialCharacters()\n {\n var pointer = JsonPointer.Parse(\"/!@#$%^&*()_+-=[]{}|;:,.<>?\");\n \n Assert.That(pointer[0] == \"!@#$%^&*()_+-=[]{}|;:,.<>?\", Is.True);\n }\n}", + "snippet": "Assert.That(pointer[1] == \"foo~1bar\", Is.False);\n \n // Test unencoded tilde followed by forward slash\n Assert.That(pointer[2] == \"foo~/bar\", Is.True);\n Assert.That(pointer[2] == \"foo~0~1bar\", " + }, + { + "title": "src/JsonPointer.Tests/JsonPointerTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/JsonPointerTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/JsonPointerTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.Pointer.Tests;\n\n[TestFixture]\npublic class JsonPointerTests\n{\n\tpublic static IEnumerable ErrorCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(\"/d\");\n\t\t\tyield return new TestCaseData(\"/a/0\");\n\t\t\tyield return new TestCaseData(\"/d/something\");\n\t\t\tyield return new TestCaseData(\"/b/false\");\n\t\t\tyield return new TestCaseData(\"/b/-1\");\n\t\t\tyield return new TestCaseData(\"/b/5\");\n\t\t\tyield return new TestCaseData(\"/c/1\");\n\t\t\tyield return new TestCaseData(\"/b/001\");\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(ErrorCases))]\n\tpublic void Errors(string pointerString)\n\t{\n\t\tusing var target = JsonDocument.Parse(\"{\\\"a\\\":\\\"1\\\",\\\"b\\\":[5, true, null],\\\"c\\\":{\\\"false\\\":false}}\");\n\n\t\tvar pointer = JsonPointer.Parse(pointerString);\n\n\t\tvar actual = pointer.Evaluate(target.RootElement);\n\n\t\tAssert.That(actual, Is.Null);\n\t}\n\n\t[TestCaseSource(nameof(ErrorCases))]\n\tpublic void Errors_ButWithNodes(string pointerString)\n\t{\n\t\tvar target = JsonNode.Parse(\"{\\\"a\\\":\\\"1\\\",\\\"b\\\":[5, true, null],\\\"c\\\":{\\\"false\\\":false}}\")!;\n\n\t\tvar pointer = JsonPointer.Parse(pointerString);\n\n\t\tvar success = pointer.TryEvaluate(target, out var actual);\n\n\t\tAssert.That(success, Is.False);\n\t\tAssert.That(actual, Is.Null);\n\t}\n\n\t[Test]\n\tpublic void IndexingAnObjectInterpretsIndexAsKey()\n\t{\n\t\tusing var target = JsonDocument.Parse(\"{\\\"a\\\":\\\"1\\\",\\\"b\\\":[5, true, null],\\\"c\\\":{\\\"0\\\":false}}\");\n\n\t\tvar pointer = JsonPointer.Parse(\"/c/0\");\n\n\t\tvar actual = pointer.Evaluate(target.RootElement)!;\n\n\t\t// ReSharper disable once PossibleInvalidOperationException\n\t\tAssert.That(actual.Value.GetBoolean(), Is.EqualTo(false));\n\t}\n\n\t[Test]\n\tpublic void IndexingAnObjectInterpretsIndexAsKey_ButWithNodes()\n\t{\n\t\tvar target = JsonNode.Parse(\"{\\\"a\\\":\\\"1\\\",\\\"b\\\":[5, true, null],\\\"c\\\":{\\\"0\\\":false}}\")!;\n\n\t\tvar pointer = JsonPointer.Parse(\"/c/0\");\n\n\t\tvar success = pointer.TryEvaluate(target, out var actual);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(success, Is.True);\n\t\t\tAssert.That(actual!.GetValue(), Is.EqualTo(false));\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void GettingLastItemInArray()\n\t{\n\t\tusing var target = JsonDocument.Parse(\"{\\\"a\\\":\\\"1\\\",\\\"b\\\":[5, true, null],\\\"c\\\":{\\\"0\\\":false}}\");\n\n\t\tvar pointer = JsonPointer.Parse(\"/b/-\");\n\n\t\tvar actual = pointer.Evaluate(target.RootElement)!;\n\n\t\t// ReSharper disable once PossibleInvalidOperationException\n\t\tAssert.That(actual.Value.ValueKind, Is.EqualTo(JsonValueKind.Null));\n\t}\n\n\t[Test]\n\tpublic void GettingLastItemInArray_ButWithNodes()\n\t{\n\t\tvar target = JsonNode.Parse(\"{\\\"a\\\":\\\"1\\\",\\\"b\\\":[5, true, null],\\\"c\\\":{\\\"0\\\":false}}\")!;\n\n\t\tvar pointer = JsonPointer.Parse(\"/b/-\");\n\n\t\tvar success = pointer.TryEvaluate(target, out var actual);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(success, Is.True);\n\t\t\tAssert.That(actual, Is.Null);\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void ImplicitCastTest()\n\t{\n\t\tvar pointer = JsonPointer.Create(\"string\", 1, \"foo\");\n\n\t\tAssert.That(pointer.ToString(), Is.EqualTo(\"/string/1/foo\"));\n\t}\n\n\t[Test]\n\tpublic void ToString_WithEncodedCharacters()\n\t{\n\t\tvar p = JsonPointer.Create(\"some\", \"pointerOld\", \"with~tilde\");", + "snippet": "using System.Collections;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nnamespace Json.Pointer.Tests;\n\n[TestFixture]\npublic class JsonPointerTests\n{\n\tpublic static IEnumerable ErrorCases\n\t" + }, + { + "title": "src/JsonPointer.Tests/JsonPointerTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/JsonPointerTests.cs#L121-L144", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/JsonPointerTests.cs", + "startLine": 121, + "endLine": 144, + "content": "var result = p.ToString();\n\t\tAssert.That(result, Is.EqualTo(\"/some/pointerOld/with~0tilde\"));\n\t}\n\n\t[Test]\n\tpublic void ToString_EncodedCharactersOnly()\n\t{\n\t\tvar p = JsonPointer.Create(\"~~~~~~~~~\", \"/////////\", \"~~~~~~~~~\", \"/////////\");\n\n\t\tvar result = p.ToString();\n\t\tAssert.That(result, Is.EqualTo(\"/~0~0~0~0~0~0~0~0~0/~1~1~1~1~1~1~1~1~1/~0~0~0~0~0~0~0~0~0/~1~1~1~1~1~1~1~1~1\"));\n\t}\n\n\t[TestCase(\"/foo/bar\", \"/foo\", true)]\n\t[TestCase(\"/foo/bar\", \"/fo\", false)]\n\tpublic void StartsWithPartialSegment(string full, string partial, bool startsWith)\n\t{\n\t\tvar fullPointer = JsonPointer.Parse(full);\n\t\tvar partialPointer = JsonPointer.Parse(partial);\n\n\t\tAssert.That(fullPointer.StartsWith(partialPointer), Is.EqualTo(startsWith));\n\t}\n}", + "snippet": "var result = p.ToString();\n\t\tAssert.That(result, Is.EqualTo(\"/some/pointerOld/with~0tilde\"));\n\t}\n\n\t[Test]\n\tpublic void ToString_EncodedCharactersOnly()\n\t{\n\t\tvar p = JsonPointer.Create(\"~~~~~~~~~\", \"/////////\", \"~~~~~~~~~" + }, + { + "title": "src/JsonPointer.Tests/ManipulationTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/ManipulationTests.cs#L1-L53", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/ManipulationTests.cs", + "startLine": 1, + "endLine": 53, + "content": "using NUnit.Framework;\n\nnamespace Json.Pointer.Tests;\n\npublic class ManipulationTests\n{\n\t[TestCase(\"/foo/5/bar\", 0, \"/foo/5/bar\")]\n\t[TestCase(\"/foo/5/bar\", 1, \"/foo/5\")]\n\t[TestCase(\"/foo/5/bar\", 2, \"/foo\")]\n\t[TestCase(\"/foo/5/bar\", 3, \"\")]\n\tpublic void Ancestor(string original, int levels, string expected)\n\t{\n\t\tvar pointer = JsonPointer.Parse(original);\n\n\t\tvar actual = pointer.GetParent(levels);\n\n\t\tAssert.That(actual.ToString(), Is.EqualTo(expected));\n\t}\n\n\t[TestCase(\"/foo/5/bar\", 3, \"/foo/5/bar\")]\n\t[TestCase(\"/foo/5/bar\", 2, \"/5/bar\")]\n\t[TestCase(\"/foo/5/bar\", 1, \"/bar\")]\n\t[TestCase(\"/foo/5/bar\", 0, \"\")]\n\tpublic void Local(string original, int skip, string expected)\n\t{\n\t\tvar pointer = JsonPointer.Parse(original);\n\n\t\tvar actual = pointer.GetLocal(skip);\n\n\t\tAssert.That(actual.ToString(), Is.EqualTo(expected));\n\t}\n\n\t[TestCase(\"/foo/5/bar\", \"/baz/42/quux\", \"/foo/5/bar/baz/42/quux\")]\n\tpublic void CombinePointer(string a, string b, string expected)\n\t{\n\t\tvar left = JsonPointer.Parse(a);\n\t\tvar right = JsonPointer.Parse(b);\n\n\t\tvar actual = left.Combine(right);\n\n\t\tAssert.That(actual.ToString(), Is.EqualTo(expected));\n\t}\n\n\t[Test]\n\tpublic void CombineSegments()\n\t{\n\t\tvar pointer = JsonPointer.Parse(\"/foo/5/bar\");\n\n\t\tvar actual = pointer.Combine(\"baz\", 0, \"quux\", 5, 10);\n\n\t\tAssert.That(actual.ToString(), Is.EqualTo(\"/foo/5/bar/baz/0/quux/5/10\"));\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nnamespace Json.Pointer.Tests;\n\npublic class ManipulationTests\n{\n\t[TestCase(\"/foo/5/bar\", 0, \"/foo/5/bar\")]\n\t[TestCase(\"/foo/5/bar\", 1, \"/foo/5\")]\n\t[TestCase(\"/foo/5/bar\", 2, \"/foo\")]\n\t[TestCase(\"/" + }, + { + "title": "src/JsonPointer.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonPointer.Tests/obj/Debug/net10.0/JsonPointer.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/obj/Debug/net10.0/JsonPointer.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/obj/Debug/net10.0/JsonPointer.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonPointer.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonPointer.Tests/obj/Debug/net8.0/JsonPointer.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/obj/Debug/net8.0/JsonPointer.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/obj/Debug/net8.0/JsonPointer.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonPointer.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonPointer.Tests/obj/Debug/net9.0/JsonPointer.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/obj/Debug/net9.0/JsonPointer.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/obj/Debug/net9.0/JsonPointer.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonPointer.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonPointer.Tests/obj/Release/net10.0/JsonPointer.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/obj/Release/net10.0/JsonPointer.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/obj/Release/net10.0/JsonPointer.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPointer.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonPointer.Tests/obj/Release/net8.0/JsonPointer.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/obj/Release/net8.0/JsonPointer.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/obj/Release/net8.0/JsonPointer.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPointer.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonPointer.Tests/obj/Release/net9.0/JsonPointer.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/obj/Release/net9.0/JsonPointer.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/obj/Release/net9.0/JsonPointer.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPointer.Tests/RelativeJsonPointerParseTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/RelativeJsonPointerParseTests.cs#L1-L95", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/RelativeJsonPointerParseTests.cs", + "startLine": 1, + "endLine": 95, + "content": "using System.Collections;\nusing System.Linq;\nusing FluentAssertions;\nusing NUnit.Framework;\n\nnamespace Json.Pointer.Tests;\n\n[TestFixture]\npublic class RelativeJsonPointerParseTests\n{\n\tpublic static IEnumerable SpecificationExamples\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(\"1/foo\", 1, 0, new[] { \"foo\" });\n\t\t\tyield return new TestCaseData(\"2/foo/0\", 2, 0, new[] { \"foo\", \"0\" });\n\t\t\tyield return new TestCaseData(\"3/\", 3, 0, new[] { \"\" });\n\t\t\tyield return new TestCaseData(\"4/a~1b\", 4, 0, new[] { \"a/b\" });\n\t\t\tyield return new TestCaseData(\"5/c%d\", 5, 0, new[] { \"c%d\" });\n\t\t\tyield return new TestCaseData(\"6/e^f\", 6, 0, new[] { \"e^f\" });\n\t\t\tyield return new TestCaseData(\"7/g|h\", 7, 0, new[] { \"g|h\" });\n\t\t\tyield return new TestCaseData(\"8/i\\\\j\", 8, 0, new[] { \"i\\\\j\" });\n\t\t\tyield return new TestCaseData(\"9/k\\\"l\", 9, 0, new[] { \"k\\\"l\" });\n\t\t\tyield return new TestCaseData(\"10/ \", 10, 0, new[] { \" \" });\n\t\t\tyield return new TestCaseData(\"11/m~0n\", 11, 0, new[] { \"m~n\" });\n\t\t\tyield return new TestCaseData(\"12/c%25d\", 12, 0, new[] { \"c%25d\" });\n\t\t\tyield return new TestCaseData(\"13/e%5Ef\", 13, 0, new[] { \"e%5Ef\" });\n\t\t\tyield return new TestCaseData(\"14/g%7Ch\", 14, 0, new[] { \"g%7Ch\" });\n\t\t\tyield return new TestCaseData(\"15/i%5Cj\", 15, 0, new[] { \"i%5Cj\" });\n\t\t\tyield return new TestCaseData(\"16/k%22l\", 16, 0, new[] { \"k%22l\" });\n\t\t\tyield return new TestCaseData(\"17/%20\", 17, 0, new[] { \"%20\" });\n\t\t\tyield return new TestCaseData(\"0\", 0, 0, new string[] { });\n\t\t\tyield return new TestCaseData(\"1/0\", 1, 0, new[] { \"0\" });\n\t\t\tyield return new TestCaseData(\"2/highly/nested/objects\", 2, 0, new[] { \"highly\", \"nested\", \"objects\" });\n\t\t\tyield return new TestCaseData(\"0#\", 0, 0, new string[] { });\n\t\t\tyield return new TestCaseData(\"1#\", 1, 0, new string[] { });\n\t\t\tyield return new TestCaseData(\"1-1#\", 1, -1, new string[] { });\n\t\t\tyield return new TestCaseData(\"1+1#\", 1, 1, new string[] { });\n\t\t\tyield return new TestCaseData(\"1-1/path\", 1, -1, new[] { \"path\" });\n\t\t\tyield return new TestCaseData(\"1+1/path\", 1, 1, new[] { \"path\" });\n\t\t}\n\t}\n\tpublic static IEnumerable FailureCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(\"#/\");\n\t\t\tyield return new TestCaseData(\"#/end\");\n\t\t\tyield return new TestCaseData(\"5#/end\");\n\t\t\tyield return new TestCaseData(\"/end\");\n\t\t\tyield return new TestCaseData(\"-1/end\");\n\t\t\tyield return new TestCaseData(\"end\");\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(SpecificationExamples))]\n\tpublic void Parse(string pointerString, int parentSteps, int indexManipulation, string[] segments)\n\t{\n\t\tvar pointer = RelativeJsonPointer.Parse(pointerString);\n\n\t\tpointer.ParentSteps.Should().Be((uint)parentSteps);\n\t\tpointer.ArrayIndexManipulator.Should().Be(indexManipulation);\n\t\tpointer.Pointer.SegmentCount.Should().Be(segments.Length);\n\t\tfor (int i = 0; i < pointer.Pointer.SegmentCount; i++)\n\t\t{\n\t\t\tpointer.Pointer.GetSegment(i).Decode().Should().Be(segments[i]);\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(SpecificationExamples))]\n\tpublic void TryParse(string pointerString, int parentSteps, int indexManipulation, string[] segments)\n\t{\n\t\tAssert.That(RelativeJsonPointer.TryParse(pointerString, out var pointer), Is.True);\n\n\t\tpointer.ParentSteps.Should().Be((uint)parentSteps);\n\t\tpointer.ArrayIndexManipulator.Should().Be(indexManipulation);\n\t\tpointer.Pointer.SegmentCount.Should().Be(segments.Length);\n\t\tfor (int i = 0; i < pointer.Pointer.SegmentCount; i++)\n\t\t{\n\t\t\tpointer.Pointer.GetSegment(i).Decode().Should().Be(segments[i]);\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(FailureCases))]\n\tpublic void ParseFailure(string pointerString)\n\t{\n\t\tAssert.Throws(() => RelativeJsonPointer.Parse(pointerString));\n\t}\n\n\t[TestCaseSource(nameof(FailureCases))]\n\tpublic void TryParseFailure(string pointerString)\n\t{\n\t\tAssert.That(RelativeJsonPointer.TryParse(pointerString, out _), Is.False);\n\t}\n}", + "snippet": "using System.Collections;\nusing System.Linq;\nusing FluentAssertions;\nusing NUnit.Framework;\n\nnamespace Json.Pointer.Tests;\n\n[TestFixture]\npublic class RelativeJsonPointerParseTests\n{\n\tpublic static IEnumerable Specificat" + }, + { + "title": "src/JsonPointer.Tests/RelativeJsonPointerTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/RelativeJsonPointerTests.cs#L1-L59", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/RelativeJsonPointerTests.cs", + "startLine": 1, + "endLine": 59, + "content": "using System.Collections;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Pointer.Tests;\n\n[TestFixture]\npublic class RelativeJsonPointerTests\n{\n\tpublic static IEnumerable SpecificationExamples\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(\"0\", \"\\\"baz\\\"\");\n\t\t\tyield return new TestCaseData(\"1/0\", \"\\\"bar\\\"\");\n\t\t\tyield return new TestCaseData(\"0-1\", \"\\\"bar\\\"\");\n\t\t\tyield return new TestCaseData(\"2/highly/nested/objects\", \"true\");\n\t\t\tyield return new TestCaseData(\"0#\", \"1\");\n\t\t\tyield return new TestCaseData(\"0-1#\", \"0\");\n\t\t\tyield return new TestCaseData(\"1#\", \"\\\"foo\\\"\");\n\t\t}\n\t}\n\tpublic static IEnumerable FailureCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(\"#/\");\n\t\t\tyield return new TestCaseData(\"#/end\");\n\t\t\tyield return new TestCaseData(\"5#/end\");\n\t\t\tyield return new TestCaseData(\"/end\");\n\t\t\tyield return new TestCaseData(\"-1/end\");\n\t\t\tyield return new TestCaseData(\"end\");\n\t\t\tyield return new TestCaseData(\"01#/foo/bar\");\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(SpecificationExamples))]\n\tpublic void EvaluateSuccess(string pointerString, string expectedString)\n\t{\n\t\tvar json = JsonNode.Parse(\"{\\\"foo\\\":[\\\"bar\\\",\\\"baz\\\"],\\\"highly\\\":{\\\"nested\\\":{\\\"objects\\\":true}}}\")!;\n\t\tvar startElement = json[\"foo\"]![1]!;\n\n\t\tvar pointer = RelativeJsonPointer.Parse(pointerString);\n\t\tvar expected = JsonNode.Parse(expectedString)!;\n\n\t\tvar success = pointer.TryEvaluate(startElement, out var actual);\n\n\t\tAssert.That(success, Is.True);\n\t\tJsonAssert.AreEquivalent(expected, actual);\n\t}\n\n\t[TestCaseSource(nameof(FailureCases))]\n\tpublic void EvaluateFailure(string pointerString)\n\t{\n\t\tAssert.Throws(() => RelativeJsonPointer.Parse(pointerString));\n\t}\n}", + "snippet": "using System.Collections;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Pointer.Tests;\n\n[TestFixture]\npublic class RelativeJsonPointerTests\n{\n\tpublic static IEnu" + }, + { + "title": "src/JsonPointer.Tests/SpanExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/SpanExtensions.cs#L1-L78", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/SpanExtensions.cs", + "startLine": 1, + "endLine": 78, + "content": "using System;\n\nnamespace Json.Pointer.Tests;\n\ninternal static class SpanExtensions\n{\n\tinternal static string? Decode(this JsonPointerSegment encoded)\n\t{\n\t\tvar span = encoded.AsSpan();\n\t\tvar l = span.Length;\n\t\tif (l == 0) return string.Empty;\n\n\t\tvar targetIndex = 0;\n\t\tvar sourceIndex = 0;\n\n\t\tSpan target = l < 1024\n\t\t\t? stackalloc char[l]\n\t\t\t: new char[l];\n\n\t\tfor (; sourceIndex < l; targetIndex++, sourceIndex++)\n\t\t{\n\t\t\ttarget[targetIndex] = span[sourceIndex];\n\n\t\t\tif (target[targetIndex] == '/')\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif (target[targetIndex] == '~')\n\t\t\t{\n\t\t\t\tif (sourceIndex == l - 1)\n\t\t\t\t\treturn null;\n\n\t\t\t\tif (span[++sourceIndex] == '0')\n\t\t\t\t\tcontinue; // we already wrote '~' so we're good\n\n\t\t\t\tif (span[sourceIndex] == '1')\n\t\t\t\t\ttarget[targetIndex] = '/';\n\t\t\t\telse\n\t\t\t\t\treturn null; // invalid escape sequence\n\t\t\t}\n\t\t}\n\n#if NET8_0_OR_GREATER\n\t\treturn new string(target[..targetIndex]);\n#else\n\t\treturn target[..targetIndex].ToString();\n#endif\n\t}\n\n\tinternal static int Encode(this ReadOnlySpan key, Span encoded)\n\t{\n\t\tvar length = 0;\n\t\tforeach (var ch in key)\n\t\t{\n\t\t\tswitch (ch)\n\t\t\t{\n\t\t\t\tcase '~':\n\t\t\t\t\tencoded[length] = '~';\n\t\t\t\t\tencoded[length + 1] = '0';\n\t\t\t\t\tlength += 2;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '/':\n\t\t\t\t\tencoded[length] = '~';\n\t\t\t\t\tencoded[length + 1] = '1';\n\t\t\t\t\tlength += 2;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tencoded[length] = ch;\n\t\t\t\t\tlength++;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn length;\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Pointer.Tests;\n\ninternal static class SpanExtensions\n{\n\tinternal static string? Decode(this JsonPointerSegment encoded)\n\t{\n\t\tvar span = encoded.AsSpan();\n\t\tvar l = span.Length;\n\t\tif (l == 0)" + }, + { + "title": "src/JsonPointer.Tests/SpecificationTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/SpecificationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/SpecificationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Pointer.Tests;\n\n[TestFixture]\npublic class SpecificationTests\n{\n\tpublic static IEnumerable ExampleCases\n\t{\n\t\tget\n\t\t{\n\t\t\t// Basic\n\t\t\tyield return new TestCaseData(\"\", @\"{\n\t\t\t\t\t\"\"foo\"\": [\"\"bar\"\", \"\"baz\"\"],\n\t\t\t\t\t\"\"\"\": 0,\n\t\t\t\t\t\"\"a/b\"\": 1,\n\t\t\t\t\t\"\"c%d\"\": 2,\n\t\t\t\t\t\"\"e^f\"\": 3,\n\t\t\t\t\t\"\"g|h\"\": 4,\n\t\t\t\t\t\"\"i\\\\j\"\": 5,\n\t\t\t\t\t\"\"k\\\"\"l\"\": 6,\n\t\t\t\t\t\"\" \"\": 7,\n\t\t\t\t\t\"\"m~n\"\": 8\n\t\t\t\t}\");\n\t\t\tyield return new TestCaseData(\"/foo\", @\"[\"\"bar\"\", \"\"baz\"\"]\");\n\t\t\tyield return new TestCaseData(\"/foo/0\", \"\\\"bar\\\"\");\n\t\t\tyield return new TestCaseData(\"/\", \"0\");\n\t\t\tyield return new TestCaseData(\"/a~1b\", \"1\");\n\t\t\tyield return new TestCaseData(\"/c%d\", \"2\");\n\t\t\tyield return new TestCaseData(\"/e^f\", \"3\");\n\t\t\tyield return new TestCaseData(\"/g|h\", \"4\");\n\t\t\tyield return new TestCaseData(\"/i\\\\j\", \"5\");\n\t\t\tyield return new TestCaseData(\"/k\\\"l\", \"6\");\n\t\t\tyield return new TestCaseData(\"/ \", \"7\");\n\t\t\tyield return new TestCaseData(\"/m~0n\", \"8\");\n\t\t\t// Url\n\t\t\tyield return new TestCaseData(\"#\", @\"{\n\t\t\t\t\t\"\"foo\"\": [\"\"bar\"\", \"\"baz\"\"],\n\t\t\t\t\t\"\"\"\": 0,\n\t\t\t\t\t\"\"a/b\"\": 1,\n\t\t\t\t\t\"\"c%d\"\": 2,\n\t\t\t\t\t\"\"e^f\"\": 3,\n\t\t\t\t\t\"\"g|h\"\": 4,\n\t\t\t\t\t\"\"i\\\\j\"\": 5,\n\t\t\t\t\t\"\"k\\\"\"l\"\": 6,\n\t\t\t\t\t\"\" \"\": 7,\n\t\t\t\t\t\"\"m~n\"\": 8\n\t\t\t\t}\");\n\t\t\tyield return new TestCaseData(\"#/foo\", @\"[\"\"bar\"\", \"\"baz\"\"]\");\n\t\t\tyield return new TestCaseData(\"#/foo/0\", \"\\\"bar\\\"\");\n\t\t\tyield return new TestCaseData(\"#/\", \"0\");\n\t\t\tyield return new TestCaseData(\"#/a~1b\", \"1\");\n\t\t\tyield return new TestCaseData(\"#/c%25d\", \"2\");\n\t\t\tyield return new TestCaseData(\"#/e%5Ef\", \"3\");\n\t\t\tyield return new TestCaseData(\"#/g%7Ch\", \"4\");\n\t\t\tyield return new TestCaseData(\"#/i%5Cj\", \"5\");\n\t\t\tyield return new TestCaseData(\"#/k%22l\", \"6\");\n\t\t\tyield return new TestCaseData(\"#/%20\", \"7\");\n\t\t\tyield return new TestCaseData(\"#/m~0n\", \"8\");\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(ExampleCases))]\n\tpublic void UsingElements(string pointerString, string expectedString)\n\t{\n\t\tusing var target = JsonDocument.Parse(@\"{\n\t\t\t\t\"\"foo\"\": [\"\"bar\"\", \"\"baz\"\"],\n\t\t\t\t\"\"\"\": 0,\n\t\t\t\t\"\"a/b\"\": 1,\n\t\t\t\t\"\"c%d\"\": 2,\n\t\t\t\t\"\"e^f\"\": 3,\n\t\t\t\t\"\"g|h\"\": 4,\n\t\t\t\t\"\"i\\\\j\"\": 5,\n\t\t\t\t\"\"k\\\"\"l\"\": 6,\n\t\t\t\t\"\" \"\": 7,\n\t\t\t\t\"\"m~n\"\": 8\n\t\t\t}\");\n\n\t\tvar pointer = JsonPointer.Parse(pointerString);\n\n\t\tvar actual = pointer.Evaluate(target.RootElement)!;\n\n\t\tusing var expected = JsonDocument.Parse(expectedString);\n\n\t\t// ReSharper disable once PossibleInvalidOperationException\n\t\tJsonAssert.AreEquivalent(expected.RootElement, actual.Value);\n\t}\n\n\t[TestCaseSource(nameof(ExampleCases))]\n\tpublic void UsingNodes(string pointerString, string expectedString)\n\t{\n\t\tvar target = JsonNode.Parse(@\"{\n\t\t\t\t\"\"foo\"\": [\"\"bar\"\", \"\"baz\"\"],\n\t\t\t\t\"\"\"\": 0,\n\t\t\t\t\"\"a/b\"\": 1,\n\t\t\t\t\"\"c%d\"\": 2,\n\t\t\t\t\"\"e^f\"\": 3,\n\t\t\t\t\"\"g|h\"\": 4,\n\t\t\t\t\"\"i\\\\j\"\": 5,\n\t\t\t\t\"\"k\\\"\"l\"\": 6,\n\t\t\t\t\"\" \"\": 7,\n\t\t\t\t\"\"m~n\"\": 8\n\t\t\t}\");\n\n\t\tvar pointer = JsonPointer.Parse(pointerString);\n\n\t\tvar success = pointer.TryEvaluate(target, out var actual);\n\n\t\tvar expected = JsonNode.Parse(expectedString);\n\n\t\tAssert.That(success, Is.True);\n\t\tJsonAssert.AreEquivalent(expected, actual);\n\t}\n\n\t[TestCaseSource(nameof(ExampleCases))]", + "snippet": "using System.Collections;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Pointer.Tests;\n\n[TestFixture]\npublic class SpecificationTests\n{\n\t" + }, + { + "title": "src/JsonPointer.Tests/SpecificationTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/SpecificationTests.cs#L121-L131", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/SpecificationTests.cs", + "startLine": 121, + "endLine": 131, + "content": "public void ToString(string pointerString, string unused)\n\t{\n\t\tif (pointerString.Length != 0 && pointerString[0] == '#')\n\t\t\tAssert.Inconclusive(\"Returning to URI encoded is not supported\");\n\n\t\tvar pointer = JsonPointer.Parse(pointerString);\n\t\tvar backToString = pointer.ToString();\n\n\t\tAssert.That(backToString, Is.EqualTo(pointerString));\n\t}\n}", + "snippet": "public void ToString(string pointerString, string unused)\n\t{\n\t\tif (pointerString.Length != 0 && pointerString[0] == '#')\n\t\t\tAssert.Inconclusive(\"Returning to URI encoded is not supported\");\n\n\t\tvar pointer = JsonPointer.P" + }, + { + "title": "src/JsonPointer.Tests/TypeConverterTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer.Tests/TypeConverterTests.cs#L1-L53", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer.Tests/TypeConverterTests.cs", + "startLine": 1, + "endLine": 53, + "content": "using System.ComponentModel;\nusing NUnit.Framework;\n\nnamespace Json.Pointer.Tests\n{\n public class TypeConverterTests\n {\n\n\t\t[Test]\n\t\tpublic void ConvertFromString()\n\t\t{\n\t\t\tvar typeConverter = TypeDescriptor.GetConverter(typeof(JsonPointer));\n\t\t\tvar pointer = typeConverter.ConvertFromInvariantString(\"/foo\");\n\n\t\t\tAssert.That(pointer, Is.InstanceOf());\n\t\t\tAssert.That(pointer!.ToString(), Is.EqualTo(\"/foo\"));\n\t\t}\n\n\t\t[Test]\n\t\tpublic void ConvertToString()\n\t\t{\n\t\t\tvar pointer = JsonPointer.Parse(\"/foo\");\n\t\t\tvar typeConverter = TypeDescriptor.GetConverter(typeof(JsonPointer));\n\t\t\tvar pointerString = typeConverter.ConvertToInvariantString(pointer);\n\n\t\t\tAssert.That(pointerString, Is.EqualTo(\"/foo\"));\n\t\t}\n\n\t\t[Test]\n\t\tpublic void ConvertFromJsonPointer()\n\t\t{\n\t\t\tvar pointer = JsonPointer.Parse(\"/foo\");\n\t\t\tvar typeConverter = TypeDescriptor.GetConverter(typeof(JsonPointer));\n\t\t\tvar pointer2 = typeConverter.ConvertFrom(pointer);\n\n\t\t\tAssert.That(pointer2, Is.InstanceOf());\n\t\t\tAssert.That(pointer2!.ToString(), Is.EqualTo(\"/foo\"));\n\t\t}\n\n\t\t[Test]\n\t\tpublic void ConvertToJsonPointer()\n\t\t{\n\t\t\tvar pointer = JsonPointer.Parse(\"/foo\");\n\t\t\tvar typeConverter = TypeDescriptor.GetConverter(typeof(JsonPointer));\n\t\t\tvar pointer2 = typeConverter.ConvertTo(pointer, typeof(JsonPointer));\n\n\t\t\tAssert.That(pointer2, Is.InstanceOf());\n\t\t\tAssert.That(pointer2!.ToString(), Is.EqualTo(\"/foo\"));\n\t\t}\n\n }\n}", + "snippet": "using System.ComponentModel;\nusing NUnit.Framework;\n\nnamespace Json.Pointer.Tests\n{\n public class TypeConverterTests\n {\n\n\t\t[Test]\n\t\tpublic void ConvertFromString()\n\t\t{\n\t\t\tvar typeConverter = TypeDescriptor.GetConverter" + }, + { + "title": "src/JsonPointer/EnumerableExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/EnumerableExtensions.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/EnumerableExtensions.cs", + "startLine": 1, + "endLine": 24, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\n\nnamespace Json.Pointer;\n\n/// \n/// More extensions on .\n/// \npublic static class EnumerableExtensions\n{\n\t/// \n\t/// Gets a collection-oriented hash code by combining the hash codes of its elements.\n\t/// \n\t/// The type of element.\n\t/// The collection of elements.\n\t/// A singular integer value that represents the collection.\n\t/// This can be used to correctly compare the contents of collections.\n\t[MethodImpl(MethodImplOptions.AggressiveInlining)]\n\tpublic static int GetCollectionHashCode(this IEnumerable collection)\n\t{\n\t\treturn collection.Aggregate(0, (current, obj) => unchecked(current * 397) ^ (obj?.GetHashCode() ?? 0));\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\n\nnamespace Json.Pointer;\n\n/// \n/// More extensions on .\n/// \npublic static class " + }, + { + "title": "src/JsonPointer/JsonPointer.cs (1/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/JsonPointer.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/JsonPointer.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Buffers;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing System.Net;\n\nnamespace Json.Pointer;\n\n/// \n/// Represents a JSON Pointer as defined in RFC 6901.\n/// This implementation is optimized for minimal allocations.\n/// \n[JsonConverter(typeof(JsonPointerJsonConverter))]\n[TypeConverter(typeof(JsonPointerTypeConverter))]\npublic readonly struct JsonPointer : IEquatable\n{\n\t/// \n\t/// Represents an empty JSON Pointer.\n\t/// \n\tpublic static readonly JsonPointer Empty = new(ReadOnlyMemory.Empty, 0);\n\n\tprivate readonly ReadOnlyMemory _pointer;\n\n\t/// \n\t/// Gets the number of segments in the pointer.\n\t/// \n\tpublic int SegmentCount { get; }\n\n\tprivate JsonPointer(ReadOnlyMemory pointer, int segmentCount)\n\t{\n\t\t_pointer = pointer;\n\t\tSegmentCount = segmentCount;\n\t}\n\n\t/// \n\t/// Gets the parent pointer of this pointer.\n\t/// \n\t/// The number of ancestor levels to go back. Defaults to 1.\n\t/// The parent pointer, or null if this is the root pointer\n\tpublic JsonPointer? GetParent(int levels = 1)\n\t{\n\t\tif (levels < 0) throw new ArgumentOutOfRangeException(nameof(levels), \"Levels must be non-negative\");\n\t\tif (levels == 0) return this;\n\t\tif (SegmentCount < levels) return null;\n\t\tif (SegmentCount == levels) return Empty;\n\n\t\tvar span = _pointer.Span;\n\t\tint lastSlash = span.LastIndexOf('/');\n\t\tif (lastSlash <= 0) return null;\n\n\t\t// Find the nth slash from the end\n\t\tfor (int i = 0; i < levels - 1; i++)\n\t\t{\n\t\t\tlastSlash = span[..lastSlash].LastIndexOf('/');\n\t\t\tif (lastSlash <= 0) return null;\n\t\t}\n\n\t\treturn new JsonPointer(_pointer[..lastSlash], SegmentCount - levels);\n\t}\n\n\t/// \n\t/// Gets the local pointer (trailing end) of this pointer.\n\t/// \n\t/// The number of segments to keep from the end. Defaults to 1.\n\t/// A new pointer containing the specified number of trailing segments\n\tpublic JsonPointer GetLocal(int levels = 1)\n\t{\n\t\tif (levels < 0) throw new ArgumentOutOfRangeException(nameof(levels), \"Levels must be non-negative\");\n\t\tif (levels == 0) return Empty;\n\t\tif (levels > SegmentCount) throw new ArgumentOutOfRangeException(nameof(levels), \"Levels cannot exceed segment count\");\n\n\t\tvar span = _pointer.Span;\n\t\tint start = 0;\n\t\tint segmentsToSkip = SegmentCount - levels;\n\n\t\tfor (int i = 0; i < segmentsToSkip; i++)\n\t\t{\n\t\t\tstart = span[(start + 1)..].IndexOf('/') + start + 1;\n\t\t}\n\n\t\treturn new JsonPointer(_pointer[start..], levels);\n\t}\n\n\t/// \n\t/// Creates a new JSON Pointer from segments.\n\t/// \n\t/// The segments to combine.\n\t/// A new JSON Pointer.\n\t/// \n\t/// This method incurs allocation costs for string concatenation and array creation.\n\t/// For better performance with large pointers, consider using .\n\t/// \n#pragma warning disable CS0618 // Type or member is obsolete\n\tpublic static JsonPointer Create(params SegmentValueStandIn[] segments)\n#pragma warning restore CS0618 // Type or member is obsolete\n\t{\n\t\tif (segments.Length == 0) return Empty;\n\n\t\tvar totalLength = 0;\n\t\tforeach (var segment in segments)\n\t\t{\n\t\t\ttotalLength += segment.Value.Length + 1; // +1 for the '/'\n\t\t}\n\n\t\t// Use stackalloc for small pointers (up to 256 chars)\n\t\tif (totalLength <= 256)\n\t\t{\n\t\t\tSpan combined = stackalloc char[totalLength];\n\t\t\tvar currentPos = 0;\n\n\t\t\tforeach (var segment in segments)\n\t\t\t{\n\t\t\t\tcombined[currentPos++] = '/';\n\t\t\t\tsegment.Value.AsSpan().CopyTo(combined[currentPos..]);\n\t\t\t\tcurrentPos += segment.Value.Length;\n\t\t\t}", + "snippet": "using System;\nusing System.Buffers;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing System.Net;\n\nnamespace Json.Pointer;\n\n" + }, + { + "title": "src/JsonPointer/JsonPointer.cs (2/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/JsonPointer.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/JsonPointer.cs", + "startLine": 121, + "endLine": 240, + "content": "return new JsonPointer(combined.ToArray(), segments.Length);\n\t\t}\n\n\t\t// Use ArrayPool for larger pointers\n\t\tchar[]? rented = null;\n\t\ttry\n\t\t{\n\t\t\trented = ArrayPool.Shared.Rent(totalLength);\n\t\t\tvar combined = rented.AsSpan(0, totalLength);\n\t\t\tvar currentPos = 0;\n\n\t\t\tforeach (var segment in segments)\n\t\t\t{\n\t\t\t\tcombined[currentPos++] = '/';\n\t\t\t\tsegment.Value.AsSpan().CopyTo(combined[currentPos..]);\n\t\t\t\tcurrentPos += segment.Value.Length;\n\t\t\t}\n\n\t\t\treturn new JsonPointer(combined.ToArray(), segments.Length);\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tif (rented != null) \n\t\t\t\tArrayPool.Shared.Return(rented);\n\t\t}\n\t}\n\n\t/// \n\t/// Combines this pointer with another pointer.\n\t/// \n\t/// The pointer to append\n\t/// A new pointer representing the combination\n\tpublic JsonPointer Combine(JsonPointer other)\n\t{\n\t\tif (other._pointer.IsEmpty) return this;\n\n\t\tif (_pointer.IsEmpty) return other;\n\n\t\tint totalLength = _pointer.Length + other._pointer.Length;\n \n\t\t// Use stackalloc for small pointers (up to 256 chars)\n\t\tif (totalLength <= 256)\n\t\t{\n\t\t\tSpan combined = stackalloc char[totalLength];\n\t\t\t_pointer.Span.CopyTo(combined);\n\t\t\tother._pointer.Span.CopyTo(combined[_pointer.Length..]);\n\t\t\treturn new JsonPointer(combined.ToArray(), SegmentCount + other.SegmentCount);\n\t\t}\n \n\t\t// Use ArrayPool for larger pointers\n\t\tchar[]? rented = null;\n\t\ttry\n\t\t{\n\t\t\trented = ArrayPool.Shared.Rent(totalLength);\n\t\t\tvar combined = rented.AsSpan(0, totalLength);\n\t\t\t_pointer.Span.CopyTo(combined);\n\t\t\tother._pointer.Span.CopyTo(combined[_pointer.Length..]);\n\t\t\treturn new JsonPointer(combined.ToArray(), SegmentCount + other.SegmentCount);\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tif (rented != null)\n\t\t\t\tArrayPool.Shared.Return(rented);\n\t\t}\n\t}\n\n\t/// \n\t/// Combines this pointer with additional segments.\n\t/// \n\t/// The segments to append\n\t/// A new pointer representing the combination\n\t/// \n\t/// This method incurs allocation costs for string concatenation and array creation.\n\t/// For better performance with large numbers of segments, consider using .\n\t/// \n#pragma warning disable CS0618 // Type or member is obsolete\n\tpublic JsonPointer Combine(params SegmentValueStandIn[] segments)\n#pragma warning restore CS0618 // Type or member is obsolete\n\t{\n\t\tif (segments.Length == 0) return this;\n\n\t\tvar totalLength = _pointer.Length;\n\t\tvar totalSegments = SegmentCount;\n\n\t\t// Calculate total length and validate segments\n\t\tforeach (var segment in segments)\n\t\t{\n\t\t\ttotalLength += segment.Value.Length + 1; // +1 for the '/'\n\t\t\ttotalSegments++;\n\t\t}\n\n\t\t// Use stackalloc for small pointers (up to 256 chars)\n\t\tif (totalLength <= 256)\n\t\t{\n\t\t\tSpan combined = stackalloc char[totalLength];\n\t\t\t_pointer.Span.CopyTo(combined);\n\t\t\tvar currentPos = _pointer.Length;\n\n\t\t\tforeach (var segment in segments)\n\t\t\t{\n\t\t\t\tcombined[currentPos++] = '/';\n\t\t\t\tsegment.Value.AsSpan().CopyTo(combined[currentPos..]);\n\t\t\t\tcurrentPos += segment.Value.Length;\n\t\t\t}\n\n\t\t\treturn new JsonPointer(combined.ToArray(), totalSegments);\n\t\t}\n\n\t\t// Use ArrayPool for larger pointers\n\t\tchar[]? rented = null;\n\t\ttry\n\t\t{\n\t\t\trented = ArrayPool.Shared.Rent(totalLength);\n\t\t\tvar combined = rented.AsSpan(0, totalLength);\n\t\t\t_pointer.Span.CopyTo(combined);\n\t\t\tvar currentPos = _pointer.Length;\n\n\t\t\tforeach (var segment in segments)\n\t\t\t{\n\t\t\t\tcombined[currentPos++] = '/';", + "snippet": "return new JsonPointer(combined.ToArray(), segments.Length);\n\t\t}\n\n\t\t// Use ArrayPool for larger pointers\n\t\tchar[]? rented = null;\n\t\ttry\n\t\t{\n\t\t\trented = ArrayPool.Shared.Rent(totalLength);\n\t\t\tvar combined = rented.A" + }, + { + "title": "src/JsonPointer/JsonPointer.cs (3/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/JsonPointer.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/JsonPointer.cs", + "startLine": 241, + "endLine": 360, + "content": "segment.Value.AsSpan().CopyTo(combined[currentPos..]);\n\t\t\t\tcurrentPos += segment.Value.Length;\n\t\t\t}\n\n\t\t\treturn new JsonPointer(combined.ToArray(), totalSegments);\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tif (rented != null) \n\t\t\t\tArrayPool.Shared.Return(rented);\n\t\t}\n\t}\n\n\t/// \n\t/// Gets the string representation of this pointer.\n\t/// \n\t/// The pointer string\n\tpublic override string ToString() => _pointer.ToString();\n\n\t/// \n\t/// Gets a segment from the pointer by index.\n\t/// \n\t/// The zero-based index of the segment\n\t/// The segment as a JsonPointerSegment\n\t/// The index is out of range.\n\tpublic JsonPointerSegment GetSegment(int index)\n\t{\n\t\tif (index < 0 || index >= SegmentCount)\n\t\t\tthrow new ArgumentOutOfRangeException(nameof(index));\n\n\t\tvar span = _pointer.Span;\n\t\tint start = 0;\n\t\tint currentIndex = 0;\n\n\t\tfor (int i = 0; i < span.Length; i++)\n\t\t{\n\t\t\tif (span[i] == '/')\n\t\t\t{\n\t\t\t\tif (currentIndex == index)\n\t\t\t\t{\n\t\t\t\t\tstart = i + 1;\n\t\t\t\t}\n\t\t\t\telse if (currentIndex == index + 1)\n\t\t\t\t{\n\t\t\t\t\treturn new JsonPointerSegment(span[start..i]);\n\t\t\t\t}\n\t\t\t\tcurrentIndex++;\n\t\t\t}\n\t\t}\n\n\t\treturn new JsonPointerSegment(span[start..]);\n\t}\n\n\t/// \n\t/// Gets a segment from the pointer by index.\n\t/// \n\t/// The zero-based index of the segment\n\t/// The segment as a JsonPointerSegment\n\t/// The index is out of range.\n\tpublic JsonPointerSegment this[int index]\n\t{\n\t\tget\n\t\t{\n\t\t\tif (index < 0 || index >= SegmentCount)\n\t\t\t\tthrow new ArgumentOutOfRangeException(nameof(index));\n\t\t\t\n\t\t\treturn GetSegment(index);\n\t\t}\n\t}\n\n\t/// \n\t/// Attempts to get a segment from the pointer by index.\n\t/// \n\t/// The zero-based index of the segment\n\t/// The segment if found; default otherwise\n\t/// True if the segment was found; false otherwise\n\tpublic bool TryGetSegment(int index, out JsonPointerSegment segment)\n\t{\n\t\tif (index < 0 || index >= SegmentCount)\n\t\t{\n\t\t\tsegment = default;\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tsegment = GetSegment(index);\n\t\treturn true;\n\t}\n\n\t/// \n\t/// Determines whether the current JSON pointer starts with the specified JSON pointer.\n\t/// \n\t/// The JSON pointer to compare with the beginning of the current pointer. Cannot be null.\n\t/// true if the current JSON pointer starts with the specified pointer; otherwise, false.\n\tpublic bool StartsWith(JsonPointer other)\n\t{\n\t\tif (other.SegmentCount == 0) return true;\n\t\tif (other.SegmentCount > SegmentCount) return false;\n\t\t\n\t\tvar thisSpan = _pointer.Span;\n\t\tvar otherSpan = other._pointer.Span;\n\t\t\n\t\tif (!thisSpan.StartsWith(otherSpan)) return false;\n\t\tif (thisSpan.Length == otherSpan.Length) return true;\n\t\treturn thisSpan[otherSpan.Length] == '/';\n\t}\n\n\t/// \n\t/// Determines whether the current JSON pointer ends with the specified JSON pointer.\n\t/// \n\t/// The JSON pointer to compare with the end of the current pointer. Cannot be null.\n\t/// true if the current JSON pointer ends with the specified pointer; otherwise, false.\n\tpublic bool EndsWith(JsonPointer other)\n\t{\n\t\tif (other.SegmentCount == 0) return true;\n\t\tif (other.SegmentCount > SegmentCount) return false;\n\t\t\n\t\tvar thisSpan = _pointer.Span;\n\t\tvar otherSpan = other._pointer.Span;\n\t\t\n\t\tif (!thisSpan.EndsWith(otherSpan)) return false;", + "snippet": "segment.Value.AsSpan().CopyTo(combined[currentPos..]);\n\t\t\t\tcurrentPos += segment.Value.Length;\n\t\t\t}\n\n\t\t\treturn new JsonPointer(combined.ToArray(), totalSegments);\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tif (rented != null) \n\t\t\t\tArrayPool\n\t/// Compares this pointer with another pointer for equality.\n\t/// \n\tpublic bool Equals(JsonPointer other)\n\t{\n\t\tif (SegmentCount != other.SegmentCount) return false;\n\n\t\treturn _pointer.Span.SequenceEqual(other._pointer.Span);\n\t}\n\n\t/// Indicates whether this instance and a specified object are equal.\n\t/// The object to compare with the current instance.\n\t/// \n\t/// if and this instance are the same type and represent the same value; otherwise, .\n\tpublic override bool Equals(object? obj)\n\t{\n\t\treturn obj is JsonPointer other && Equals(other);\n\t}\n\n\t/// Returns the hash code for this instance.\n\t/// A 32-bit signed integer that is the hash code for this instance.\n\tpublic override int GetHashCode()\n\t{\n\t\tvar span = _pointer.Span;\n\t\tint hash = 0;\n\t\tforeach (var c in span)\n\t\t{\n\t\t\thash = ((hash << 5) + hash) ^ c;\n\t\t}\n\t\treturn hash;\n\t}\n\n\t/// \n\t/// Determines whether two specified JsonPointer instances are equal.\n\t/// \n\t/// The first JsonPointer to compare.\n\t/// The second JsonPointer to compare.\n\t/// true if the specified JsonPointer instances are equal; otherwise, false.\n\tpublic static bool operator ==(JsonPointer left, JsonPointer right) => left.Equals(right);\n\n\t/// \n\t/// Determines whether two specified JsonPointer instances are not equal.\n\t/// \n\t/// The first JsonPointer to compare.\n\t/// The second JsonPointer to compare.\n\t/// true if the specified JsonPointer instances are not equal; otherwise, false.\n\tpublic static bool operator !=(JsonPointer left, JsonPointer right) => !left.Equals(right);\n\n\t/// \n\t/// Evaluates this pointer against a JsonElement to find the referenced value.\n\t/// \n\t/// The root JsonElement to evaluate against\n\t/// The referenced JsonElement if found, null otherwise\n\tpublic JsonElement? Evaluate(JsonElement element)\n\t{\n\t\tif (_pointer.IsEmpty) return element;\n\n\t\tvar current = element;\n\t\tvar span = _pointer.Span;\n\t\tint start = 1; // Skip the leading '/'\n\t\tint currentIndex = 0;\n\n\t\twhile (start <= span.Length)\n\t\t{\n\t\t\tint end = span[start..].IndexOf('/');\n\t\t\tif (end == -1)\n\t\t\t\tend = span.Length;\n\t\t\telse\n\t\t\t\tend += start;\n\n\t\t\tvar segment = span[start..end];\n\n\t\t\tif (current.ValueKind == JsonValueKind.Object)\n\t\t\t{\n\t\t\t\tbool found = false;\n\t\t\t\tforeach (var property in current.EnumerateObject())\n\t\t\t\t{\n\t\t\t\t\tif (GetSegment(currentIndex).Equals(property.Name))\n\t\t\t\t\t{\n\t\t\t\t\t\tcurrent = property.Value;\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) return null;\n\t\t\t}\n\t\t\telse if (current.ValueKind == JsonValueKind.Array)\n\t\t\t{\n\t\t\t\tif (segment.Length == 0) return null;\n\t\t\t\tif (segment is ['0'])\n\t\t\t\t{\n\t\t\t\t\tif (current.GetArrayLength() == 0) return null;\n\t\t\t\t\tcurrent = current[0];\n\t\t\t\t}\n\t\t\t\telse if (segment[0] == '0') return null;\n\t\t\t\telse if (segment is ['-'])\n\t\t\t\t{\n\t\t\t\t\tvar length = current.GetArrayLength();\n\t\t\t\t\tif (length == 0) return null;\n\t\t\t\t\tcurrent = current[length - 1];\n\t\t\t\t}\n\t\t\t\telse if (!segment.TryParse(out int index) || index < 0 || index >= current.GetArrayLength())\n\t\t\t\t\treturn null;\n\t\t\t\telse\n\t\t\t\t\tcurrent = current[index];\n\t\t\t}\n\t\t\telse return null;\n\n\t\t\tstart = end + 1;\n\t\t\tcurrentIndex++;\n\t\t}\n\n\t\treturn current;\n\t}\n\n\t/// ", + "snippet": "if (thisSpan.Length == otherSpan.Length) return true;\n\t\treturn thisSpan[thisSpan.Length - otherSpan.Length - 1] == '/';\n\t}\n\n\t/// \n\t/// Compares this pointer with another pointer for equality.\n\t/// \n\tpu" + }, + { + "title": "src/JsonPointer/JsonPointer.cs (5/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/JsonPointer.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/JsonPointer.cs", + "startLine": 481, + "endLine": 600, + "content": "/// Evaluates the pointer over a .\n\t/// \n\t/// The .\n\t/// The result, if return value is true; null otherwise\n\t/// true if a value exists at the indicate path; false otherwise.\n\tpublic bool TryEvaluate(JsonNode? root, out JsonNode? result)\n\t{\n\t\tif (_pointer.IsEmpty)\n\t\t{\n\t\t\tresult = root;\n\t\t\treturn true;\n\t\t}\n\n\t\tvar current = root;\n\t\tresult = null;\n\t\tvar span = _pointer.Span;\n\t\tint start = 1; // Skip the leading '/'\n\t\tint currentIndex = 0;\n\n\t\twhile (start <= span.Length)\n\t\t{\n\t\t\tint end = span[start..].IndexOf('/');\n\t\t\tif (end == -1)\n\t\t\t\tend = span.Length;\n\t\t\telse\n\t\t\t\tend += start;\n\n\t\t\tvar segment = span[start..end];\n\n\t\t\tswitch (current)\n\t\t\t{\n\t\t\t\tcase JsonArray array:\n\t\t\t\t\tif (segment.Length == 0) return false;\n\t\t\t\t\tif (segment is ['0'])\n\t\t\t\t\t{\n\t\t\t\t\t\tif (array.Count == 0) return false;\n\t\t\t\t\t\tcurrent = array[0];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (segment[0] == '0') return false;\n\t\t\t\t\tif (segment is ['-'])\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = array.Last();\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif (!segment.TryParse(out int index)) return false;\n\t\t\t\t\tif (index >= array.Count) return false;\n\t\t\t\t\tif (index < 0) return false;\n\t\t\t\t\tcurrent = array[index];\n\t\t\t\t\tbreak;\n\t\t\t\tcase JsonObject obj:\n\t\t\t\t\tvar found = false;\n\t\t\t\t\tforeach (var kvp in obj)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (GetSegment(currentIndex).Equals(kvp.Key))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcurrent = kvp.Value;\n\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!found) return false;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tstart = end + 1;\n\t\t\tcurrentIndex++;\n\t\t}\n\n\t\tresult = current;\n\t\treturn true;\n\t}\n\n\t/// \n\t/// Creates a new JSON Pointer from a string.\n\t/// \n\t/// The string representation of the pointer.\n\t/// A new JSON Pointer.\n\t/// is null.\n\t/// is not a valid JSON Pointer.\n\tpublic static JsonPointer Parse(string pointer)\n\t{\n\t\tif (pointer == null)\n\t\t\tthrow new ArgumentNullException(nameof(pointer));\n\n\t\tif (pointer.Length == 0) return Empty;\n\n\t\t// Handle URL-encoded pointers\n\t\tif (pointer[0] == '#')\n\t\t{\n\t\t\tif (pointer.Length == 1) return Empty;\n\n\t\t\tpointer = WebUtility.UrlDecode(pointer[1..]);\n\t\t}\n\n\t\tvar (isValid, segmentCount) = ValidateAndCountSegments(pointer.AsSpan());\n\t\tif (!isValid)\n\t\t\tthrow new PointerParseException(\"Invalid JSON Pointer format\");\n\n\t\treturn new JsonPointer(pointer.AsMemory(), segmentCount);\n\t}\n\n\t/// \n\t/// Attempts to create a new JSON Pointer from a string.\n\t/// \n\t/// The string representation of the pointer.\n\t/// The resulting pointer.\n\t/// true if the pointer was successfully created; false otherwise.\n\tpublic static bool TryParse(string? pointer, out JsonPointer result)\n\t{\n\t\tresult = default;\n\n\t\tif (string.IsNullOrEmpty(pointer))\n\t\t{\n\t\t\tresult = Empty;\n\t\t\treturn true;\n\t\t}", + "snippet": "/// Evaluates the pointer over a .\n\t/// \n\t/// The .\n\t/// The result, if return value is true; null otherwise\n\t" + }, + { + "title": "src/JsonPointer/JsonPointer.cs (6/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/JsonPointer.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/JsonPointer.cs", + "startLine": 601, + "endLine": 720, + "content": "// Handle URL-encoded pointers\n\t\tif (pointer![0] == '#')\n\t\t{\n\t\t\tif (pointer.Length == 1)\n\t\t\t{\n\t\t\t\tresult = Empty;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\tpointer = WebUtility.UrlDecode(pointer[1..]);\n\t\t\t}\n\t\t\tcatch\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tvar (isValid, segmentCount) = ValidateAndCountSegments(pointer.AsSpan());\n\t\tif (!isValid)\n\t\t\treturn false;\n\n\t\tresult = new JsonPointer(pointer.AsMemory(), segmentCount);\n\t\treturn true;\n\t}\n\n\t/// \n\t/// Creates a new JSON Pointer from a span.\n\t/// \n\t/// The span representation of the pointer.\n\t/// A new JSON Pointer.\n\t/// is not a valid JSON Pointer.\n\tpublic static JsonPointer Parse(ReadOnlySpan pointer)\n\t{\n\t\tif (pointer.Length == 0) return Empty;\n\n\t\t// Handle URL-encoded pointers\n\t\tif (pointer[0] == '#')\n\t\t{\n\t\t\tif (pointer.Length == 1) return Empty;\n\n\t\t\t// Convert to string for URL decoding since WebUtility doesn't support spans\n\t\t\tvar decoded = WebUtility.UrlDecode(pointer[1..].ToString());\n\t\t\tpointer = decoded.AsSpan();\n\t\t}\n\n\t\tvar (isValid, segmentCount) = ValidateAndCountSegments(pointer);\n\t\tif (!isValid)\n\t\t\tthrow new PointerParseException(\"Invalid JSON Pointer format\");\n\n\t\treturn new JsonPointer(pointer.ToArray(), segmentCount);\n\t}\n\n\t/// \n\t/// Attempts to create a new JSON Pointer from a span.\n\t/// \n\t/// The span representation of the pointer.\n\t/// The resulting pointer.\n\t/// true if the pointer was successfully created; false otherwise.\n\tpublic static bool TryParse(ReadOnlySpan pointer, out JsonPointer result)\n\t{\n\t\tresult = default;\n\n\t\tif (pointer.Length == 0)\n\t\t{\n\t\t\tresult = Empty;\n\t\t\treturn true;\n\t\t}\n\n\t\t// Handle URL-encoded pointers\n\t\tif (pointer[0] == '#')\n\t\t{\n\t\t\tif (pointer.Length == 1)\n\t\t\t{\n\t\t\t\tresult = Empty;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Convert to string for URL decoding since WebUtility doesn't support spans\n\t\t\tvar decoded = WebUtility.UrlDecode(pointer[1..].ToString());\n\t\t\tpointer = decoded.AsSpan();\n\t\t}\n\n\t\tvar (isValid, segmentCount) = ValidateAndCountSegments(pointer);\n\t\tif (!isValid)\n\t\t\treturn false;\n\n\t\tresult = new JsonPointer(pointer.ToArray(), segmentCount);\n\t\treturn true;\n\t}\n\n\tprivate static (bool IsValid, int SegmentCount) ValidateAndCountSegments(ReadOnlySpan pointer)\n\t{\n\t\t// Must start with '/'\n\t\tif (pointer[0] != '/') return (false, 0);\n\n\t\tint count = 0;\n\t\tfor (int i = 0; i < pointer.Length; i++)\n\t\t{\n\t\t\tif (pointer[i] == '/')\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\telse if (pointer[i] == '~')\n\t\t\t{\n\t\t\t\t// Must have a character after '~'\n\t\t\t\tif (i + 1 >= pointer.Length) return (false, 0);\n\n\t\t\t\t// Must be followed by '0' or '1'\n\t\t\t\tif (pointer[i + 1] != '0' && pointer[i + 1] != '1') return (false, 0);\n\n\t\t\t\t// Skip the next character since we've validated it\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\n\t\treturn (true, count);\n\t}\n}", + "snippet": "// Handle URL-encoded pointers\n\t\tif (pointer![0] == '#')\n\t\t{\n\t\t\tif (pointer.Length == 1)\n\t\t\t{\n\t\t\t\tresult = Empty;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\tpointer = WebUtility.UrlDecode(pointer[1..]);\n\t\t\t}\n\t\t\tcatch\n\t\t\t{\n\t\t" + }, + { + "title": "src/JsonPointer/JsonPointerJsonConverter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/JsonPointerJsonConverter.cs#L1-L34", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/JsonPointerJsonConverter.cs", + "startLine": 1, + "endLine": 34, + "content": "using System;\nusing System.Text.Json;\nusing Json.More;\n\nnamespace Json.Pointer;\n\n/// \n/// Converter for .\n/// \npublic sealed class JsonPointerJsonConverter : WeaklyTypedJsonConverter\n{\n /// Reads and converts the JSON to type .\n /// The reader.\n /// The type to convert.\n /// An object that specifies serialization options to use.\n /// The converted value.\n public override JsonPointer Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n {\n if (reader.TokenType != JsonTokenType.String)\n throw new JsonException(\"Expected string\");\n\n var str = reader.GetString()!;\n return JsonPointer.Parse(str);\n }\n\n /// Writes a specified value as JSON.\n /// The writer to write to.\n /// The value to convert to JSON.\n /// An object that specifies serialization options to use.\n public override void Write(Utf8JsonWriter writer, JsonPointer value, JsonSerializerOptions options)\n {\n writer.WriteStringValue(value.ToString());\n }\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing Json.More;\n\nnamespace Json.Pointer;\n\n/// \n/// Converter for .\n/// \npublic sealed class JsonPointerJsonConverter : WeaklyTypedJsonCon" + }, + { + "title": "src/JsonPointer/JsonPointerSegment.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/JsonPointerSegment.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/JsonPointerSegment.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\n\nnamespace Json.Pointer;\n\n/// \n/// Represents a segment of a JSON Pointer.\n/// This is a ref struct to ensure zero allocations.\n/// \n// ReSharper disable once StructLacksIEquatable.Global\npublic readonly ref struct JsonPointerSegment\n{\n private readonly ReadOnlySpan _segment;\n\n internal JsonPointerSegment(ReadOnlySpan segment)\n {\n _segment = segment;\n }\n\n private bool SegmentEquals(ReadOnlySpan value)\n {\n // If neither contains escape sequences, we can do a direct comparison\n if (_segment.IndexOf('~') == -1 && value.IndexOf('~') == -1)\n return _segment.SequenceEqual(value);\n\n // Otherwise, compare while handling escape sequences\n int i = 0, j = 0;\n while (i < _segment.Length && j < value.Length)\n {\n if (_segment[i] == '~' && i + 1 < _segment.Length)\n {\n if (_segment[i + 1] == '0')\n {\n if (value[j] != '~') return false;\n i += 2;\n j++;\n }\n else if (_segment[i + 1] == '1')\n {\n if (value[j] != '/') return false;\n i += 2;\n j++;\n }\n else\n {\n if (_segment[i] != value[j]) return false;\n i++;\n j++;\n }\n }\n else if (value[j] == '~' && j + 1 < value.Length)\n {\n if (value[j + 1] == '0')\n {\n if (_segment[i] != '~') return false;\n i++;\n j += 2;\n }\n else if (value[j + 1] == '1')\n {\n if (_segment[i] != '/') return false;\n i++;\n j += 2;\n }\n else\n {\n if (_segment[i] != value[j]) return false;\n i++;\n j++;\n }\n }\n else\n {\n if (_segment[i] != value[j]) return false;\n i++;\n j++;\n }\n }\n\n return i == _segment.Length && j == value.Length;\n }\n\n /// \n /// Compares this segment with a string, handling both encoded and unencoded values.\n /// \n /// The value to compare against (can be encoded or unencoded)\n /// True if the segment matches the value, false otherwise\n public bool Equals(string? value)\n {\n if (value == null)\n throw new ArgumentNullException(nameof(value));\n return SegmentEquals(value.AsSpan());\n }\n\n /// \n /// Compares this segment with an integer.\n /// \n /// The value to compare against\n /// True if the segment matches the value, false otherwise\n public bool Equals(int value)\n {\n return SegmentEquals(value.ToString().AsSpan());\n }\n\n /// \n /// Compares this segment with another segment.\n /// \n /// The segment to compare against.\n /// True if the segments are equal; false otherwise.\n public bool Equals(JsonPointerSegment other) => \n SegmentEquals(other._segment);\n\n /// Indicates whether this instance and a specified object are equal.\n /// The object to compare with the current instance.\n /// true if obj and this instance are the same type and represent the same value; otherwise, false.\n public override bool Equals(object? obj)\n {\n\t if (obj is string str) return Equals(str);\n\n\t return false;\n }", + "snippet": "using System;\n\nnamespace Json.Pointer;\n\n/// \n/// Represents a segment of a JSON Pointer.\n/// This is a ref struct to ensure zero allocations.\n/// \n// ReSharper disable once StructLacksIEquatable.Global" + }, + { + "title": "src/JsonPointer/JsonPointerSegment.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/JsonPointerSegment.cs#L121-L208", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/JsonPointerSegment.cs", + "startLine": 121, + "endLine": 208, + "content": "/// \n /// Compares two segments for equality.\n /// \n public static bool operator ==(JsonPointerSegment left, JsonPointerSegment right) => \n left.Equals(right);\n\n /// \n /// Compares two segments for inequality.\n /// \n public static bool operator !=(JsonPointerSegment left, JsonPointerSegment right) => \n !left.Equals(right);\n\n /// \n /// Compares a segment with a string for equality.\n /// \n public static bool operator ==(JsonPointerSegment left, string right) => \n left.SegmentEquals(right.AsSpan());\n\n /// \n /// Compares a segment with a string for inequality.\n /// \n public static bool operator !=(JsonPointerSegment left, string right) => \n !left.SegmentEquals(right.AsSpan());\n\n /// \n /// Compares a segment with a span for equality.\n /// \n public static bool operator ==(JsonPointerSegment left, ReadOnlySpan right) => \n left.SegmentEquals(right);\n\n /// \n /// Compares a segment with a span for inequality.\n /// \n public static bool operator !=(JsonPointerSegment left, ReadOnlySpan right) => \n !left.SegmentEquals(right);\n\n /// (deprecated) Returns the hash code for this instance.\n /// A 32-bit signed integer that is the hash code for this instance.\n [Obsolete]\n#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member\n public override int GetHashCode() => _segment.GetHashCode();\n#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member\n\n /// \n /// Returns the string representation of this segment.\n /// \n /// The segment as a string.\n public override string ToString() => _segment.ToString();\n\n /// \n /// Returns the int representation of this segment.\n /// \n /// The segment as an int, or null if the segment is not a valid integer.\n public int? ToInt()\n {\n#if NET8_0_OR_GREATER\n\t\tif (int.TryParse(_segment, out var result)) return result;\n \n return null;\n#else\n\t\tif (_segment.Length == 0)\n\t\t\treturn null;\n\n\t\tint result = 0;\n\t\tfor (int i = 0; i < _segment.Length; i++)\n\t\t{\n\t\t\tchar c = _segment[i];\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\treturn null;\n\t\t\t\n\t\t\tif (result > (int.MaxValue - (c - '0')) / 10)\n\t\t\t\treturn null;\n\t\t\t\n\t\t\tresult = result * 10 + (c - '0');\n\t\t}\n\t\t\n\t\treturn result;\n#endif\n\t}\n\n /// \n /// Gets the raw span representation of this segment.\n /// \n /// The segment as a ReadOnlySpan<char>.\n public ReadOnlySpan AsSpan() => \n _segment;\n}", + "snippet": "/// \n /// Compares two segments for equality.\n /// \n public static bool operator ==(JsonPointerSegment left, JsonPointerSegment right) => \n left.Equals(right);\n\n /// \n //" + }, + { + "title": "src/JsonPointer/JsonPointerTypeConverter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/JsonPointerTypeConverter.cs#L1-L61", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/JsonPointerTypeConverter.cs", + "startLine": 1, + "endLine": 61, + "content": "using System;\nusing System.ComponentModel;\nusing System.Globalization;\n\nnamespace Json.Pointer;\n\ninternal sealed class JsonPointerTypeConverter : TypeConverter\n{\n private static StandardValuesCollection? _standardValues;\n\n public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)\n {\n return sourceType == typeof(string) || sourceType == typeof(JsonPointer) || base.CanConvertFrom(context, sourceType);\n }\n\n public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType)\n {\n return destinationType == typeof(string) || destinationType == typeof(JsonPointer) || base.CanConvertTo(context, destinationType);\n }\n\n public override object ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object? value)\n {\n if (value is string s)\n return JsonPointer.Parse(s);\n \n if (value is JsonPointer pointer)\n return pointer;\n\n throw GetConvertFromException(value);\n }\n\n public override object ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)\n {\n if (value is JsonPointer pointer)\n {\n if (destinationType == typeof(string))\n return pointer.ToString();\n \n if (destinationType == typeof(JsonPointer))\n return pointer;\n }\n\n throw GetConvertToException(value, destinationType);\n }\n\n public override bool GetStandardValuesSupported(ITypeDescriptorContext? context) => true;\n\n public override bool GetStandardValuesExclusive(ITypeDescriptorContext? context) => false;\n\n public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext? context)\n {\n return _standardValues ??= new StandardValuesCollection(new[] { JsonPointer.Empty });\n }\n\n public override bool IsValid(ITypeDescriptorContext? context, object? value)\n {\n return value is string s\n ? JsonPointer.TryParse(s, out _)\n : value is JsonPointer;\n }\n}", + "snippet": "using System;\nusing System.ComponentModel;\nusing System.Globalization;\n\nnamespace Json.Pointer;\n\ninternal sealed class JsonPointerTypeConverter : TypeConverter\n{\n private static StandardValuesCollection? _standardValu" + }, + { + "title": "src/JsonPointer/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonPointer/obj/Debug/net10.0/JsonPointer.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Debug/net10.0/JsonPointer.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Debug/net10.0/JsonPointer.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Pointer built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPointer/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonPointer/obj/Debug/net8.0/JsonPointer.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Debug/net8.0/JsonPointer.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Debug/net8.0/JsonPointer.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Pointer built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPointer/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonPointer/obj/Debug/net9.0/JsonPointer.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Debug/net9.0/JsonPointer.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Debug/net9.0/JsonPointer.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Pointer built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPointer/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonPointer/obj/Debug/netstandard2.0/JsonPointer.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Debug/netstandard2.0/JsonPointer.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Debug/netstandard2.0/JsonPointer.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Pointer built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPointer/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs#L1-L4", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs", + "startLine": 1, + "endLine": 4, + "content": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.IsExternalInit))]", + "snippet": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.IsExternalInit))]" + }, + { + "title": "src/JsonPointer/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.RequiresLocationAttribute.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.RequiresLocationAttribute.g.cs#L1-L4", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.RequiresLocationAttribute.g.cs", + "startLine": 1, + "endLine": 4, + "content": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.RequiresLocationAttribute))]", + "snippet": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.RequiresLocationAttribute))]" + }, + { + "title": "src/JsonPointer/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonPointer/obj/Release/net10.0/JsonPointer.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Release/net10.0/JsonPointer.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Release/net10.0/JsonPointer.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Pointer built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPointer/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonPointer/obj/Release/net8.0/JsonPointer.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Release/net8.0/JsonPointer.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Release/net8.0/JsonPointer.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Pointer built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPointer/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonPointer/obj/Release/net9.0/JsonPointer.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Release/net9.0/JsonPointer.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Release/net9.0/JsonPointer.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Pointer built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPointer/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonPointer/obj/Release/netstandard2.0/JsonPointer.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/obj/Release/netstandard2.0/JsonPointer.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/obj/Release/netstandard2.0/JsonPointer.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"JSON Pointer built on the System.Text.Json namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonPointer.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonPointer/PointerParseException.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/PointerParseException.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/PointerParseException.cs", + "startLine": 1, + "endLine": 26, + "content": "using System;\n\nnamespace Json.Pointer;\n\n/// \n/// Thrown during parsing when the source string contains invalid JSON Pointer data.\n/// \npublic class PointerParseException : Exception\n{\n\t/// \n\t/// Creates a .\n\t/// \n\tpublic PointerParseException() { }\n\n\t/// \n\t/// Creates a .\n\t/// \n\tpublic PointerParseException(string message)\n\t\t: base(message) { }\n\n\t/// \n\t/// Creates a .\n\t/// \n\tpublic PointerParseException(string message, Exception inner)\n\t\t: base(message, inner) { }\n}", + "snippet": "using System;\n\nnamespace Json.Pointer;\n\n/// \n/// Thrown during parsing when the source string contains invalid JSON Pointer data.\n/// \npublic class PointerParseException : Exception\n{\n\t/// \n\t/" + }, + { + "title": "src/JsonPointer/PropertyNameResolvers.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/PropertyNameResolvers.cs#L1-L46", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/PropertyNameResolvers.cs", + "startLine": 1, + "endLine": 46, + "content": "using System.Reflection;\nusing Humanizer;\n\nnamespace Json.Pointer;\n\n/// \n/// Declares a property name resolution which is used to provide a property name.\n/// \n/// The property.\n/// The property name\npublic delegate string PropertyNameResolver(MemberInfo input);\n\n/// \n/// Defines a set of predefined property name resolution methods.\n/// \npublic static class PropertyNameResolvers\n{\n\t/// \n\t/// Makes no changes. Properties are generated with the name of the property in code.\n\t/// \n\tpublic static readonly PropertyNameResolver AsDeclared = x => x.Name;\n\t/// \n\t/// Property names to camel case (e.g. `camelCase`).\n\t/// \n\tpublic static readonly PropertyNameResolver CamelCase = x => x.Name.Camelize();\n\t/// \n\t/// Property names to pascal case (e.g. `PascalCase`).\n\t/// \n\tpublic static readonly PropertyNameResolver PascalCase = x => x.Name.Pascalize();\n\t/// \n\t/// Property names to snake case (e.g. `Snake_Case`).\n\t/// \n\tpublic static readonly PropertyNameResolver SnakeCase = x => x.Name.Underscore();\n\t/// \n\t/// Property names to upper snake case (e.g. `UPPER_SNAKE_CASE`).\n\t/// \n\tpublic static readonly PropertyNameResolver UpperSnakeCase = x => x.Name.Underscore().ToUpperInvariant();\n\t/// \n\t/// Property names to kebab case (e.g. `Kebab-Case`).\n\t/// \n\tpublic static readonly PropertyNameResolver KebabCase = x => x.Name.Kebaberize();\n\t/// \n\t/// Property names to upper kebab case (e.g. `UPPER-KEBAB-CASE`).\n\t/// \n\tpublic static readonly PropertyNameResolver UpperKebabCase = x => x.Name.Kebaberize().ToUpperInvariant();\n}", + "snippet": "using System.Reflection;\nusing Humanizer;\n\nnamespace Json.Pointer;\n\n/// \n/// Declares a property name resolution which is used to provide a property name.\n/// \n/// The property.\n/// Represents a Relative JSON Pointer IAW draft-handrews-relative-json-pointer-02\n/// \n[JsonConverter(typeof(RelativeJsonPointerJsonConverter))]\npublic readonly struct RelativeJsonPointer : IEquatable\n{\n\t/// \n\t/// The null pointer. Indicates no navigation should occur.\n\t/// \n\tpublic static readonly RelativeJsonPointer Null = new();\n\n\t/// \n\t/// Gets whether the pointer is an index query, which returns the index within the parent rather than the value.\n\t/// \n\tpublic bool IsIndexQuery { get; }\n\t/// \n\t/// Gets the number of parent (root) steps to take.\n\t/// \n\tpublic uint ParentSteps { get; }\n\t/// \n\t/// Gets the number of lateral steps to take. Applicable only for arrays.\n\t/// \n\tpublic int ArrayIndexManipulator { get; }\n\t/// \n\t/// Gets the pointer to follow after taking steps upward.\n\t/// \n\tpublic JsonPointer Pointer { get; }\n\n\t/// \n\t/// Creates the null pointer.\n\t/// \n\tpublic RelativeJsonPointer()\n\t{\n\t\tIsIndexQuery = false;\n\t\tParentSteps = 0;\n\t\tArrayIndexManipulator = 0;\n\t\tPointer = JsonPointer.Empty;\n\t}\n\n\tprivate RelativeJsonPointer(uint parentSteps)\n\t{\n\t\tIsIndexQuery = true;\n\t\tParentSteps = parentSteps;\n\t\tArrayIndexManipulator = 0;\n\t\tPointer = JsonPointer.Empty;\n\t}\n\n\tprivate RelativeJsonPointer(uint parentSteps, int arrayIndexManipulator)\n\t{\n\t\tIsIndexQuery = true;\n\t\tParentSteps = parentSteps;\n\t\tArrayIndexManipulator = arrayIndexManipulator;\n\t\tPointer = JsonPointer.Empty;\n\t}\n\n\tprivate RelativeJsonPointer(uint parentSteps, JsonPointer pointer)\n\t{\n\t\tIsIndexQuery = false;\n\t\tParentSteps = parentSteps;\n\t\tArrayIndexManipulator = 0;\n\t\tPointer = pointer;\n\t}\n\n\tprivate RelativeJsonPointer(uint parentSteps, int arrayIndexManipulator, JsonPointer pointer)\n\t{\n\t\tIsIndexQuery = false;\n\t\tParentSteps = parentSteps;\n\t\tArrayIndexManipulator = arrayIndexManipulator;\n\t\tPointer = pointer;\n\t}\n\n\t/// \n\t/// Creates an index query pointer.\n\t/// \n\t/// \n\t/// A Relative JSON Pointer.\n\tpublic static RelativeJsonPointer IndexQuery(uint parentSteps) => new(parentSteps);\n\n\t/// \n\t/// Creates an index query pointer.\n\t/// \n\t/// \n\t/// The index manipulator.\n\t/// A Relative JSON Pointer.\n\tpublic static RelativeJsonPointer IndexQuery(uint parentSteps, int arrayIndexManipulator) => new(parentSteps, arrayIndexManipulator);\n\n\t/// \n\t/// Creates a Relative JSON Pointer from a JSON Pointer and a number of parent steps.\n\t/// \n\t/// The number of parent steps.\n\t/// The JSON Pointer.\n\t/// A Relative JSON Pointer.\n\tpublic static RelativeJsonPointer FromPointer(uint parentSteps, JsonPointer pointer) => new(parentSteps, pointer);\n\n\t/// \n\t/// Creates a Relative JSON Pointer from a JSON Pointer and a number of parent steps.\n\t/// \n\t/// The number of parent steps.\n\t/// The index manipulator.\n\t/// The JSON Pointer.\n\t/// A Relative JSON Pointer.\n\tpublic static RelativeJsonPointer FromPointer(uint parentSteps, int arrayIndexManipulator, JsonPointer pointer) => new(parentSteps, arrayIndexManipulator, pointer);\n\n\t/// \n\t/// Parses a JSON Pointer segment from a string.\n\t/// \n\t/// The source string.\n\t/// A Relative JSON Pointer.\n\t/// is null.\n\t/// does not contain a valid relative pointer.\n\tpublic static RelativeJsonPointer Parse(string source)\n\t{\n\t\tif (source == null) throw new ArgumentNullException(nameof(source));", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\n\nnamespace Json.Pointer;\n\n/// \n/// Represents a Relative JSON Pointer IAW draft-handrews-relative-json-pointer" + }, + { + "title": "src/JsonPointer/RelativeJsonPointer.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/RelativeJsonPointer.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/RelativeJsonPointer.cs", + "startLine": 121, + "endLine": 240, + "content": "if (string.IsNullOrWhiteSpace(source)) throw new ArgumentException($\"`{nameof(source)}` contains no data\");\n\n\t\tvar span = source.AsSpan();\n\t\tint i = 0;\n\t\twhile (i < span.Length && char.IsDigit(span[i])) i++;\n\t\tif (i == 0) throw new PointerParseException($\"`{nameof(source)}` must start with a non-negative integer\");\n\n\t\t// Check for leading zero followed by other digits\n\t\tif (i > 1 && span[0] == '0')\n\t\t\tthrow new PointerParseException($\"`{nameof(source)}` cannot have a leading zero in the parent steps\");\n\n\t\tvar parentSteps = span[..i].AsUint();\n\n\t\tif (i == span.Length) return new RelativeJsonPointer(parentSteps, JsonPointer.Empty);\n\n\t\tint indexManipulation = 0;\n\t\tif (span[i] == '+' || span[i] == '-')\n\t\t{\n\t\t\tvar sign = span[i] == '+' ? 1 : -1;\n\t\t\ti++;\n\t\t\tvar start = i;\n\t\t\twhile (i < span.Length && char.IsDigit(span[i])) i++;\n\n\t\t\tindexManipulation = sign * span[start..i].AsInt();\n\n\t\t\tif (i == span.Length) return new RelativeJsonPointer(parentSteps, indexManipulation, JsonPointer.Empty);\n\t\t}\n\t\tif (span[i] == '#')\n\t\t{\n\t\t\tif (i + 1 < span.Length) throw new PointerParseException($\"{nameof(source)} cannot contain data after a `#`\");\n\t\t\treturn new RelativeJsonPointer(parentSteps, indexManipulation);\n\t\t}\n\n\t\tif (span[i] != '/') throw new PointerParseException($\"{nameof(source)} must contain either a `#` or a pointerOld after the initial number\");\n\n\t\tvar pointer = JsonPointer.Parse(span[i..]);\n\n\t\treturn new RelativeJsonPointer(parentSteps, indexManipulation, pointer);\n\t}\n\n\t/// \n\t/// Parses a JSON PointerOld from a string.\n\t/// \n\t/// The source string.\n\t/// The resulting relative pointerOld.\n\t/// `true` if the parse was successful; `false` otherwise.\n\t/// is null.\n\tpublic static bool TryParse(string source, out RelativeJsonPointer relativePointer)\n\t{\n\t\tif (source == null) throw new ArgumentNullException(nameof(source));\n\t\tif (string.IsNullOrWhiteSpace(source))\n\t\t{\n\t\t\trelativePointer = default;\n\t\t\treturn false;\n\t\t}\n\n\t\tvar span = source.AsSpan();\n\t\tint i = 0;\n\t\twhile (i < span.Length && char.IsDigit(span[i])) i++;\n\n\t\tif (i == 0)\n\t\t{\n\t\t\trelativePointer = default;\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check for leading zero followed by other digits\n\t\tif (i > 1 && span[0] == '0')\n\t\t{\n\t\t\trelativePointer = default;\n\t\t\treturn false;\n\t\t}\n\n\t\tvar parentSteps = span[..i].AsUint();\n\n\t\tif (i == span.Length)\n\t\t{\n\t\t\trelativePointer = new RelativeJsonPointer(parentSteps, JsonPointer.Empty);\n\t\t\treturn true;\n\t\t}\n\n\t\tint indexManipulation = 0;\n\t\tif (span[i] == '+' || span[i] == '-')\n\t\t{\n\t\t\tvar sign = span[i] == '+' ? 1 : -1;\n\t\t\ti++;\n\t\t\tvar start = i;\n\t\t\twhile (i < span.Length && char.IsDigit(span[i])) i++;\n\n\t\t\tindexManipulation = sign * span[start..i].AsInt();\n\n\t\t\tif (i == span.Length)\n\t\t\t{\n\t\t\t\trelativePointer = new RelativeJsonPointer(parentSteps, indexManipulation, JsonPointer.Empty);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tif (span[i] == '#')\n\t\t{\n\t\t\tif (i + 1 < span.Length)\n\t\t\t{\n\t\t\t\trelativePointer = default;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\trelativePointer = new RelativeJsonPointer(parentSteps, indexManipulation);\n\t\t\treturn true;\n\t\t}\n\n\t\tif (span[i] != '/')\n\t\t{\n\t\t\trelativePointer = default;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!JsonPointer.TryParse(span[i..], out var pointer))\n\t\t{\n\t\t\trelativePointer = default;\n\t\t\treturn false;\n\t\t}", + "snippet": "if (string.IsNullOrWhiteSpace(source)) throw new ArgumentException($\"`{nameof(source)}` contains no data\");\n\n\t\tvar span = source.AsSpan();\n\t\tint i = 0;\n\t\twhile (i < span.Length && char.IsDigit(span[i])) i++;\n\t\tif (i == 0" + }, + { + "title": "src/JsonPointer/RelativeJsonPointer.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/RelativeJsonPointer.cs#L241-L350", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/RelativeJsonPointer.cs", + "startLine": 241, + "endLine": 350, + "content": "relativePointer = new RelativeJsonPointer(parentSteps, indexManipulation, pointer);\n\t\treturn true;\n\t}\n\n\t/// \n\t/// Evaluates the relative pointerOld over a .\n\t/// \n\t/// The .\n\t/// The result, if return value is true; null otherwise\n\t/// true if a value exists at the indicate path; false otherwise.\n\tpublic bool TryEvaluate(JsonNode node, out JsonNode? result)\n\t{\n\t\tresult = null;\n\n\t\tvar current = node;\n\t\tfor (int i = 0; i < ParentSteps; i++)\n\t\t{\n\t\t\tcurrent = current.Parent;\n\t\t\tif (current == null) return false;\n\t\t}\n\n\t\tif (ArrayIndexManipulator != 0)\n\t\t{\n\t\t\tif (current.Parent is not JsonArray parent) return false;\n\n\t\t\tvar indexOfCurrent = parent.IndexOf(current);\n\t\t\tvar newIndex = indexOfCurrent + ArrayIndexManipulator;\n\n\t\t\tif (newIndex < 0 || newIndex >= parent.Count) return false;\n\t\t\tcurrent = parent[newIndex];\n\t\t}\n\n\t\tif (IsIndexQuery)\n\t\t{\n\t\t\tvar parent = current?.Parent;\n\t\t\tswitch (parent)\n\t\t\t{\n\t\t\t\tcase JsonObject obj:\n\t\t\t\t\tcurrent = obj.Single(x => ReferenceEquals(x.Value, current)).Key;\n\t\t\t\t\tbreak;\n\t\t\t\tcase JsonArray array:\n\t\t\t\t\tcurrent = array.IndexOf(current);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn Pointer.TryEvaluate(current, out result);\n\t}\n\n\t/// Returns the fully qualified type name of this instance.\n\t/// The fully qualified type name.\n\tpublic override string ToString()\n\t{\n\t\treturn $\"{ParentSteps}{Pointer}\";\n\t}\n\n\t/// Indicates whether the current object is equal to another object of the same type.\n\t/// An object to compare with this object.\n\t/// \n\t/// if the current object is equal to the parameter; otherwise, .\n\tpublic bool Equals(RelativeJsonPointer other)\n\t{\n\t\treturn IsIndexQuery == other.IsIndexQuery &&\n\t\t ParentSteps == other.ParentSteps &&\n\t\t ArrayIndexManipulator == other.ArrayIndexManipulator &&\n\t\t Pointer.Equals(other.Pointer);\n\t}\n\n\t/// Indicates whether this instance and a specified object are equal.\n\t/// The object to compare with the current instance.\n\t/// \n\t/// if and this instance are the same type and represent the same value; otherwise, .\n\tpublic override bool Equals(object? obj)\n\t{\n\t\treturn obj is RelativeJsonPointer other && Equals(other);\n\t}\n\n\t/// Returns the hash code for this instance.\n\t/// A 32-bit signed integer that is the hash code for this instance.\n\tpublic override int GetHashCode()\n\t{\n\t\tunchecked\n\t\t{\n\t\t\tvar hashCode = IsIndexQuery.GetHashCode();\n\t\t\thashCode = (hashCode * 397) ^ (int)ParentSteps;\n\t\t\thashCode = (hashCode * 397) ^ ArrayIndexManipulator;\n\t\t\thashCode = (hashCode * 397) ^ Pointer.GetHashCode();\n\t\t\treturn hashCode;\n\t\t}\n\t}\n\n\t/// \n\t/// Determines whether two specified RelativeJsonPointer instances are equal.\n\t/// \n\t/// The first RelativeJsonPointer to compare.\n\t/// The second RelativeJsonPointer to compare.\n\t/// true if the two RelativeJsonPointer instances are equal; otherwise, false.\n\tpublic static bool operator ==(RelativeJsonPointer left, RelativeJsonPointer right) => left.Equals(right);\n\n\t/// \n\t/// Determines whether two RelativeJsonPointer instances are not equal.\n\t/// \n\t/// The first RelativeJsonPointer to compare.\n\t/// The second RelativeJsonPointer to compare.\n\t/// true if the specified RelativeJsonPointer instances are not equal; otherwise, false.\n\tpublic static bool operator !=(RelativeJsonPointer left, RelativeJsonPointer right) => !left.Equals(right);\n}", + "snippet": "relativePointer = new RelativeJsonPointer(parentSteps, indexManipulation, pointer);\n\t\treturn true;\n\t}\n\n\t/// \n\t/// Evaluates the relative pointerOld over a .\n\t/// \n\t/// \n/// Converter for .\n/// \npublic sealed class RelativeJsonPointerJsonConverter : JsonConverter\n{\n\t/// Reads and converts the JSON to type .\n\t/// The reader.\n\t/// The type to convert.\n\t/// An object that specifies serialization options to use.\n\t/// The converted value.\n\tpublic override RelativeJsonPointer Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tif (reader.TokenType != JsonTokenType.String)\n\t\t\tthrow new JsonException(\"Expected string\");\n\n\t\tvar str = reader.GetString()!;\n\t\treturn RelativeJsonPointer.TryParse(str, out var pointer)\n\t\t\t? pointer\n\t\t\t: throw new JsonException(\"Value does not represent a Relative JSON Pointer\");\n\t}\n\n\t/// Writes a specified value as JSON.\n\t/// The writer to write to.\n\t/// The value to convert to JSON.\n\t/// An object that specifies serialization options to use.\n\tpublic override void Write(Utf8JsonWriter writer, RelativeJsonPointer value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStringValue(value.ToString());\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\n\nnamespace Json.Pointer;\n\n/// \n/// Converter for .\n/// \npublic sealed class RelativeJsonPoin" + }, + { + "title": "src/JsonPointer/SegmentValueStandIn.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/SegmentValueStandIn.cs#L1-L80", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/SegmentValueStandIn.cs", + "startLine": 1, + "endLine": 80, + "content": "using System;\nusing System.Globalization;\n\nnamespace Json.Pointer;\n\n/// \n/// Serves as an intermediary for creating JSON Pointers by segments.\n/// \n[Obsolete(\"Not intended to be used directly.\")]\npublic readonly struct SegmentValueStandIn\n{\n\tinternal string Value { get; }\n\n\tprivate SegmentValueStandIn(string value)\n\t{\n\t\tValue = Encode(value);\n\t}\n\n\tprivate static string Encode(string value)\n\t{\n\t\tif (string.IsNullOrEmpty(value)) return string.Empty;\n\n\t\t// Calculate the required length\n\t\tint length = 0;\n\t\tforeach (char c in value)\n\t\t{\n\t\t\tlength += c switch\n\t\t\t{\n\t\t\t\t'~' => 2, // ~0\n\t\t\t\t'/' => 2, // ~1\n\t\t\t\t_ => 1\n\t\t\t};\n\t\t}\n\n\t\t// If no encoding needed, return original\n\t\tif (length == value.Length) return value;\n\n\t\t// Create encoded string\n\t\tSpan encoded = stackalloc char[length];\n\t\tint pos = 0;\n\t\tforeach (char c in value)\n\t\t{\n\t\t\tswitch (c)\n\t\t\t{\n\t\t\t\tcase '~':\n\t\t\t\t\tencoded[pos++] = '~';\n\t\t\t\t\tencoded[pos++] = '0';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '/':\n\t\t\t\t\tencoded[pos++] = '~';\n\t\t\t\t\tencoded[pos++] = '1';\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tencoded[pos++] = c;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn encoded.ToString();\n\t}\n\n\t/// \n\t/// Implicitly casts an to a .\n\t/// \n\t/// A pointer segment that represents the value.\n\tpublic static implicit operator SegmentValueStandIn(int value) =>\n\t\tnew(value.ToString(CultureInfo.InvariantCulture));\n\n\t/// \n\t/// Implicitly casts a to a .\n\t/// \n\t/// A pointer segment that represents the value.\n\t/// JSON Pointer encoding is performed automatically.\n\tpublic static implicit operator SegmentValueStandIn(string value) =>\n\t\tnew(value);\n\n\t/// Returns the fully qualified type name of this instance.\n\t/// The fully qualified type name.\n\tpublic override string ToString() => Value;\n}", + "snippet": "using System;\nusing System.Globalization;\n\nnamespace Json.Pointer;\n\n/// \n/// Serves as an intermediary for creating JSON Pointers by segments.\n/// \n[Obsolete(\"Not intended to be used directly.\")]\npubli" + }, + { + "title": "src/JsonPointer/SpanExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/SpanExtensions.cs#L1-L110", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/SpanExtensions.cs", + "startLine": 1, + "endLine": 110, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Pointer;\n\ninternal static class SpanExtensions\n{\n\tinternal static bool TryParse(this ReadOnlySpan s, out int result)\n\t{\n\t\tresult = 0;\n\t\tif (s.IsEmpty) return false;\n\n\t\t// Forbid leading zeros unless it's just \"0\"\n\t\tif (s[0] == '0' && s.Length > 1) return false;\n\n\t\t// Parse digits\n\t\tlong value = 0;\n\t\tfor (int i = 0; i < s.Length; i++)\n\t\t{\n\t\t\tchar c = s[i];\n\t\t\tif (c < '0' || c > '9') return false;\n\t\t\t\n\t\t\tvalue = value * 10 + (c - '0');\n\t\t\t\n\t\t\t// Check for overflow\n\t\t\tif (value > int.MaxValue) return false;\n\t\t}\n\n\t\tresult = (int)value;\n\t\treturn true;\n\t}\n\n\tinternal static bool TryDecodeSegment(this ReadOnlySpan encoded, [NotNullWhen(true)] out string? result)\n\t{\n\t\tvar l = encoded.Length;\n\t\tif (l == 0)\n\t\t{\n\t\t\tresult = string.Empty;\n\t\t\treturn true;\n\t\t}\n\n\t\tvar targetIndex = 0;\n\t\tvar sourceIndex = 0;\n\t\tresult = null;\n\n\t\tSpan target = l < 1024\n\t\t\t? stackalloc char[l]\n\t\t\t: new char[l];\n\n\t\tfor (; sourceIndex < l; targetIndex++, sourceIndex++)\n\t\t{\n\t\t\ttarget[targetIndex] = encoded[sourceIndex];\n\n\t\t\tif (target[targetIndex] == '/')\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (target[targetIndex] == '~')\n\t\t\t{\n\t\t\t\tif (sourceIndex == l - 1)\n\t\t\t\t\treturn false;\n\n\t\t\t\tif (encoded[++sourceIndex] == '0')\n\t\t\t\t\tcontinue; // we already wrote '~' so we're good\n\n\t\t\t\tif (encoded[sourceIndex] == '1')\n\t\t\t\t\ttarget[targetIndex] = '/';\n\t\t\t\telse\n\t\t\t\t\treturn false; // invalid escape sequence\n\t\t\t}\n\t\t}\n\n#if NET8_0_OR_GREATER\n\t\tresult = new string(target[..targetIndex]);\n#else\n\t\tresult = target[..targetIndex].ToString();\n#endif\n\n\t\treturn true;\n\t}\n\n\tinternal static int Encode(this ReadOnlySpan key, Span encoded)\n\t{\n\t\tvar length = 0;\n\t\tforeach (var ch in key)\n\t\t{\n\t\t\tswitch (ch)\n\t\t\t{\n\t\t\t\tcase '~':\n\t\t\t\t\tencoded[length] = '~';\n\t\t\t\t\tencoded[length + 1] = '0';\n\t\t\t\t\tlength += 2;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '/':\n\t\t\t\t\tencoded[length] = '~';\n\t\t\t\t\tencoded[length + 1] = '1';\n\t\t\t\t\tlength += 2;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tencoded[length] = ch;\n\t\t\t\t\tlength++;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn length;\n\t}\n}", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Pointer;\n\ninternal static class SpanExtensions\n{\n\tinternal static bool TryParse(this ReadOnlySpan s, out int result)\n\t{\n\t\tresult = 0;\n\t\tif (s.IsE" + }, + { + "title": "src/JsonPointer/UtilityExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonPointer/UtilityExtensions.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonPointer/UtilityExtensions.cs", + "startLine": 1, + "endLine": 25, + "content": "using System;\nusing System.Globalization;\n\nnamespace Json.Pointer;\n\ninternal static class UtilityExtensions\n{\n\tpublic static int AsInt(this ReadOnlySpan value)\n\t{\n#if NET8_0_OR_GREATER\n\t\treturn int.Parse(value, NumberStyles.Integer, CultureInfo.InvariantCulture);\n#else\n\t\treturn int.Parse(value.ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture);\n#endif\n\t}\n\n\tpublic static uint AsUint(this ReadOnlySpan value)\n\t{\n#if NET8_0_OR_GREATER\n\t\treturn uint.Parse(value, NumberStyles.Integer, CultureInfo.InvariantCulture);\n#else\n\t\treturn uint.Parse(value.ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture);\n#endif\n\t}\n}", + "snippet": "using System;\nusing System.Globalization;\n\nnamespace Json.Pointer;\n\ninternal static class UtilityExtensions\n{\n\tpublic static int AsInt(this ReadOnlySpan value)\n\t{\n#if NET8_0_OR_GREATER\n\t\treturn int.Parse(value, Num" + }, + { + "title": "src/JsonSchema.Api.Tests/ApiTestFixture.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/ApiTestFixture.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/ApiTestFixture.cs", + "startLine": 1, + "endLine": 27, + "content": "using System;\nusing System.Net.Http;\nusing Microsoft.AspNetCore.Mvc.Testing;\n\nnamespace Json.Schema.Api.Tests;\n\npublic class ApiTestFixture : IDisposable\n{\n\tprivate readonly WebApplicationFactory _factory;\n\t\n\tpublic HttpClient Client { get; }\n\n\tpublic ApiTestFixture()\n\t{\n\t\t_factory = new WebApplicationFactory();\n\t\tClient = _factory.CreateClient();\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tClient.Dispose();\n\t\t_factory.Dispose();\n\n\t\tGC.SuppressFinalize(this);\n\t}\n}", + "snippet": "using System;\nusing System.Net.Http;\nusing Microsoft.AspNetCore.Mvc.Testing;\n\nnamespace Json.Schema.Api.Tests;\n\npublic class ApiTestFixture : IDisposable\n{\n\tprivate readonly WebApplicationFactory _factory;\n\t\n\tpu" + }, + { + "title": "src/JsonSchema.Api.Tests/ConfigurationTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/ConfigurationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/ConfigurationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Net;\nusing System.Net.Http;\nusing System.Net.Http.Json;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing System.Threading.Tasks;\nusing Json.Schema.Generation;\nusing Microsoft.AspNetCore.Mvc.Testing;\nusing Microsoft.Extensions.DependencyInjection;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Api.Tests;\n\npublic class ConfigurationTests\n{\n\t[Test]\n\tpublic async Task DefaultConfiguration_UsesCamelCase()\n\t{\n\t\tawait using var factory = new WebApplicationFactory();\n\t\tusing var client = factory.CreateClient();\n\n\t\tvar json = \"\"\"{\"name\": \"Test\", \"age\": 30}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await client.PostAsync(\"/api/test/simple\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));\n\t}\n\n\t[Test]\n\tpublic async Task CustomConfiguration_SnakeCase_AcceptsSnakeCaseKeys()\n\t{\n\t\tawait using var factory = new WebApplicationFactory()\n\t\t\t.WithWebHostBuilder(builder =>\n\t\t\t{\n\t\t\t\tbuilder.ConfigureServices(services =>\n\t\t\t\t{\n\t\t\t\t\tservices.AddControllers();\n\t\t\t\t\tservices.AddJsonSchemaValidation(converter =>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tconverter.GeneratorConfiguration.PropertyNameResolver = PropertyNameResolvers.SnakeCase;\n\t\t\t\t\t\t\tconverter.EvaluationOptions.OutputFormat = OutputFormat.List;\n\t\t\t\t\t\t\tconverter.EvaluationOptions.RequireFormatValidation = false;\n\t\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\tusing var client = factory.CreateClient();\n\n\t\tvar json = \"\"\"{\"name\": \"Test\", \"age\": 30}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await client.PostAsync(\"/api/test/simple\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));\n\t}\n\n\t[Test]\n\tpublic async Task CustomConfiguration_SnakeCase_RejectsCamelCaseKeys()\n\t{\n\t\tawait using var factory = new WebApplicationFactory()\n\t\t\t.WithWebHostBuilder(builder =>\n\t\t\t{\n\t\t\t\tbuilder.ConfigureServices(services =>\n\t\t\t\t{\n\t\t\t\t\tservices.AddControllers();\n\t\t\t\t\tservices.AddJsonSchemaValidation(converter => { converter.GeneratorConfiguration.PropertyNameResolver = PropertyNameResolvers.SnakeCase; });\n\t\t\t\t});\n\t\t\t});\n\t\tusing var client = factory.CreateClient();\n\n\t\tvar json = \"\"\"{\"firstName\": \"John\", \"lastName\": \"Doe\"}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await client.PostAsync(\"/api/test/multiword\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));\n\t}\n\n\t[Test]\n\tpublic async Task CustomEvaluationOptions_Applied()\n\t{\n\t\tawait using var factory = new WebApplicationFactory()\n\t\t\t.WithWebHostBuilder(builder =>\n\t\t\t{\n\t\t\t\tbuilder.ConfigureServices(services =>\n\t\t\t\t{\n\t\t\t\t\tservices.AddControllers();\n\t\t\t\t\tservices.AddJsonSchemaValidation(converter =>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tconverter.EvaluationOptions.OutputFormat = OutputFormat.Flag;\n\t\t\t\t\t\t\tconverter.EvaluationOptions.RequireFormatValidation = false;\n\t\t\t\t\t\t\tconverter.GeneratorConfiguration.PropertyNameResolver = PropertyNameResolvers.CamelCase;\n\t\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\tusing var client = factory.CreateClient();\n\n\t\tvar json = \"\"\"{\"age\": 30}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await client.PostAsync(\"/api/test/simple\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));\n\n\t\tvar problemDetails = await response.Content.ReadFromJsonAsync();\n\t\tAssert.That(problemDetails![\"type\"]!.GetValue(), Is.EqualTo(\"https://json-everything.net/errors/validation\"));\n\t}\n\n\t[Test]\n\tpublic async Task CustomGeneratorConfiguration_WithBuildOptions()\n\t{\n\t\tawait using var factory = new WebApplicationFactory()\n\t\t\t.WithWebHostBuilder(builder =>\n\t\t\t{\n\t\t\t\tbuilder.ConfigureServices(services =>\n\t\t\t\t{\n\t\t\t\t\tservices.AddControllers();\n\t\t\t\t\tservices.AddJsonSchemaValidation(converter =>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tconverter.GeneratorConfiguration.PropertyNameResolver = PropertyNameResolvers.CamelCase;", + "snippet": "using System.Net;\nusing System.Net.Http;\nusing System.Net.Http.Json;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing System.Threading.Tasks;\nusing Json.Schema.Generation;\nusing Microsoft.AspNetCore.Mvc.Testing;\nus" + }, + { + "title": "src/JsonSchema.Api.Tests/ConfigurationTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/ConfigurationTests.cs#L121-L152", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/ConfigurationTests.cs", + "startLine": 121, + "endLine": 152, + "content": "converter.GeneratorConfiguration.PropertyOrder = PropertyOrder.ByName;\n\t\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\tusing var client = factory.CreateClient();\n\n\t\tvar json = \"\"\"{\"name\": \"Test\", \"age\": 30}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await client.PostAsync(\"/api/test/simple\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));\n\t}\n\n\t[Test]\n\tpublic async Task DefaultConfiguration_HierarchicalOutputFormat()\n\t{\n\t\tawait using var factory = new WebApplicationFactory();\n\t\tusing var client = factory.CreateClient();\n\n\t\tvar json = \"\"\"{\"age\": 30}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await client.PostAsync(\"/api/test/simple\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));\n\n\t\tvar problemDetails = await response.Content.ReadFromJsonAsync();\n\t\tvar errors = problemDetails![\"errors\"] as JsonObject;\n\t}\n}", + "snippet": "converter.GeneratorConfiguration.PropertyOrder = PropertyOrder.ByName;\n\t\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\tusing var client = factory.CreateClient();\n\n\t\tvar json = \"\"\"{\"name\": \"Test\", \"age\": 30}\"\"\";\n\t\tvar content = new StringCont" + }, + { + "title": "src/JsonSchema.Api.Tests/MinimalApiResponseTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/MinimalApiResponseTests.cs#L1-L90", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/MinimalApiResponseTests.cs", + "startLine": 1, + "endLine": 90, + "content": "using System.Net;\nusing System.Net.Http;\nusing System.Net.Http.Json;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing System.Threading.Tasks;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Api.Tests;\n\npublic class MinimalApiResponseTests\n{\n\tprivate ApiTestFixture _fixture = null!;\n\tprivate HttpClient _client = null!;\n\n\t[SetUp]\n\tpublic void SetUp()\n\t{\n\t\t_fixture = new ApiTestFixture();\n\t\t_client = _fixture.Client;\n\t}\n\n\t[TearDown]\n\tpublic void TearDown()\n\t{\n\t\t_fixture.Dispose();\n\t}\n\n\t[Test]\n\tpublic async Task ValidRequest_Returns200WithBody()\n\t{\n\t\tvar json = \"\"\"{\"name\": \"John Doe\", \"age\": 30}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await _client.PostAsync(\"/minimal/test/simple\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));\n\n\t\tvar responseBody = await response.Content.ReadFromJsonAsync();\n\t\tAssert.That(responseBody, Is.Not.Null);\n\t\tAssert.That(responseBody![\"name\"]!.GetValue(), Is.EqualTo(\"John Doe\"));\n\t\tAssert.That(responseBody[\"age\"]!.GetValue(), Is.EqualTo(30));\n\t}\n\n\t[Test]\n\tpublic async Task MissingRequiredField_Returns400WithProblemDetails()\n\t{\n\t\tvar json = \"\"\"{\"age\": 25}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await _client.PostAsync(\"/minimal/test/simple\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));\n\t\tAssert.That(response.Content.Headers.ContentType?.MediaType, Is.EqualTo(\"application/problem+json\"));\n\n\t\tvar problemDetails = await response.Content.ReadFromJsonAsync();\n\t\tAssert.That(problemDetails, Is.Not.Null);\n\t\tAssert.That(problemDetails![\"type\"]!.GetValue(), Is.EqualTo(\"https://json-everything.net/errors/validation\"));\n\t\tAssert.That(problemDetails[\"title\"]!.GetValue(), Is.EqualTo(\"Validation Error\"));\n\t\tAssert.That(problemDetails[\"status\"]!.GetValue(), Is.EqualTo(400));\n\n\t\tvar errors = problemDetails[\"errors\"] as JsonObject;\n\t\tAssert.That(errors, Is.Not.Null);\n\t\tAssert.That(errors!.Count, Is.GreaterThan(0));\n\t}\n\n\t[Test]\n\tpublic async Task AdditionalProperties_Returns400WithProblemDetails()\n\t{\n\t\tvar json = \"\"\"{\"title\": \"Test\", \"active\": true, \"extraField\": \"not allowed\"}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await _client.PostAsync(\"/minimal/test/strict\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));\n\t\tAssert.That(response.Content.Headers.ContentType?.MediaType, Is.EqualTo(\"application/problem+json\"));\n\n\t\tvar problemDetails = await response.Content.ReadFromJsonAsync();\n\t\tAssert.That(problemDetails, Is.Not.Null);\n\n\t\tAssert.That(problemDetails![\"type\"]!.GetValue(), Is.EqualTo(\"https://json-everything.net/errors/validation\"));\n\t\tAssert.That(problemDetails[\"title\"]!.GetValue(), Is.EqualTo(\"Validation Error\"));\n\t\tAssert.That(problemDetails[\"status\"]!.GetValue(), Is.EqualTo(400));\n\n\t\tvar errors = problemDetails[\"errors\"] as JsonObject;\n\t\tAssert.That(errors, Is.Not.Null);\n\t\tAssert.That(errors!.Count, Is.GreaterThan(0));\n\t}\n}", + "snippet": "using System.Net;\nusing System.Net.Http;\nusing System.Net.Http.Json;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing System.Threading.Tasks;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Api.Tests;\n\npublic class M" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Debug/net10.0/JsonSchema.Api.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Debug/net10.0/JsonSchema.Api.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Debug/net10.0/JsonSchema.Api.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Debug/net10.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Debug/net10.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Debug/net10.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs", + "startLine": 1, + "endLine": 18, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute(\"JsonSchema.Net.Api\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Debug/net8.0/JsonSchema.Api.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Debug/net8.0/JsonSchema.Api.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Debug/net8.0/JsonSchema.Api.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Debug/net8.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Debug/net8.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Debug/net8.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs", + "startLine": 1, + "endLine": 18, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute(\"JsonSchema.Net.Api\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Debug/net9.0/JsonSchema.Api.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Debug/net9.0/JsonSchema.Api.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Debug/net9.0/JsonSchema.Api.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Debug/net9.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Debug/net9.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Debug/net9.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs", + "startLine": 1, + "endLine": 18, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute(\"JsonSchema.Net.Api\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/GeneratedFiles/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Api_Tests_TestHost.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/GeneratedFiles/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Api_Tests_TestHost.g.cs#L1-L96", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/GeneratedFiles/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Api_Tests_TestHost.g.cs", + "startLine": 1, + "endLine": 96, + "content": "// \n#nullable enable\n\nusing System.Diagnostics.CodeAnalysis;\nusing System.Runtime.CompilerServices;\nusing System.Text.Json.Serialization;\nusing Json.Schema;\nusing Json.Schema.Serialization;\n\nnamespace Json.Schema.Api.Tests.TestHost;\n\n/// \n/// Contains generated JSON schemas for types decorated with [GenerateJsonSchema].\n/// \npublic static partial class GeneratedJsonSchemas\n{\n\t/// \n\t/// Generated schema for .\n\t/// \n\tpublic static readonly JsonSchema SimpleModel =\n\t\tnew JsonSchemaBuilder()\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t),\n\t\t\t(\"age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer))\n\t\t)\n\t\t.Required(\"name\")\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for .\n\t/// \n\tpublic static readonly JsonSchema StrictModel =\n\t\tnew JsonSchemaBuilder()\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"title\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t),\n\t\t\t(\"active\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Boolean))\n\t\t)\n\t\t.Required(\"title\")\n\t\t\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for .\n\t/// \n\tpublic static readonly JsonSchema MultiWordModel =\n\t\tnew JsonSchemaBuilder()\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"firstName\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t),\n\t\t\t(\"lastName\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t)\n\t\t)\n\t\t.Required(\"firstName\", \"lastName\")\n\t\t\n\t\t.Build();\n\n}\n\n/// \n/// Registers generated schemas with the ValidatingJsonConverter for AOT scenarios.\n/// \n[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"Suppressing for generated code.\")]\ninternal static class GeneratedSchemaRegistration\n{\n\t[ModuleInitializer]\n\tinternal static void RegisterSchemas()\n\t{\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Api.Tests.TestHost.SimpleModel),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.SimpleModel,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Api.Tests.TestHost.StrictModel),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.StrictModel,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Api.Tests.TestHost.MultiWordModel),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.MultiWordModel,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t}\n}", + "snippet": "// \n#nullable enable\n\nusing System.Diagnostics.CodeAnalysis;\nusing System.Runtime.CompilerServices;\nusing System.Text.Json.Serialization;\nusing Json.Schema;\nusing Json.Schema.Serialization;\n\nnamespace Js" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Release/net10.0/JsonSchema.Api.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Release/net10.0/JsonSchema.Api.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Release/net10.0/JsonSchema.Api.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Release/net10.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Release/net10.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Release/net10.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs", + "startLine": 1, + "endLine": 18, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute(\"JsonSchema.Net.Api\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Release/net8.0/JsonSchema.Api.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Release/net8.0/JsonSchema.Api.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Release/net8.0/JsonSchema.Api.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Release/net8.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Release/net8.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Release/net8.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs", + "startLine": 1, + "endLine": 18, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute(\"JsonSchema.Net.Api\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Release/net9.0/JsonSchema.Api.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Release/net9.0/JsonSchema.Api.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Release/net9.0/JsonSchema.Api.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Api.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api.Tests/obj/Release/net9.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/obj/Release/net9.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/obj/Release/net9.0/JsonSchema.Api.Tests.MvcApplicationPartsAssemblyInfo.cs", + "startLine": 1, + "endLine": 18, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute(\"JsonSchema.Net.Api\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api.Tests/ResponseTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/ResponseTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/ResponseTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing System.Net.Http.Json;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing System.Threading.Tasks;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Api.Tests;\n\npublic class ResponseTests\n{\n\tprivate ApiTestFixture _fixture = null!;\n\tprivate HttpClient _client = null!;\n\n\t[SetUp]\n\tpublic void SetUp()\n\t{\n\t\t_fixture = new ApiTestFixture();\n\t\t_client = _fixture.Client;\n\t}\n\n\t[TearDown]\n\tpublic void TearDown()\n\t{\n\t\t_fixture.Dispose();\n\t}\n\n\t[Test]\n\tpublic async Task ValidRequest_Returns200WithBody()\n\t{\n\t\tvar json = \"\"\"{\"name\": \"John Doe\", \"age\": 30}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await _client.PostAsync(\"/api/test/simple\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));\n\n\t\tvar responseBody = await response.Content.ReadFromJsonAsync();\n\t\tAssert.That(responseBody, Is.Not.Null);\n\t\tAssert.That(responseBody![\"name\"]!.GetValue(), Is.EqualTo(\"John Doe\"));\n\t\tAssert.That(responseBody[\"age\"]!.GetValue(), Is.EqualTo(30));\n\t}\n\n\t[Test]\n\tpublic async Task MissingRequiredField_Returns400WithProblemDetails()\n\t{\n\t\tvar json = \"\"\"{\"age\": 25}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await _client.PostAsync(\"/api/test/simple\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));\n\t\tAssert.That(response.Content.Headers.ContentType?.MediaType, Is.EqualTo(\"application/problem+json\"));\n\n\t\tvar problemDetails = await response.Content.ReadFromJsonAsync();\n\t\tAssert.That(problemDetails, Is.Not.Null);\n\n\t\tAssert.That(problemDetails![\"type\"]!.GetValue(), Is.EqualTo(\"https://json-everything.net/errors/validation\"));\n\t\tAssert.That(problemDetails[\"title\"]!.GetValue(), Is.EqualTo(\"Validation Error\"));\n\t\tAssert.That(problemDetails[\"status\"]!.GetValue(), Is.EqualTo(400));\n\t\tAssert.That(problemDetails[\"detail\"], Is.Not.Null);\n\n\t\tvar errors = problemDetails[\"errors\"] as JsonObject;\n\t\tAssert.That(errors, Is.Not.Null);\n\t\tAssert.That(errors!.Count, Is.GreaterThan(0));\n\n\t\tforeach (var kvp in errors)\n\t\t{\n\t\t\tAssert.That(kvp.Key.StartsWith('/') || kvp.Key == \"\", Is.True, $\"Expected JSON Pointer key, got: {kvp.Key}\");\n\t\t}\n\t}\n\n\t[Test]\n\tpublic async Task AdditionalProperties_Returns400WithProblemDetails()\n\t{\n\t\tvar json = \"\"\"{\"title\": \"Test\", \"active\": true, \"extraField\": \"not allowed\"}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await _client.PostAsync(\"/api/test/strict\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));\n\t\tAssert.That(response.Content.Headers.ContentType?.MediaType, Is.EqualTo(\"application/problem+json\"));\n\n\t\tvar problemDetails = await response.Content.ReadFromJsonAsync();\n\t\tAssert.That(problemDetails, Is.Not.Null);\n\n\t\tAssert.That(problemDetails![\"type\"]!.GetValue(), Is.EqualTo(\"https://json-everything.net/errors/validation\"));\n\t\tAssert.That(problemDetails[\"title\"]!.GetValue(), Is.EqualTo(\"Validation Error\"));\n\t\tAssert.That(problemDetails[\"status\"]!.GetValue(), Is.EqualTo(400));\n\n\t\tvar errors = problemDetails[\"errors\"] as JsonObject;\n\t\tAssert.That(errors, Is.Not.Null);\n\t\tAssert.That(errors!.Count, Is.GreaterThan(0));\n\t}\n\n\t[Test]\n\tpublic async Task MultipleValidationErrors_Returns400WithAllErrors()\n\t{\n\t\tvar json = \"\"\"{\"active\": true, \"extraField\": \"not allowed\"}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await _client.PostAsync(\"/api/test/strict\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));\n\n\t\tvar problemDetails = await response.Content.ReadFromJsonAsync();\n\t\tvar errors = problemDetails![\"errors\"] as JsonObject;\n\n\t\tAssert.That(errors!.Count, Is.GreaterThan(0));\n\n\t\tforeach (var kvp in errors)\n\t\t{\n\t\t\tAssert.That(kvp.Key.StartsWith('/') || kvp.Key == \"\", Is.True, $\"Expected JSON Pointer key, got: {kvp.Key}\");\n\t\t}\n\t}\n\n\t[Test]\n\tpublic async Task UnvalidatedModel_Returns200EvenWithInvalidData()", + "snippet": "using System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing System.Net.Http.Json;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing System.Threading.Tasks;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Api.Tes" + }, + { + "title": "src/JsonSchema.Api.Tests/ResponseTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/ResponseTests.cs#L121-L155", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/ResponseTests.cs", + "startLine": 121, + "endLine": 155, + "content": "{\n\t\tvar json = \"\"\"{\"description\": \"any value\"}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await _client.PostAsync(\"/api/test/unvalidated\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));\n\t}\n\n\t[Test]\n\tpublic async Task EmptyBody_Returns400()\n\t{\n\t\tvar content = new StringContent(\"\", Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await _client.PostAsync(\"/api/test/simple\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));\n\t}\n\n\t[Test]\n\tpublic async Task ValidStrictModel_Returns200()\n\t{\n\t\tvar json = \"\"\"{\"title\": \"Valid Title\", \"active\": false}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await _client.PostAsync(\"/api/test/strict\", content);\n\n\t\tAssert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));\n\n\t\tvar responseBody = await response.Content.ReadFromJsonAsync();\n\t\tAssert.That(responseBody![\"title\"]!.GetValue(), Is.EqualTo(\"Valid Title\"));\n\t\tAssert.That(responseBody[\"active\"]!.GetValue(), Is.False);\n\t}\n}", + "snippet": "{\n\t\tvar json = \"\"\"{\"description\": \"any value\"}\"\"\";\n\t\tvar content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n\t\tvar response = await _client.PostAsync(\"/api/test/unvalidated\", content);\n\n\t\tAssert.That(r" + }, + { + "title": "src/JsonSchema.Api.Tests/TestHost/TestController.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/TestHost/TestController.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/TestHost/TestController.cs", + "startLine": 1, + "endLine": 33, + "content": "using Microsoft.AspNetCore.Mvc;\n\nnamespace Json.Schema.Api.Tests.TestHost;\n\n[ApiController]\n[Route(\"api/test\")]\npublic class TestController : ControllerBase\n{\n\t[HttpPost(\"simple\")]\n\tpublic IActionResult PostSimple([FromBody] SimpleModel model)\n\t{\n\t\treturn Ok(model);\n\t}\n\n\t[HttpPost(\"strict\")]\n\tpublic IActionResult PostStrict([FromBody] StrictModel model)\n\t{\n\t\treturn Ok(model);\n\t}\n\n\t[HttpPost(\"multiword\")]\n\tpublic IActionResult PostMultiWord([FromBody] MultiWordModel model)\n\t{\n\t\treturn Ok(model);\n\t}\n\n\t[HttpPost(\"unvalidated\")]\n\tpublic IActionResult PostUnvalidated([FromBody] UnvalidatedModel model)\n\t{\n\t\treturn Ok(model);\n\t}\n}", + "snippet": "using Microsoft.AspNetCore.Mvc;\n\nnamespace Json.Schema.Api.Tests.TestHost;\n\n[ApiController]\n[Route(\"api/test\")]\npublic class TestController : ControllerBase\n{\n\t[HttpPost(\"simple\")]\n\tpublic IActionResult PostSimple([FromB" + }, + { + "title": "src/JsonSchema.Api.Tests/TestHost/TestModels.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/TestHost/TestModels.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/TestHost/TestModels.cs", + "startLine": 1, + "endLine": 29, + "content": "using Json.Schema.Generation;\nusing Json.Schema.Generation.Serialization;\n\nnamespace Json.Schema.Api.Tests.TestHost;\n\n[GenerateJsonSchema]\npublic record SimpleModel(\n\t[property: Required]\n\tstring Name,\n\tint Age);\n\n[GenerateJsonSchema]\n[AdditionalProperties(false)]\npublic record StrictModel(\n\t[property: Required]\n\tstring Title,\n\tbool Active);\n\n[GenerateJsonSchema]\n[AdditionalProperties(false)]\npublic record MultiWordModel(\n\t[property: Required]\n\tstring FirstName,\n\t[property: Required]\n\tstring LastName);\n\npublic record UnvalidatedModel(\n\tstring Description);", + "snippet": "using Json.Schema.Generation;\nusing Json.Schema.Generation.Serialization;\n\nnamespace Json.Schema.Api.Tests.TestHost;\n\n[GenerateJsonSchema]\npublic record SimpleModel(\n\t[property: Required]\n\tstring Name,\n\tint Age);\n\n[Gener" + }, + { + "title": "src/JsonSchema.Api.Tests/TestHost/TestProgram.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api.Tests/TestHost/TestProgram.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api.Tests/TestHost/TestProgram.cs", + "startLine": 1, + "endLine": 29, + "content": "using System;\nusing Json.Schema.Api;\nusing Json.Schema.Api.Tests.TestHost;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Http;\nusing Microsoft.Extensions.DependencyInjection;\n\nvar builder = WebApplication.CreateBuilder(new WebApplicationOptions\n{\n\tArgs = args,\n\tContentRootPath = AppContext.BaseDirectory\n});\n\nbuilder.Services.AddControllers();\n\nbuilder.Services.AddJsonSchemaValidation();\n\nvar app = builder.Build();\n\napp.MapControllers();\n\nvar minimal = app.MapGroup(\"/minimal/test\");\nminimal.MapPost(\"/simple\", (SimpleModel model) => Results.Ok(model));\nminimal.MapPost(\"/strict\", (StrictModel model) => Results.Ok(model));\nminimal.MapPost(\"/multiword\", (MultiWordModel model) => Results.Ok(model));\nminimal.MapPost(\"/unvalidated\", (UnvalidatedModel model) => Results.Ok(model));\n\napp.Run();", + "snippet": "using System;\nusing Json.Schema.Api;\nusing Json.Schema.Api.Tests.TestHost;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Http;\nusing Microsoft.Extensions.DependencyInjection;\n\nvar builder = WebApplicatio" + }, + { + "title": "src/JsonSchema.Api/Extensions.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/Extensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/Extensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Schema.Generation;\nusing Json.Schema.Generation.Serialization;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.AspNetCore.Routing;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.DependencyInjection.Extensions;\n\nnamespace Json.Schema.Api;\n\n/// \n/// Provides extension methods for configuring JSON Schema validation in ASP.NET Core applications.\n/// \n/// The extension methods in this class enable integration of JSON Schema-based validation into MVC and\n/// minimal API request handling. These methods are intended to be used during application startup to add model\n/// validation based on JSON Schema definitions. All methods are static and designed for use with dependency injection\n/// and ASP.NET Core configuration patterns.\npublic static class Extensions\n{\n\t/// \n\t/// Enables JSON Schema-based validation for minimal APIs by configuring HTTP JSON serializer options.\n\t/// \n\t/// The service collection to configure. Cannot be null.\n\t/// An optional delegate to configure the generative JSON schema validation converter. If null, default settings are\n\t/// used.\n\t/// The same instance so that additional configuration calls can be chained.\n\t/// \n\t/// By default, source generation is used to create schemas at compile time from types decorated with [GenerateJsonSchema].\n\t/// When using source generation, settings like property naming, property order, and strict conditionals must be configured on the\n\t/// [GenerateJsonSchema] attribute itself. The settings\n\t/// only affect runtime schema generation, which occurs when source generation is disabled or when using [JsonSchema] attributes.\n\t/// To disable source generation, add <DisableJsonSchemaSourceGeneration>true</DisableJsonSchemaSourceGeneration>\n\t/// to your project file.\n\t/// \n\t[RequiresUnreferencedCode(\"Calls System.Text.Json.JsonSerializer.Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)\")]\n\t[RequiresDynamicCode(\"Calls System.Text.Json.JsonSerializer.Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)\")]\n\tpublic static IServiceCollection AddJsonSchemaValidation(this IServiceCollection services, Action? configure = null)\n\t{\n\t\tservices.Configure(options =>\n\t\t{\n\t\t\tif (!options.Filters.Any(x => x is JsonSchemaValidationFilter))\n\t\t\t\toptions.Filters.Add();\n\t\t\tif (!options.ModelBinderProviders.Any(x => x is ValidatingJsonModelBinderProvider))\n\t\t\t\toptions.ModelBinderProviders.Insert(0, new ValidatingJsonModelBinderProvider());\n\t\t});\n\n\t\tservices.Configure(options =>\n\t\t{\n\t\t\t// Required so minimal API binding failures can be translated into ProblemDetails by middleware.\n\t\t\toptions.ThrowOnBadRequest = true;\n\t\t});\n\n\t\tservices.Configure(opt =>\n\t\t{\n\t\t\topt.JsonSerializerOptions.AddJsonSchemaValidation(configure);\n\t\t});\n\n\t\tservices.Configure(options =>\n\t\t{\n\t\t\toptions.SerializerOptions.AddJsonSchemaValidation(configure);\n\t\t});\n\n\t\tservices.TryAddEnumerable(ServiceDescriptor.Singleton());\n\n\t\treturn services;\n\t}\n\n\t/// \n\t/// Enables JSON Schema-based validation for MVC controllers by adding the necessary filters and model binders to the\n\t/// application's MVC pipeline.\n\t/// \n\t/// This method registers a filter that validates incoming JSON request bodies against their associated\n\t/// JSON Schemas and configures the JSON serializer to support schema-based validation. Use this method to enforce\n\t/// schema compliance for models in your MVC application.\n\t/// The MVC builder to configure. Cannot be null.\n\t/// An optional delegate to configure the generative JSON schema validation converter. If null, default settings are\n\t/// used.\n\t/// The same instance so that additional configuration calls can be chained.\n\t/// \n\t/// By default, source generation is used to create schemas at compile time from types decorated with [GenerateJsonSchema].\n\t/// When using source generation, settings like property naming, property order, and strict conditionals must be configured on the\n\t/// [GenerateJsonSchema] attribute itself. The settings\n\t/// only affect runtime schema generation, which occurs when source generation is disabled or when using [JsonSchema] attributes.\n\t/// To disable source generation, add <DisableJsonSchemaSourceGeneration>true</DisableJsonSchemaSourceGeneration>\n\t/// to your project file.\n\t/// \n\t[Obsolete(\"Use the IServiceCollection extension instead.\")]\n\t[RequiresUnreferencedCode(\"Calls System.Text.Json.JsonSerializer.Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)\")]\n\t[RequiresDynamicCode(\"Calls System.Text.Json.JsonSerializer.Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)\")]\n\tpublic static IMvcBuilder AddJsonSchemaValidation(this IMvcBuilder builder, Action? configure = null)\n\t{\n\t\tbuilder.Services.AddJsonSchemaValidation(configure);\n\n\t\treturn builder;\n\t}\n\n\t[RequiresUnreferencedCode(\"Calls System.Text.Json.JsonSerializer.Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)\")]\n\t[RequiresDynamicCode(\"Calls System.Text.Json.JsonSerializer.Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)\")]\n\tprivate static JsonSerializerOptions AddJsonSchemaValidation(this JsonSerializerOptions options, Action? configure = null)\n\t{\n\t\tvar converter = options.Converters.FirstOrDefault(x => x is GenerativeValidatingJsonConverter) as GenerativeValidatingJsonConverter ??\n\t\t new GenerativeValidatingJsonConverter();\n\n\t\tif (configure is null)\n\t\t{\n\t\t\tconverter.GeneratorConfiguration.PropertyNameResolver = PropertyNameResolvers.CamelCase;\n\t\t\tconverter.EvaluationOptions.OutputFormat = OutputFormat.Hierarchical;\n\t\t\tconverter.EvaluationOptions.RequireFormatValidation = true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tconfigure(converter);\n\t\t}\n\n\t\tif (!options.Converters.Contains(converter))\n\t\t\toptions.Converters.Add(converter);", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Schema.Generation;\nusing Json.Schema.Generation.Serialization;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsof" + }, + { + "title": "src/JsonSchema.Api/Extensions.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/Extensions.cs#L121-L124", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/Extensions.cs", + "startLine": 121, + "endLine": 124, + "content": "return options;\n\t}\n}", + "snippet": "return options;\n\t}\n}" + }, + { + "title": "src/JsonSchema.Api/JsonSchemaValidationFilter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/JsonSchemaValidationFilter.cs#L1-L98", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/JsonSchemaValidationFilter.cs", + "startLine": 1, + "endLine": 98, + "content": "using System.Linq;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.AspNetCore.Mvc.Filters;\n\nnamespace Json.Schema.Api;\n\n/// \n/// An ASP.NET Core filter that validates incoming JSON request bodies against a JSON Schema and returns detailed\n/// validation errors in the response if validation fails.\n/// \n/// This filter inspects the model state for JSON Schema validation errors during both action and result\n/// execution. If validation errors are present and correspond to JSON Pointer paths, the filter short-circuits the\n/// request pipeline and returns a 400 Bad Request response with a standardized problem details payload. The filter is\n/// intended to be used in scenarios where JSON Schema validation is required for API endpoints that accept JSON input. \n/// The filter implements both IActionFilter and IAlwaysRunResultFilter to ensure that validation errors are handled\n/// regardless of whether model binding partially or totally fails. It does not modify the response if no relevant\n/// validation errors are found.\npublic class JsonSchemaValidationFilter : IActionFilter, IAlwaysRunResultFilter\n{\n\t/// \n\t/// Called before the action executes, after model binding is complete.\n\t/// \n\t/// The .\n\tpublic void OnActionExecuting(ActionExecutingContext context)\n {\n // this method is required for partial binding success\n var check = HandleJsonSchemaErrors(context);\n if (check is not null) \n\t context.Result = check;\n }\n\n\t/// \n\t/// Called after the action executes, before the action result.\n\t/// \n\t/// The .\n\tpublic void OnActionExecuted(ActionExecutedContext context)\n {\n // no-op\n }\n\n\t/// Called before the action result executes.\n\t/// The .\n\tpublic void OnResultExecuting(ResultExecutingContext context)\n {\n // this method is required for total binding failure\n var check = HandleJsonSchemaErrors(context);\n if (check is not null) \n\t context.Result = check;\n }\n\n private static BadRequestObjectResult? HandleJsonSchemaErrors(ActionContext context)\n {\n if (context.ModelState.IsValid)\n {\n return null;\n }\n\n var errors = context.ModelState\n .Where(x => x.Value?.Errors.Any() == true)\n .SelectMany(x => x.Value!.Errors.Select(e => new\n {\n Path = x.Key,\n Message = e.ErrorMessage,\n }))\n .Where(e => string.IsNullOrEmpty(e.Path) || e.Path.StartsWith('/')) // empty JSON Pointer is empty string\n .GroupBy(x => x.Path)\n .ToDictionary(x => x.Key, x => x.Select(e => e.Message).ToList());\n\n if (errors.Count == 0)\n {\n // If we don't have JSON Pointer errors, JSON Schema didn't handle this.\n // Don't change anything.\n return null;\n }\n\n var problemDetails = new ProblemDetails\n {\n Type = \"https://json-everything.net/errors/validation\",\n Title = \"Validation Error\",\n Status = 400,\n Detail = \"One or more validation errors occurred.\",\n Extensions =\n {\n [\"errors\"] = errors\n }\n };\n\n return new BadRequestObjectResult(problemDetails);\n\n }\n\n /// Called after the action result executes.\n /// The .\n public void OnResultExecuted(ResultExecutedContext context)\n {\n // no-op\n }\n}", + "snippet": "using System.Linq;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.AspNetCore.Mvc.Filters;\n\nnamespace Json.Schema.Api;\n\n/// \n/// An ASP.NET Core filter that validates incoming JSON request bodies against a JSON " + }, + { + "title": "src/JsonSchema.Api/JsonSchemaValidationMiddleware.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/JsonSchemaValidationMiddleware.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/JsonSchemaValidationMiddleware.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.AspNetCore.Http;\nusing Microsoft.AspNetCore.Http.Metadata;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Options;\n\nnamespace Json.Schema.Api;\n\ninternal class JsonSchemaValidationMiddleware\n{\n\tprivate static readonly JsonSerializerOptions _problemDetailsSerializerOptions = new(JsonSerializerDefaults.Web)\n\t{\n\t\tPropertyNamingPolicy = JsonNamingPolicy.CamelCase\n\t};\n\n\tprivate readonly RequestDelegate _next;\n\n\tpublic JsonSchemaValidationMiddleware(RequestDelegate next)\n\t{\n\t\t_next = next;\n\t}\n\n\tpublic async Task InvokeAsync(HttpContext context)\n\t{\n\t\tvar requestBody = await ReadRequestBodyAsync(context);\n\t\tvar originalResponseBody = context.Response.Body;\n\t\tawait using var bufferedResponseBody = new MemoryStream();\n\t\tcontext.Response.Body = bufferedResponseBody;\n\n\t\tEvaluationResults? validationResults = null;\n\n\t\ttry\n\t\t{\n\t\t\tawait _next(context);\n\t\t}\n\t\tcatch (BadHttpRequestException exception) when (TryGetValidationResults(exception, out var parsedValidationResults))\n\t\t{\n\t\t\tif (context.Response.HasStarted)\n\t\t\t\tthrow;\n\n\t\t\tvalidationResults = parsedValidationResults;\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tcontext.Response.Body = originalResponseBody;\n\t\t}\n\n\t\tif (validationResults is null &&\n\t\t TryGetValidationResultsFromRequest(context, requestBody) is { } inferredValidationResults)\n\t\t{\n\t\t\tvalidationResults = inferredValidationResults;\n\t\t}\n\n\t\tif (validationResults is not null)\n\t\t{\n\t\t\tcontext.Response.Clear();\n\t\t\tawait WriteValidationProblemDetailsAsync(context, validationResults);\n\t\t\treturn;\n\t\t}\n\n\t\tbufferedResponseBody.Position = 0;\n\t\tawait bufferedResponseBody.CopyToAsync(originalResponseBody);\n\t}\n\n\tprivate static async Task ReadRequestBodyAsync(HttpContext context)\n\t{\n\t\tif (!context.Request.HasJsonContentType()) return null;\n\n\t\tcontext.Request.EnableBuffering();\n\t\tusing var reader = new StreamReader(context.Request.Body, leaveOpen: true);\n\t\tvar body = await reader.ReadToEndAsync();\n\t\tcontext.Request.Body.Position = 0;\n\t\treturn body;\n\t}\n\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tprivate static EvaluationResults? TryGetValidationResultsFromRequest(HttpContext context, string? requestBody)\n\t{\n\t\tif (context.Response.StatusCode != StatusCodes.Status400BadRequest) return null;\n\t\tif (!string.Equals(context.Response.ContentType, \"text/plain; charset=utf-8\", StringComparison.OrdinalIgnoreCase) &&\n\t\t !string.Equals(context.Response.ContentType, \"text/plain\", StringComparison.OrdinalIgnoreCase)) return null;\n\t\tif (string.IsNullOrWhiteSpace(requestBody)) return null;\n\n\t\tvar requestType = context.GetEndpoint()?.Metadata.GetMetadata()?.RequestType;\n\t\tif (requestType is null) return null;\n\n\t\tvar options = context.RequestServices\n\t\t\t.GetRequiredService>()\n\t\t\t.Value\n\t\t\t.SerializerOptions;\n\n\t\ttry\n\t\t{\n\t\t\t_ = JsonSerializer.Deserialize(requestBody, requestType, options);\n\t\t\treturn null;\n\t\t}\n\t\tcatch (JsonException exception) when (TryGetValidationResults(exception, out var validationResults))\n\t\t{\n\t\t\treturn validationResults;\n\t\t}\n\t}\n\n\tprivate static bool TryGetValidationResults(Exception exception, out EvaluationResults validationResults)\n\t{\n\t\tvalidationResults = null!;\n\t\tfor (var current = exception; current is not null; current = current.InnerException)\n\t\t{\n\t\t\tif (current is not JsonException jsonException) continue;\n\t\t\tif (!jsonException.Data.Contains(\"validation\")) continue;\n\t\t\tif (jsonException.Data[\"validation\"] is not EvaluationResults { IsValid: false } parsedResults) continue;", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore.Builder;\nusing M" + }, + { + "title": "src/JsonSchema.Api/JsonSchemaValidationMiddleware.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/JsonSchemaValidationMiddleware.cs#L121-L196", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/JsonSchemaValidationMiddleware.cs", + "startLine": 121, + "endLine": 196, + "content": "validationResults = parsedResults;\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tprivate static async Task WriteValidationProblemDetailsAsync(HttpContext context, EvaluationResults validationResults)\n\t{\n\t\tvar errors = ExtractValidationErrors(validationResults)\n\t\t\t.Where(x => string.IsNullOrEmpty(x.Path) || x.Path.StartsWith('/'))\n\t\t\t.GroupBy(x => x.Path)\n\t\t\t.ToDictionary(x => x.Key, x => x.Select(v => v.Message).ToList());\n\n\t\tif (errors.Count == 0)\n\t\t\terrors[string.Empty] = new List { \"A validation error occurred\" };\n\n\t\tvar problemDetails = new ProblemDetails\n\t\t{\n\t\t\tType = \"https://json-everything.net/errors/validation\",\n\t\t\tTitle = \"Validation Error\",\n\t\t\tStatus = StatusCodes.Status400BadRequest,\n\t\t\tDetail = \"One or more validation errors occurred.\",\n\t\t\tExtensions =\n\t\t\t{\n\t\t\t\t[\"errors\"] = errors\n\t\t\t}\n\t\t};\n\n\t\tcontext.Response.StatusCode = StatusCodes.Status400BadRequest;\n\t\tcontext.Response.ContentType = \"application/problem+json\";\n\t\tawait context.Response.WriteAsync(JsonSerializer.Serialize(problemDetails, _problemDetailsSerializerOptions));\n\t}\n\n\tprivate static List<(string Path, string Message)> ExtractValidationErrors(EvaluationResults validationResults)\n\t{\n\t\tvar errors = new List<(string Path, string Message)>();\n\t\tExtractValidationErrorsRecursive(validationResults, errors);\n\t\treturn errors;\n\t}\n\n\tprivate static void ExtractValidationErrorsRecursive(EvaluationResults results, List<(string Path, string Message)> errors)\n\t{\n\t\tif (results.IsValid) return;\n\n\t\tif (results.Errors != null)\n\t\t{\n\t\t\tforeach (var error in results.Errors)\n\t\t\t{\n\t\t\t\terrors.Add((results.InstanceLocation.ToString(), error.Value));\n\t\t\t}\n\t\t}\n\n\t\tif (results.Details == null) return;\n\t\tforeach (var detail in results.Details)\n\t\t{\n\t\t\tExtractValidationErrorsRecursive(detail, errors);\n\t\t}\n\t}\n}\n\ninternal class JsonSchemaValidationStartupFilter : IStartupFilter\n{\n\tpublic Action Configure(Action next)\n\t{\n\t\treturn app =>\n\t\t{\n\t\t\tapp.UseMiddleware();\n\t\t\tnext(app);\n\t\t};\n\t}\n}", + "snippet": "validationResults = parsedResults;\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise c" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/net10.0/JsonSchema.Api.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/net10.0/JsonSchema.Api.AssemblyInfo.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/net10.0/JsonSchema.Api.AssemblyInfo.cs", + "startLine": 1, + "endLine": 29, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide API-centric functionality like automatic reques\" +\n \"t validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.1.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/net10.0/JsonSchema.Api.GlobalUsings.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/net10.0/JsonSchema.Api.GlobalUsings.g.cs#L1-L9", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/net10.0/JsonSchema.Api.GlobalUsings.g.cs", + "startLine": 1, + "endLine": 9, + "content": "// \nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Net.Http;\nglobal using System.Threading;\nglobal using System.Threading.Tasks;", + "snippet": "// \nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Net.Http;\nglobal using System.Threading;\nglobal using System.Thread" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETFramework,Version=v4.8.1\", FrameworkDisplayName = \"\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETFramework,Version=v4.8.1\", FrameworkDisplayName = \"\")]" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/net481/JsonSchema.Api.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/net481/JsonSchema.Api.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/net481/JsonSchema.Api.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide API-centric functionality like automatic reques\" +\n \"t validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+d5d4193f184b48d66258f0fa6824bdc7b3fd0292\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/net481/JsonSchema.Api.GlobalUsings.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/net481/JsonSchema.Api.GlobalUsings.g.cs#L1-L8", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/net481/JsonSchema.Api.GlobalUsings.g.cs", + "startLine": 1, + "endLine": 8, + "content": "// \nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Threading;\nglobal using System.Threading.Tasks;", + "snippet": "// \nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Threading;\nglobal using System.Threading.Tasks;" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/net8.0/JsonSchema.Api.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/net8.0/JsonSchema.Api.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/net8.0/JsonSchema.Api.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide API-centric functionality like automatic reques\" +\n \"t validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.1.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/net8.0/JsonSchema.Api.GlobalUsings.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/net8.0/JsonSchema.Api.GlobalUsings.g.cs#L1-L9", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/net8.0/JsonSchema.Api.GlobalUsings.g.cs", + "startLine": 1, + "endLine": 9, + "content": "// \nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Net.Http;\nglobal using System.Threading;\nglobal using System.Threading.Tasks;", + "snippet": "// \nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Net.Http;\nglobal using System.Threading;\nglobal using System.Thread" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/net9.0/JsonSchema.Api.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/net9.0/JsonSchema.Api.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/net9.0/JsonSchema.Api.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide API-centric functionality like automatic reques\" +\n \"t validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.1.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/net9.0/JsonSchema.Api.GlobalUsings.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/net9.0/JsonSchema.Api.GlobalUsings.g.cs#L1-L9", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/net9.0/JsonSchema.Api.GlobalUsings.g.cs", + "startLine": 1, + "endLine": 9, + "content": "// \nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Net.Http;\nglobal using System.Threading;\nglobal using System.Threading.Tasks;", + "snippet": "// \nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Net.Http;\nglobal using System.Threading;\nglobal using System.Thread" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.Api/obj/Debug/netstandard2.0/JsonSchema.Api.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Debug/netstandard2.0/JsonSchema.Api.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Debug/netstandard2.0/JsonSchema.Api.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide API-centric functionality like automatic reques\" +\n \"t validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+d5d4193f184b48d66258f0fa6824bdc7b3fd0292\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Api/obj/Release/net10.0/JsonSchema.Api.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Release/net10.0/JsonSchema.Api.AssemblyInfo.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Release/net10.0/JsonSchema.Api.AssemblyInfo.cs", + "startLine": 1, + "endLine": 29, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide API-centric functionality like automatic reques\" +\n \"t validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.1.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Api/obj/Release/net8.0/JsonSchema.Api.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Release/net8.0/JsonSchema.Api.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Release/net8.0/JsonSchema.Api.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide API-centric functionality like automatic reques\" +\n \"t validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.1.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Api/obj/Release/net9.0/JsonSchema.Api.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/obj/Release/net9.0/JsonSchema.Api.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/obj/Release/net9.0/JsonSchema.Api.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide API-centric functionality like automatic reques\" +\n \"t validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.1.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Api\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Api/ValidatingJsonModelBinder.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/ValidatingJsonModelBinder.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/ValidatingJsonModelBinder.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.IO;\nusing System.Text.Json;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore.Http;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.AspNetCore.Mvc.ModelBinding;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Logging;\nusing Microsoft.Extensions.Options;\n#pragma warning disable IL2026\n#pragma warning disable IL3050\n\nnamespace Json.Schema.Api;\n\n/// \n/// Provides a model binder that deserializes JSON request data and performs validation, adding any validation errors to\n/// the model state.\n/// \n/// The ValidatingJsonModelBinder is designed for use in ASP.NET Core applications to bind and validate\n/// models from JSON request bodies or value providers. When binding from the request body, it uses the configured\n/// JsonSerializerOptions and supports validation that can add detailed errors to the model state. If validation fails,\n/// the model binding result is set to failed, and errors are available in ModelState for use by validation filters or\n/// error handlers. This binder is typically used to enable custom or advanced validation scenarios during model\n/// binding.\npublic class ValidatingJsonModelBinder : IModelBinder\n{\n\t/// Attempts to bind a model.\n\t/// The .\n\t/// \n\t/// \n\t/// A which will complete when the model binding process completes.\n\t/// \n\t/// \n\t/// If model binding was successful, the should have\n\t/// set to true.\n\t/// \n\t/// \n\t/// A model binder that completes successfully should set to\n\t/// a value returned from .\n\t/// \n\t/// \n\tpublic async Task BindModelAsync(ModelBindingContext bindingContext)\n {\n\t\tArgumentNullException.ThrowIfNull(bindingContext);\n\n // For body binding, we need to read the request body\n if (bindingContext.BindingSource == BindingSource.Body)\n {\n bindingContext.HttpContext.Request.EnableBuffering();\n using var reader = new StreamReader(bindingContext.HttpContext.Request.Body, leaveOpen: true);\n var body = await reader.ReadToEndAsync();\n bindingContext.HttpContext.Request.Body.Position = 0;\n\n if (string.IsNullOrEmpty(body)) return;\n\n var logger = bindingContext.HttpContext.RequestServices.GetService>();\n\n try\n {\n var options = bindingContext.HttpContext.RequestServices.GetRequiredService>().Value.JsonSerializerOptions;\n var model = JsonSerializer.Deserialize(body, bindingContext.ModelType, options);\n bindingContext.Result = ModelBindingResult.Success(model);\n }\n catch (JsonException jsonException)\n {\n if (jsonException.Data.Contains(\"validation\") && \n jsonException.Data[\"validation\"] is EvaluationResults { IsValid: false } validationResults)\n {\n\t var resultsLog = JsonSerializer.Serialize(validationResults);\n\t logger?.LogDebug(resultsLog);\n\n\t var errors = ExtractValidationErrors(validationResults);\n if (errors.Count != 0)\n {\n foreach (var error in errors)\n {\n bindingContext.ModelState.AddModelError(error.Path, error.Message);\n }\n }\n else\n {\n // Not all keywords produce an error.\n // Still, in order for the model binder to actually fail, it needs an error message.\n bindingContext.ModelState.AddModelError(\"\", \"A validation error occurred\");\n }\n\n bindingContext.Result = ModelBindingResult.Failed();\n return;\n }\n\n bindingContext.ModelState.AddModelError(bindingContext.FieldName, jsonException, bindingContext.ModelMetadata);\n bindingContext.Result = ModelBindingResult.Failed();\n }\n return;\n }\n\n // For other binding sources, use the value provider\n var valueProviderResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);\n if (valueProviderResult == ValueProviderResult.None) return;\n\n bindingContext.ModelState.SetModelValue(bindingContext.ModelName, valueProviderResult);\n\n try\n {\n var value = valueProviderResult.FirstValue;\n if (string.IsNullOrEmpty(value)) return;\n\n var options = bindingContext.HttpContext.RequestServices.GetRequiredService>().Value.JsonSerializerOptions;\n var model = JsonSerializer.Deserialize(value, bindingContext.ModelType, options);\n bindingContext.Result = ModelBindingResult.Success(model);\n }\n catch (JsonException jsonException)\n {\n bindingContext.ModelState.AddModelError(bindingContext.ModelName, jsonException, bindingContext.ModelMetadata);\n bindingContext.Result = ModelBindingResult.Failed();\n }\n }", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.IO;\nusing System.Text.Json;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore.Http;\nusing Microsoft.AspNetCore.Mv" + }, + { + "title": "src/JsonSchema.Api/ValidatingJsonModelBinder.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/ValidatingJsonModelBinder.cs#L121-L149", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/ValidatingJsonModelBinder.cs", + "startLine": 121, + "endLine": 149, + "content": "private static List<(string Path, string Message)> ExtractValidationErrors(EvaluationResults validationResults)\n {\n var errors = new List<(string Path, string Message)>();\n ExtractValidationErrorsRecursive(validationResults, errors);\n return errors;\n }\n\n private static void ExtractValidationErrorsRecursive(EvaluationResults results, List<(string Path, string Message)> errors)\n {\n if (results.IsValid) return;\n\n if (results.Errors != null)\n {\n foreach (var error in results.Errors)\n {\n errors.Add((results.InstanceLocation.ToString(), error.Value));\n }\n }\n\n if (results.Details != null)\n {\n foreach (var detail in results.Details)\n {\n ExtractValidationErrorsRecursive(detail, errors);\n }\n }\n }\n}", + "snippet": "private static List<(string Path, string Message)> ExtractValidationErrors(EvaluationResults validationResults)\n {\n var errors = new List<(string Path, string Message)>();\n ExtractValidationErrorsRecursi" + }, + { + "title": "src/JsonSchema.Api/ValidatingJsonModelBinderProvider.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Api/ValidatingJsonModelBinderProvider.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Api/ValidatingJsonModelBinderProvider.cs", + "startLine": 1, + "endLine": 38, + "content": "using System;\nusing System.Linq;\nusing Json.Schema.Generation.Serialization;\nusing Json.Schema.Serialization;\nusing Microsoft.AspNetCore.Mvc.ModelBinding;\n\nnamespace Json.Schema.Api;\n\n/// \n/// Provides an ASP.NET Core model binder provider that supplies a model binder for types annotated with JSON schema\n/// attributes, enabling automatic validation of JSON request bodies against the model's schema.\n/// \n/// This provider only applies to model types decorated with the or attributes and when the binding source is\n/// either unspecified or explicitly set to the request body. It is typically used to ensure that incoming JSON payloads\n/// conform to the expected schema before model binding completes. To use this provider, register it in the\n/// application's model binder provider collection.\npublic class ValidatingJsonModelBinderProvider : IModelBinderProvider\n{\n\t/// \n\t/// Creates a based on .\n\t/// \n\t/// The .\n\t/// An .\n\tpublic IModelBinder? GetBinder(ModelBinderProviderContext context)\n\t{\n\t\tif (context == null) throw new ArgumentNullException(nameof(context));\n\n\t\t// Only use this binder for types that have the GenerateJsonSchema attribute\n\t\t// and only if the binding source is undefined or explicitly the body\n\t\tif ((context.Metadata.BindingSource == null || context.Metadata.BindingSource == BindingSource.Body) &&\n\t\t (context.Metadata.ModelType.GetCustomAttributes(typeof(GenerateJsonSchemaAttribute), true).Any() ||\n\t\t context.Metadata.ModelType.GetCustomAttributes(typeof(JsonSchemaAttribute), true).Any()))\n\t\t\treturn new ValidatingJsonModelBinder();\n\n\t\treturn null;\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing Json.Schema.Generation.Serialization;\nusing Json.Schema.Serialization;\nusing Microsoft.AspNetCore.Mvc.ModelBinding;\n\nnamespace Json.Schema.Api;\n\n/// \n/// Provides an ASP.NE" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/obj/Debug/net10.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/obj/Debug/net10.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/obj/Debug/net10.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/obj/Debug/net8.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/obj/Debug/net8.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/obj/Debug/net8.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/obj/Debug/net9.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/obj/Debug/net9.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/obj/Debug/net9.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/obj/Release/net10.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/obj/Release/net10.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/obj/Release/net10.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/obj/Release/net8.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/obj/Release/net8.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/obj/Release/net8.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/obj/Release/net9.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/obj/Release/net9.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/obj/Release/net9.0/JsonSchema.ArrayExt.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.ArrayExt.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/OrderingSpecExampleTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/OrderingSpecExampleTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/OrderingSpecExampleTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Text.Json;\nusing Json.Pointer;\nusing Json.Schema.ArrayExt.Keywords;\nusing Json.Schema.Tests;\nusing NUnit.Framework;\n\nnamespace Json.Schema.ArrayExt.Tests;\n\npublic class OrderingSpecExampleTests\n{\n\tprivate static readonly JsonSchema _singleSpecifier =\n\t\tnew JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Id(\"https://json-everything.test/single\")\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"foo\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t\t(\"bar\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Parse(\"/foo\")));\n\n\tprivate static readonly JsonSchema _multipleSpecifiers =\n\t\tnew JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Id(\"https://json-everything.test/multiple\")\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"foo\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t\t(\"bar\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Ordering(\n\t\t\t\tnew OrderingSpecifier(JsonPointer.Parse(\"/foo\")),\n\t\t\t\tnew OrderingSpecifier(JsonPointer.Parse(\"/bar\"), Direction.Descending)\n\t\t\t);\n\n\t[Test]\n\tpublic void SingleSpecifierPassingInstance()\n\t{\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t { \"foo\": 1, \"bar\": \"ipsum\" },\n\t\t\t { \"foo\": 1, \"bar\": \"Lorem\" },\n\t\t\t { \"foo\": 2, \"bar\": \"dolor\" },\n\t\t\t { \"foo\": 3, \"bar\": \"sit\" },\n\t\t\t { \"foo\": 5, \"bar\": \"amet\" }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar result = _singleSpecifier.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void SingleSpecifierFailingInstance()\n\t{\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t { \"foo\": 1, \"bar\": \"Lorem\" },\n\t\t\t { \"foo\": 5, \"bar\": \"amet\" },\n\t\t\t { \"foo\": 2, \"bar\": \"dolor\" },\n\t\t\t { \"foo\": 1, \"bar\": \"ipsum\" },\n\t\t\t { \"foo\": 3, \"bar\": \"sit\" }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar result = _singleSpecifier.Evaluate(instance);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void MultipleSpecifierPassingInstance()\n\t{\n\t\t// string is descending\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t { \"foo\": 1, \"bar\": \"ipsum\" },\n\t\t\t { \"foo\": 1, \"bar\": \"Lorem\" },\n\t\t\t { \"foo\": 2, \"bar\": \"dolor\" },\n\t\t\t { \"foo\": 3, \"bar\": \"sit\" },\n\t\t\t { \"foo\": 5, \"bar\": \"amet\" }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar result = _multipleSpecifiers.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void MultipleSpecifierFailingInstance_Secondary()\n\t{\n\t\t// string is descending\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t { \"foo\": 1, \"bar\": \"Lorem\" },\n\t\t\t { \"foo\": 1, \"bar\": \"ipsum\" },\n\t\t\t { \"foo\": 2, \"bar\": \"dolor\" },\n\t\t\t { \"foo\": 3, \"bar\": \"sit\" },\n\t\t\t { \"foo\": 5, \"bar\": \"amet\" }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar result = _multipleSpecifiers.Evaluate(instance);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t[Test]", + "snippet": "using System.Text.Json;\nusing Json.Pointer;\nusing Json.Schema.ArrayExt.Keywords;\nusing Json.Schema.Tests;\nusing NUnit.Framework;\n\nnamespace Json.Schema.ArrayExt.Tests;\n\npublic class OrderingSpecExampleTests\n{\n\tprivate st" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/OrderingSpecExampleTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/OrderingSpecExampleTests.cs#L121-L138", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/OrderingSpecExampleTests.cs", + "startLine": 121, + "endLine": 138, + "content": "public void MultipleSpecifierPassingInstance_WrongPriority()\n\t{\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t { \"foo\": 1, \"bar\": \"Lorem\" },\n\t\t\t { \"foo\": 5, \"bar\": \"amet\" },\n\t\t\t { \"foo\": 2, \"bar\": \"dolor\" },\n\t\t\t { \"foo\": 1, \"bar\": \"ipsum\" },\n\t\t\t { \"foo\": 3, \"bar\": \"sit\" }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar result = _multipleSpecifiers.Evaluate(instance);\n\n\t\tresult.AssertInvalid();\n\t}\n}", + "snippet": "public void MultipleSpecifierPassingInstance_WrongPriority()\n\t{\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t { \"foo\": 1, \"bar\": \"Lorem\" },\n\t\t\t { \"foo\": 5, \"bar\": \"amet\" },\n\t\t\t { \"foo\": 2, \"bar\": \"dolor\" },\n\t\t\t" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/OrderingTests.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/OrderingTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/OrderingTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Text.Json;\nusing Json.Pointer;\nusing Json.Schema.ArrayExt.Keywords;\nusing Json.Schema.Tests;\nusing NUnit.Framework;\n\nnamespace Json.Schema.ArrayExt.Tests;\n\npublic class OrderingTests\n{\n\t[Test]\n\tpublic void NumberDirectionAscending_Passing()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Ascending));\n\n\t\tvar instance = JsonDocument.Parse(\"[2, 3, 4, 5]\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void NumberDirectionAscending_Duplicate_Passing()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Ascending));\n\n\t\tvar instance = JsonDocument.Parse(\"[2, 3, 3, 5]\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void NumberDirectionAscending_Failing()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Ascending));\n\n\t\tvar instance = JsonDocument.Parse(\"[2, 3, 1, 5]\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void NumberDirectionDescending_Passing()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Descending));\n\n\t\tvar instance = JsonDocument.Parse(\"[5, 4, 3, 2]\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void NumberDirectionDescending_Duplicate_Passing()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Descending));\n\n\t\tvar instance = JsonDocument.Parse(\"[5, 4, 4, 2]\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void NumberDirectionDescending_Failing()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Descending));\n\n\t\tvar instance = JsonDocument.Parse(\"[5, 4, 6, 2]\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void StringDirectionAscending_Passing()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))", + "snippet": "using System.Text.Json;\nusing Json.Pointer;\nusing Json.Schema.ArrayExt.Keywords;\nusing Json.Schema.Tests;\nusing NUnit.Framework;\n\nnamespace Json.Schema.ArrayExt.Tests;\n\npublic class OrderingTests\n{\n\t[Test]\n\tpublic void N" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/OrderingTests.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/OrderingTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/OrderingTests.cs", + "startLine": 121, + "endLine": 240, + "content": ".Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Ascending));\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"[\"alpha\", \"beta\", \"charlie\", \"delta\"]\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void StringDirectionAscending_Duplicate_Passing()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Ascending));\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"[\"alpha\", \"beta\", \"beta\", \"delta\"]\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void StringDirectionAscending_Failing()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Ascending));\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"[\"alpha\", \"charlie\", \"beta\", \"delta\"]\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void StringDirectionDescending_Passing()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Descending));\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"[\"delta\", \"charlie\", \"beta\", \"alpha\"]\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void StringDirectionDescending_Duplicate_Passing()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Descending));\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"[\"delta\", \"charlie\", \"charlie\", \"alpha\"]\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void StringDirectionDescending_Failing()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Descending));\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"[\"delta\", \"beta\", \"charlie\", \"alpha\"]\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void IgnoreCaseFalse_Passing()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, ignoreCase: false));\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"[\"alpha\", \"beta\", \"charlie\", \"delta\"]\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void IgnoreCaseFalse_Failing()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, ignoreCase: false));\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"[\"alpha\", \"Beta\", \"charlie\", \"delta\"]\"\"\").RootElement;", + "snippet": ".Ordering(new OrderingSpecifier(JsonPointer.Empty, Direction.Ascending));\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"[\"alpha\", \"beta\", \"charlie\", \"delta\"]\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresul" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/OrderingTests.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/OrderingTests.cs#L241-L262", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/OrderingTests.cs", + "startLine": 241, + "endLine": 262, + "content": "var result = schema.Evaluate(instance);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void IgnoreCaseTrue()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t.Ordering(new OrderingSpecifier(JsonPointer.Empty, ignoreCase: true));\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"[\"alpha\", \"Beta\", \"charlie\", \"delta\"]\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n}", + "snippet": "var result = schema.Evaluate(instance);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void IgnoreCaseTrue()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t\t.Type(SchemaValue" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/TestEnvironment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/TestEnvironment.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/TestEnvironment.cs", + "startLine": 1, + "endLine": 15, + "content": "using NUnit.Framework;\n\nnamespace Json.Schema.ArrayExt.Tests;\n\n[SetUpFixture]\npublic class TestEnvironment\n{\n\t[OneTimeSetUp]\n\tpublic void Setup()\n\t{\n\t\tBuildOptions.Default.Dialect = Dialect.ArrayExt_202012;\n\t\tMetaSchemas.Register();\n\t\tEvaluationOptions.Default.OutputFormat = OutputFormat.Hierarchical;\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nnamespace Json.Schema.ArrayExt.Tests;\n\n[SetUpFixture]\npublic class TestEnvironment\n{\n\t[OneTimeSetUp]\n\tpublic void Setup()\n\t{\n\t\tBuildOptions.Default.Dialect = Dialect.ArrayExt_202012;\n\t\tMetaSchemas" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/UniqueKeysSpecExampleTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/UniqueKeysSpecExampleTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/UniqueKeysSpecExampleTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Text.Json;\nusing Json.Schema.Tests;\nusing NUnit.Framework;\n\nnamespace Json.Schema.ArrayExt.Tests;\n\npublic class UniqueKeysSpecExampleTests\n{\n\tprivate static readonly BuildOptions _buildOptions = new() { SchemaRegistry = new() };\n\tprivate readonly JsonSchema _singleKeySchema = new JsonSchemaBuilder(_buildOptions)\n\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t.Type(SchemaValueType.Array)\n\t\t.Items(new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t)\n\t\t)\n\t\t.UniqueKeys(\"/foo\");\n\tprivate readonly JsonSchema _multiKeySchema = new JsonSchemaBuilder(_buildOptions)\n\t\t.Schema(MetaSchemas.ArrayExt_202012Id)\n\t\t.Type(SchemaValueType.Array)\n\t\t.Items(new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"var\", new JsonSchemaBuilder().Type(SchemaValueType.Boolean))\n\t\t\t)\n\t\t)\n\t\t.UniqueKeys(\"/foo\", \"/bar\");\n\n\t[Test]\n\tpublic void SingleKeySchema_UniqueValuesAtKeyPasses()\n\t{\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t { \"foo\": 8 },\n\t\t\t { \"foo\": 12 },\n\t\t\t { \"foo\": 42 }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar results = _singleKeySchema.Evaluate(instance);\n\n\t\tresults.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void SingleKeySchema_DuplicateValuesAtKeyFails()\n\t{\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t { \"foo\": 8 },\n\t\t\t { \"foo\": 12 },\n\t\t\t { \"foo\": 8 }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar results = _singleKeySchema.Evaluate(instance);\n\n\t\tresults.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void SingleKeySchema_NotAllItemsHaveFooPasses()\n\t{\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t { \"foo\": 8 },\n\t\t\t { \"bar\": 8 }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar results = _singleKeySchema.Evaluate(instance);\n\n\t\tresults.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void SingleKeySchema_DuplicateValuesAtKeyFailsEvenThoughItemsAreDistinct()\n\t{\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t { \"foo\": 8, \"bar\": true },\n\t\t\t { \"foo\": 12, \"bar\": true },\n\t\t\t { \"foo\": 8, \"bar\": false }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar results = _singleKeySchema.Evaluate(instance);\n\n\t\tresults.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void MultiKey_UniqueValuesAtKeysPasses()\n\t{\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t[\n\t\t\t { \"foo\": 8, \"bar\": true },\n\t\t\t { \"foo\": 12, \"bar\": true },\n\t\t\t { \"foo\": 8, \"bar\": false }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar results = _multiKeySchema.Evaluate(instance);\n\n\t\tresults.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void MultiKey_DuplicateValuesAtKeysFailsEvenThoughItemsAreDistinct()\n\t{\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"", + "snippet": "using System.Text.Json;\nusing Json.Schema.Tests;\nusing NUnit.Framework;\n\nnamespace Json.Schema.ArrayExt.Tests;\n\npublic class UniqueKeysSpecExampleTests\n{\n\tprivate static readonly BuildOptions _buildOptions = new() { Sche" + }, + { + "title": "src/JsonSchema.ArrayExt.Tests/UniqueKeysSpecExampleTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt.Tests/UniqueKeysSpecExampleTests.cs#L121-L132", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt.Tests/UniqueKeysSpecExampleTests.cs", + "startLine": 121, + "endLine": 132, + "content": "[\n\t\t\t { \"foo\": 8, \"bar\": true, \"baz\": \"yes\" },\n\t\t\t { \"foo\": 8, \"bar\": true, \"baz\": \"no\" },\n\t\t\t { \"foo\": 8, \"bar\": false }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar results = _multiKeySchema.Evaluate(instance);\n\n\t\tresults.AssertInvalid();\n\t}\n}", + "snippet": "[\n\t\t\t { \"foo\": 8, \"bar\": true, \"baz\": \"yes\" },\n\t\t\t { \"foo\": 8, \"bar\": true, \"baz\": \"no\" },\n\t\t\t { \"foo\": 8, \"bar\": false }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar results = _multiKeySchema.Evaluate(instance);\n\n\t\tresults.Asser" + }, + { + "title": "src/JsonSchema.ArrayExt/Dialect.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/Dialect.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/Dialect.cs", + "startLine": 1, + "endLine": 30, + "content": "using System;\nusing Json.Schema.ArrayExt.Keywords;\n\nnamespace Json.Schema.ArrayExt;\n\n/// \n/// Provides predefined JSON Schema dialects and extension vocabulary identifiers for use with Draft 2020-12 schemas,\n/// including support for array-specific extensions.\n/// \n/// Use the members of this class to reference dialects and vocabulary IDs when working with JSON Schema\n/// validation that requires array ordering or unique key features. The dialects defined here extend the standard Draft\n/// 2020-12 specification to support additional array-related keywords.\npublic static class Dialect\n{\n\t/// \n\t/// Represents the JSON Schema dialect for Draft 2020-12 with array extension keywords added.\n\t/// \n\t/// This dialect includes support for array ordering and unique keys via the OrderingKeyword and\n\t/// UniqueKeysKeyword extensions. Use this dialect when validating schemas that require these array-specific features\n\t/// in accordance with the 2020-12 draft specification.\n\t// ReSharper disable once InconsistentNaming\n\tpublic static readonly Schema.Dialect ArrayExt_202012 =\n\t\tSchema.Dialect.Draft202012.With([\n\t\t\t\tOrderingKeyword.Instance,\n\t\t\t\tUniqueKeysKeyword.Instance\n\t\t\t],\n\t\t\tMetaSchemas.ArrayExt_202012Id,\n\t\t\tfalse,\n\t\t\ttrue);\n}", + "snippet": "using System;\nusing Json.Schema.ArrayExt.Keywords;\n\nnamespace Json.Schema.ArrayExt;\n\n/// \n/// Provides predefined JSON Schema dialects and extension vocabulary identifiers for use with Draft 2020-12 schemas,\n///" + }, + { + "title": "src/JsonSchema.ArrayExt/JsonSchemaArrayExtSerializerContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/JsonSchemaArrayExtSerializerContext.cs#L1-L13", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/JsonSchemaArrayExtSerializerContext.cs", + "startLine": 1, + "endLine": 13, + "content": "using System.Text.Json.Serialization;\nusing Json.Pointer;\nusing Json.Schema.ArrayExt.Keywords;\n\nnamespace Json.Schema.ArrayExt;\n\n[JsonSerializable(typeof(UniqueKeysKeyword))]\n[JsonSerializable(typeof(OrderingKeyword))]\n[JsonSerializable(typeof(JsonPointer))]\n[JsonSerializable(typeof(OrderingSpecifier))]\n[JsonSerializable(typeof(OrderingSpecifier[]))]\n[JsonSerializable(typeof(int))]\ninternal partial class JsonSchemaArrayExtSerializerContext : JsonSerializerContext;", + "snippet": "using System.Text.Json.Serialization;\nusing Json.Pointer;\nusing Json.Schema.ArrayExt.Keywords;\n\nnamespace Json.Schema.ArrayExt;\n\n[JsonSerializable(typeof(UniqueKeysKeyword))]\n[JsonSerializable(typeof(OrderingKeyword))]\n[" + }, + { + "title": "src/JsonSchema.ArrayExt/JsonSchemaBuilderExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/JsonSchemaBuilderExtensions.cs#L1-L50", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/JsonSchemaBuilderExtensions.cs", + "startLine": 1, + "endLine": 50, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.Pointer;\nusing Json.Schema.ArrayExt.Keywords;\n\nnamespace Json.Schema.ArrayExt;\n\n/// \n/// Provides a fluent interface for .\n/// \npublic static class JsonSchemaBuilderExtensions\n{\n\t/// \n\t/// Adds a `uniqueKeys` keyword.\n\t/// \n\t/// The builder.\n\t/// The collection of pointers to the keys which should be unique within the array.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder UniqueKeys(this JsonSchemaBuilder builder, params IEnumerable keys)\n\t{\n\t\tbuilder.Add(\"uniqueKeys\", new JsonArray(keys.Select(x => (JsonNode?)x.ToString()).ToArray()));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Adds a `uniqueKeys` keyword.\n\t/// \n\t/// The builder.\n\t/// The collection of pointers to the keys which should be unique within the array.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder UniqueKeys(this JsonSchemaBuilder builder, params IEnumerable keys)\n\t{\n\t\tbuilder.Add(\"uniqueKeys\", new JsonArray(keys.Select(x => (JsonNode?)x).ToArray()));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Adds an `ordering` keyword.\n\t/// \n\t/// The builder.\n\t/// The collection of ordering specifiers.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Ordering(this JsonSchemaBuilder builder, params IEnumerable specifiers)\n\t{\n\t\tbuilder.Add(\"ordering\", JsonSerializer.SerializeToNode(specifiers.ToArray(), JsonSchemaArrayExtSerializerContext.Default.OrderingSpecifierArray));\n\t\treturn builder;\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.Pointer;\nusing Json.Schema.ArrayExt.Keywords;\n\nnamespace Json.Schema.ArrayExt;\n\n/// \n/// Prov" + }, + { + "title": "src/JsonSchema.ArrayExt/Keywords/Direction.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/Keywords/Direction.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/Keywords/Direction.cs", + "startLine": 1, + "endLine": 27, + "content": "using System.ComponentModel;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Schema.ArrayExt.Keywords;\n\n/// \n/// Allows specifying order direction for .\n/// \n[JsonConverter(typeof(EnumStringConverter))]\npublic enum Direction\n{\n\t/// \n\t/// Default value. Not valid.\n\t/// \n\tUnknown,\n\t/// \n\t/// Indicates ascending order.\n\t/// \n\t[Description(\"asc\")]\n\tAscending,\n\t/// \n\t/// Indicates descending order.\n\t/// \n\t[Description(\"desc\")]\n\tDescending\n}", + "snippet": "using System.ComponentModel;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Schema.ArrayExt.Keywords;\n\n/// \n/// Allows specifying order direction for .\n/// \n/// Represents the `ordering` keyword.\n/// \npublic class OrderingKeyword : IKeywordHandler\n{\n\tprivate enum Ordering\n\t{\n\t\tBefore = -1,\n\t\tSame,\n\t\tAfter\n\t}\n\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static OrderingKeyword Instance { get; set; } = new();\n\n\t/// \n\t/// The JSON name of the keyword.\n\t/// \n\tpublic string Name => \"ordering\";\n\n\tprivate OrderingKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Array)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an array, found {value.ValueKind}.\");\n\n\t\tvar specifiers = new List();\n\t\tforeach (var x in value.EnumerateArray())\n\t\t{\n\t\t\tif (!x.TryGetProperty(\"by\", out var byElement))\n\t\t\t\tthrow new JsonSchemaException($\"{Name} items require the 'by' property.\");\n\t\t\tif (byElement.ValueKind != JsonValueKind.String ||\n\t\t\t !JsonPointer.TryParse(byElement.GetString(), out var by))\n\t\t\t\tthrow new JsonSchemaException(\"The 'by' property must be a valid JSON Pointer.\");\n\n\t\t\tvar dir = Direction.Ascending;\n\t\t\tx.TryGetProperty(\"direction\", out var dirElement);\n\t\t\tif (dirElement.ValueKind != JsonValueKind.Undefined)\n\t\t\t{\n\t\t\t\tif (dirElement.ValueKind != JsonValueKind.String)\n\t\t\t\t\tthrow new JsonSchemaException(\"The 'dir' property must be either 'asc' or 'desc'.\");\n\n\t\t\t\tdir = dirElement.GetString() switch\n\t\t\t\t{\n\t\t\t\t\t\"asc\" => Direction.Ascending,\n\t\t\t\t\t\"desc\" => Direction.Descending,\n\t\t\t\t\t_ => throw new JsonSchemaException(\"The 'dir' property must be either 'asc' or 'desc'.\")\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tvar ignoreCase = false;\n\t\t\tx.TryGetProperty(\"ignoreCase\", out var ignoreCaseElement);\n\t\t\tif (ignoreCaseElement.ValueKind != JsonValueKind.Undefined)\n\t\t\t{\n\t\t\t\tignoreCase = ignoreCaseElement.ValueKind switch\n\t\t\t\t{\n\t\t\t\t\tJsonValueKind.True => true,\n\t\t\t\t\tJsonValueKind.False => false,\n\t\t\t\t\t_ => throw new JsonSchemaException(\"The 'ignoreCase' property must be a boolean.\")\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tvar culture = CultureInfo.InvariantCulture;\n\t\t\tx.TryGetProperty(\"culture\", out var cultureElement);\n\t\t\tif (cultureElement.ValueKind != JsonValueKind.Undefined)\n\t\t\t{\n\t\t\t\tif (cultureElement.ValueKind != JsonValueKind.String)\n\t\t\t\t\tthrow new JsonSchemaException(\"The 'culture' property must be either 'none' or a valid culture code.\");\n\n\t\t\t\tif (!cultureElement.ValueEquals(\"none\")) \n\t\t\t\t\tculture = GetCulture(cultureElement.GetString()!);\n\t\t\t}\n\n\t\t\tspecifiers.Add(new OrderingSpecifier(by, dir, culture, ignoreCase));\n\t\t}\n\n\t\tif (specifiers.Count == 0)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' requires at least one specifier object.\");\n\n\t\treturn specifiers;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar specifiers = (List)keyword.Value!;\n\n\t\tvar i = 1;\n\t\tusing var enumerator = context.Instance.EnumerateArray().GetEnumerator();", + "snippet": "using System.Collections.Generic;\nusing System.Globalization;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.ArrayExt.Keywords;\n\n/// \n/// Represents the `ordering` keyword.\n/// \npub" + }, + { + "title": "src/JsonSchema.ArrayExt/Keywords/OrderingKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/Keywords/OrderingKeyword.cs#L121-L225", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/Keywords/OrderingKeyword.cs", + "startLine": 121, + "endLine": 225, + "content": "enumerator.MoveNext();\n\t\tvar basisItem = enumerator.Current;\n\t\t\n\t\twhile (enumerator.MoveNext())\n\t\t{\n\t\t\tvar currentItem = enumerator.Current;\n\n\t\t\tforeach (var specifier in specifiers)\n\t\t\t{\n\t\t\t\t// TODO: successive specifiers only matter if the previous values are equal\n\n\t\t\t\tvar basisValue = specifier.By.Evaluate(basisItem);\n\t\t\t\tif (basisValue is null)\n\t\t\t\t{\n\t\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t\t{\n\t\t\t\t\t\tKeyword = Name,\n\t\t\t\t\t\tIsValid = false,\n\t\t\t\t\t\tError = \"Item at index [[index]] does not have a value at [[pointer]]\"\n\t\t\t\t\t\t\t.ReplaceToken(\"index\", i - 1)\n\t\t\t\t\t\t\t.ReplaceToken(\"pointer\", specifier.By, JsonSchemaArrayExtSerializerContext.Default.JsonPointer)\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tvar currentValue = specifier.By.Evaluate(currentItem);\n\t\t\t\tif (currentValue is null)\n\t\t\t\t{\n\t\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t\t{\n\t\t\t\t\t\tKeyword = Name,\n\t\t\t\t\t\tIsValid = false,\n\t\t\t\t\t\tError = \"Item at index [[index]] does not have a value at [[pointer]]\"\n\t\t\t\t\t\t\t.ReplaceToken(\"index\", i)\n\t\t\t\t\t\t\t.ReplaceToken(\"pointer\", specifier.By, JsonSchemaArrayExtSerializerContext.Default.JsonPointer)\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tvar check = GetOrdering(basisValue.Value, currentValue.Value, specifier);\n\n\t\t\t\tif (check.Ordering == Ordering.Before) break;\n\t\t\t\tif (check.Ordering == Ordering.After)\n\t\t\t\t{\n\t\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t\t{\n\t\t\t\t\t\tKeyword = Name,\n\t\t\t\t\t\tIsValid = false,\n\t\t\t\t\t\tError = \"Item at index [[index]] is not in order\"\n\t\t\t\t\t\t\t.ReplaceToken(\"index\", i)\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ti++;\n\t\t\tbasisItem = currentItem;\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true\n\t\t};\n\t}\n\n\tprivate static CultureInfo GetCulture(string code)\n\t{\n\t\t// https://stackoverflow.com/a/77408324/878701 (includes benchmark)\n\t\ttry\n\t\t{\n\t\t\treturn CultureInfo.GetCultureInfo(code);\n\t\t}\n\t\tcatch (CultureNotFoundException e)\n\t\t{\n\t\t\tthrow new JsonSchemaException($\"Unrecognized culture '{code}'\", e);\n\t\t}\n\t}\n\n\tprivate static (Ordering? Ordering, string? ErrorMessage) GetOrdering(JsonElement basis, JsonElement current, OrderingSpecifier specifier)\n\t{\n\t\tif (basis.ValueKind is JsonValueKind.String && current.ValueKind == JsonValueKind.String)\n\t\t{\n\t\t\tvar compareOptions = specifier.IgnoreCase ? CompareOptions.OrdinalIgnoreCase : CompareOptions.Ordinal;\n\t\t\tvar comparison = string.Compare(basis.GetString(), current.GetString(), specifier.Culture, compareOptions);\n\t\t\treturn (AdjustForDirection(ComparisonToOrdering(comparison), specifier.Direction), null);\n\t\t}\n\n\t\tif (basis.ValueKind is JsonValueKind.Number && current.ValueKind == JsonValueKind.Number)\n\t\t\treturn (AdjustForDirection(ComparisonToOrdering(JsonMath.NumberCompare(basis, current)), specifier.Direction), null);\n\n\t\treturn (null, \"Comparisons may only occur between strings or numbers and both values must be of the same type\");\n\t}\n\n\tprivate static Ordering ComparisonToOrdering(int comparison) =>\n\t\tcomparison switch\n\t\t{\n\t\t\t< 0 => Ordering.Before,\n\t\t\t0 => Ordering.Same,\n\t\t\t> 0 => Ordering.After\n\t\t};\n\n\tprivate static Ordering AdjustForDirection(Ordering ordering, Direction direction) =>\n\t\tdirection == Direction.Descending\n\t\t\t? (Ordering)((int)ordering * -1)\n\t\t\t: ordering;\n}", + "snippet": "enumerator.MoveNext();\n\t\tvar basisItem = enumerator.Current;\n\t\t\n\t\twhile (enumerator.MoveNext())\n\t\t{\n\t\t\tvar currentItem = enumerator.Current;\n\n\t\t\tforeach (var specifier in specifiers)\n\t\t\t{\n\t\t\t\t// TODO: successive specifie" + }, + { + "title": "src/JsonSchema.ArrayExt/Keywords/OrderingSpecifier.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/Keywords/OrderingSpecifier.cs#L1-L66", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/Keywords/OrderingSpecifier.cs", + "startLine": 1, + "endLine": 66, + "content": "using System;\nusing System.Globalization;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.Pointer;\n\nnamespace Json.Schema.ArrayExt.Keywords;\n\n/// \n/// Represents a single ordering characteristic.\n/// \npublic struct OrderingSpecifier\n{\n\t/// \n\t/// Gets a pointer to the value.\n\t/// \n\t[JsonPropertyName(\"by\")]\n\tpublic JsonPointer By { get; }\n\t/// \n\t/// Gets the direction of the ordering.\n\t/// \n\t[JsonPropertyName(\"direction\")]\n\tpublic Direction Direction { get; }\n\t/// \n\t/// For strings, gets the culture to use.\n\t/// \n\t[JsonPropertyName(\"culture\")]\n\t[JsonConverter(typeof(CustomCultureInfoConverter))]\n\tpublic CultureInfo Culture { get; }\n\t/// \n\t/// For strings, gets whether to consider case sensitivity.\n\t/// \n\t[JsonPropertyName(\"ignoreCase\")]\n\tpublic bool IgnoreCase { get; }\n\n\t/// \n\t/// Creates a new .\n\t/// \n\t/// A pointer to the value\n\t/// The direction of the ordering\n\t/// For strings, gets the culture to use\n\t/// For strings, gets whether to consider case sensitivity\n\tpublic OrderingSpecifier(JsonPointer by, Direction direction = Direction.Ascending, CultureInfo? culture = null, bool ignoreCase = false)\n\t{\n\t\tBy = by;\n\t\tDirection = direction;\n\t\tCulture = culture ?? CultureInfo.InvariantCulture;\n\t\tIgnoreCase = ignoreCase;\n\t}\n}\n\ninternal class CustomCultureInfoConverter : JsonConverter\n{\n\tpublic override CultureInfo? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar text = reader.GetString();\n\t\tif (text == \"none\") return CultureInfo.InvariantCulture;\n\t\t\n\t\treturn CultureInfo.GetCultureInfo(text!);\n\t}\n\n\tpublic override void Write(Utf8JsonWriter writer, CultureInfo value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStringValue(value.ToString());\n\t}\n}", + "snippet": "using System;\nusing System.Globalization;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.Pointer;\n\nnamespace Json.Schema.ArrayExt.Keywords;\n\n/// \n/// Represents a single ordering charac" + }, + { + "title": "src/JsonSchema.ArrayExt/Keywords/UniqueKeysKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/Keywords/UniqueKeysKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/Keywords/UniqueKeysKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Schema.ArrayExt.Keywords;\n\n/// \n/// Handles `uniqueKeys`.\n/// \npublic class UniqueKeysKeyword : IKeywordHandler\n{\n\tprivate class MaybeJsonNodeComparer : IEqualityComparer\n\t{\n\t\tpublic static IEqualityComparer Comparer { get; } = new MaybeJsonNodeComparer();\n\n\t\tpublic bool Equals(JsonElement? x, JsonElement? y)\n\t\t{\n\t\t\tif (!x.HasValue) return !y.HasValue;\n\t\t\tif (!y.HasValue) return false;\n\n\t\t\treturn x.Value.IsEquivalentTo(y.Value);\n\t\t}\n\n\t\tpublic int GetHashCode(JsonElement? obj)\n\t\t{\n\t\t\tif (!obj.HasValue) return 0;\n\t\t\t\n\t\t\t// For numbers, use decimal value for hash to ensure 1, 1.0, 1.00 hash the same\n\t\t\tif (obj.Value.ValueKind == JsonValueKind.Number)\n\t\t\t\treturn obj.Value.GetDecimal().GetHashCode();\n\t\t\t\n\t\t\treturn obj.Value.GetEquivalenceHashCode();\n\t\t}\n\t}\n\n\tprivate class JsonElementListComparer : IEqualityComparer>\n\t{\n\t\tpublic bool Equals(List? x, List? y)\n\t\t{\n\t\t\tif (ReferenceEquals(x, y)) return true;\n\t\t\tif (x is null || y is null) return false;\n\t\t\tif (x.Count != y.Count) return false;\n\n\t\t\treturn x.SequenceEqual(y, MaybeJsonNodeComparer.Comparer);\n\t\t}\n\n\t\tpublic int GetHashCode(List? obj)\n\t\t{\n\t\t\tif (obj is null) return 0;\n\n\t\t\tunchecked\n\t\t\t{\n\t\t\t\tint hash = 17;\n\t\t\t\tforeach (var item in obj)\n\t\t\t\t{\n\t\t\t\t\thash = hash * 31 + MaybeJsonNodeComparer.Comparer.GetHashCode(item!);\n\t\t\t\t}\n\t\t\t\treturn hash;\n\t\t\t}\n\t\t}\n\t}\n\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static UniqueKeysKeyword Instance { get; set; } = new();\n\n\t/// \n\t/// The JSON name of the keyword.\n\t/// \n\tpublic string Name => \"uniqueKeys\";\n\n\tprivate UniqueKeysKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Array)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an array, found {value.ValueKind}.\");\n\n\t\tvar pointers = new List();\n\t\tforeach (var x in value.EnumerateArray())\n\t\t{\n\t\t\tif (x.ValueKind is not JsonValueKind.String || !JsonPointer.TryParse(x.GetString(), out var pointer))\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an array of JSON Pointer strings.\");\n\n\t\t\tpointers.Add(pointer);\n\t\t}\n\n\t\treturn pointers;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar pointers = (List)keyword.Value!;\n\n\t\tvar collections = new List>();", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Schema.ArrayExt.Keywords;\n\n/// \n/// Handles `uniqueKeys`.\n/// \npublic c" + }, + { + "title": "src/JsonSchema.ArrayExt/Keywords/UniqueKeysKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/Keywords/UniqueKeysKeyword.cs#L121-L160", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/Keywords/UniqueKeysKeyword.cs", + "startLine": 121, + "endLine": 160, + "content": "foreach (var item in context.Instance.EnumerateArray())\n\t\t{\n\t\t\tvar values = pointers.Select(x => x.Evaluate(item)).ToList();\n\t\t\tcollections.Add(values);\n\t\t}\n\n\t\tvar seen = new Dictionary, int>(new JsonElementListComparer());\n\t\tvar matchedIndexPairs = new List<(int, int)>();\n\n\t\tfor (int i = 0; i < collections.Count; i++)\n\t\t{\n\t\t\tif (seen.TryGetValue(collections[i], out var firstIndex))\n\t\t\t{\n\t\t\t\tmatchedIndexPairs.Add((firstIndex, i));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tseen[collections[i]] = i;\n\t\t\t}\n\t\t}\n\n\t\tif (matchedIndexPairs.Count != 0)\n\t\t{\n\t\t\tvar pairs = string.Join(\", \", matchedIndexPairs.Select(d => $\"({d.Item1}, {d.Item2})\"));\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tIsValid = false,\n\t\t\t\tKeyword = Name,\n\t\t\t\tError = ErrorMessages.GetUniqueItems(context.Options.Culture)\n\t\t\t\t\t.ReplaceToken(\"duplicates\", pairs)\n\t\t\t};\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tIsValid = true,\n\t\t\tKeyword = Name,\n\t\t};\n\t}\n}", + "snippet": "foreach (var item in context.Instance.EnumerateArray())\n\t\t{\n\t\t\tvar values = pointers.Select(x => x.Evaluate(item)).ToList();\n\t\t\tcollections.Add(values);\n\t\t}\n\n\t\tvar seen = new Dictionary, int>(new JsonE" + }, + { + "title": "src/JsonSchema.ArrayExt/MetaSchemas.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/MetaSchemas.cs#L1-L50", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/MetaSchemas.cs", + "startLine": 1, + "endLine": 50, + "content": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Text.Json;\n\nnamespace Json.Schema.ArrayExt;\n\n/// \n/// Provides access to meta-schemas and registration methods for the array extensions vocabulary used in JSON Schema\n/// processing.\n/// \n/// Use this class to register and retrieve the meta-schema required for validating schemas that utilize\n/// the array extensions vocabulary. All members are static and intended for application-wide configuration.\npublic static class MetaSchemas\n{\n\t/// \n\t/// The ID for the draft 2020-12 extension vocabulary which includes the array extensions vocabulary.\n\t/// \n\t// ReSharper disable once InconsistentNaming\n\tpublic static readonly Uri ArrayExt_202012Id = new(\"https://json-everything.net/meta/array-ext\");\n\n\t/// \n\t/// The array extensions vocabulary meta-schema.\n\t/// \n\tpublic static JsonSchema ArrayExt { get; private set; } = null!;\n\n\t/// \n\t/// Registers the all components required to use the array extensions vocabulary.\n\t/// \n\tpublic static void Register(BuildOptions? buildOptions = null)\n\t{\n\t\tbuildOptions ??= BuildOptions.Default;\n\n\t\tbuildOptions.DialectRegistry.Register(Dialect.ArrayExt_202012);\n\t\tbuildOptions.VocabularyRegistry.Register(Vocabulary.ArrayExt);\n\n\t\tArrayExt = LoadMetaSchema(\"array-ext\", buildOptions);\n\t}\n\n\tprivate static JsonSchema LoadMetaSchema(string resourceName, BuildOptions buildOptions)\n\t{\n\t\tvar resourceStream = typeof(MetaSchemas).Assembly.GetManifestResourceStream(@$\"Json.Schema.ArrayExt.Meta_Schemas.{resourceName}.json\");\n\t\tusing var reader = new StreamReader(resourceStream!, Encoding.UTF8);\n\n\t\tvar text = reader.ReadToEnd();\n\t\tvar json = JsonDocument.Parse(text).RootElement;\n\n\t\treturn JsonSchema.Build(json, buildOptions);\n\t}\n}", + "snippet": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Text.Json;\n\nnamespace Json.Schema.ArrayExt;\n\n/// \n/// Provides access to meta-schemas and registration methods for the array extensions vocabulary u" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Debug/net10.0/JsonSchema.ArrayExt.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Debug/net10.0/JsonSchema.ArrayExt.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Debug/net10.0/JsonSchema.ArrayExt.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide keywords to extend array validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"4.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"4.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"4.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Debug/net8.0/JsonSchema.ArrayExt.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Debug/net8.0/JsonSchema.ArrayExt.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Debug/net8.0/JsonSchema.ArrayExt.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide keywords to extend array validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"4.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"4.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"4.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Debug/net9.0/JsonSchema.ArrayExt.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Debug/net9.0/JsonSchema.ArrayExt.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Debug/net9.0/JsonSchema.ArrayExt.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide keywords to extend array validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"4.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"4.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"4.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Debug/netstandard2.0/JsonSchema.ArrayExt.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Debug/netstandard2.0/JsonSchema.ArrayExt.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Debug/netstandard2.0/JsonSchema.ArrayExt.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide keywords to extend array validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"4.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"4.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"4.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Release/net10.0/JsonSchema.ArrayExt.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Release/net10.0/JsonSchema.ArrayExt.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Release/net10.0/JsonSchema.ArrayExt.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide keywords to extend array validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"4.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"4.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"4.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Release/net8.0/JsonSchema.ArrayExt.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Release/net8.0/JsonSchema.ArrayExt.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Release/net8.0/JsonSchema.ArrayExt.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide keywords to extend array validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"4.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"4.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"4.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Release/net9.0/JsonSchema.ArrayExt.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Release/net9.0/JsonSchema.ArrayExt.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Release/net9.0/JsonSchema.ArrayExt.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide keywords to extend array validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"4.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"4.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"4.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.ArrayExt/obj/Release/netstandard2.0/JsonSchema.ArrayExt.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/obj/Release/netstandard2.0/JsonSchema.ArrayExt.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/obj/Release/netstandard2.0/JsonSchema.ArrayExt.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide keywords to extend array validation\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"4.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"4.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.ArrayExt\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"4.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.ArrayExt/Vocabulary.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.ArrayExt/Vocabulary.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.ArrayExt/Vocabulary.cs", + "startLine": 1, + "endLine": 23, + "content": "using System;\nusing Json.Schema.ArrayExt.Keywords;\n\nnamespace Json.Schema.ArrayExt;\n\n/// \n/// Declares the vocabularies of the supported drafts.\n/// \npublic static class Vocabulary\n{\n\t/// \n\t/// The array extensions vocabulary ID.\n\t/// \n\tpublic static readonly Uri ArrayExtId = new(\"https://docs.json-everything.net/schema/vocabs/array-ext\");\n\n\t/// \n\t/// The array extensions vocabulary.\n\t/// \n\tpublic static readonly Schema.Vocabulary ArrayExt =\n\t\tnew(ArrayExtId, \n\t\t\tUniqueKeysKeyword.Instance,\n\t\t\tOrderingKeyword.Instance);\n}", + "snippet": "using System;\nusing Json.Schema.ArrayExt.Keywords;\n\nnamespace Json.Schema.ArrayExt;\n\n/// \n/// Declares the vocabularies of the supported drafts.\n/// \npublic static class Vocabulary\n{\n\t/// \n\t//" + }, + { + "title": "src/JsonSchema.Data.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Data.Tests/obj/Debug/net10.0/JsonSchema.Data.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/obj/Debug/net10.0/JsonSchema.Data.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/obj/Debug/net10.0/JsonSchema.Data.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Data.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Data.Tests/obj/Debug/net8.0/JsonSchema.Data.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/obj/Debug/net8.0/JsonSchema.Data.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/obj/Debug/net8.0/JsonSchema.Data.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Data.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Data.Tests/obj/Debug/net9.0/JsonSchema.Data.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/obj/Debug/net9.0/JsonSchema.Data.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/obj/Debug/net9.0/JsonSchema.Data.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Data.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Data.Tests/obj/Release/net10.0/JsonSchema.Data.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/obj/Release/net10.0/JsonSchema.Data.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/obj/Release/net10.0/JsonSchema.Data.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Data.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Data.Tests/obj/Release/net8.0/JsonSchema.Data.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/obj/Release/net8.0/JsonSchema.Data.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/obj/Release/net8.0/JsonSchema.Data.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Data.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Data.Tests/obj/Release/net9.0/JsonSchema.Data.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/obj/Release/net9.0/JsonSchema.Data.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/obj/Release/net9.0/JsonSchema.Data.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Data.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Data.Tests/Suite/Suite.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/Suite/Suite.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/Suite/Suite.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text.Json;\nusing Humanizer;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Data.Tests.Suite;\n\npublic class Suite\n{\n\tprivate const string _testCasesPath = @\"../../../../../ref-repos/json-schema-vocab-test-suites/tests/data\";\n\tprivate const string _remoteSchemasPath = _testCasesPath + \"/external-sources\";\n\tprivate const string _coreSchemasPath = _testCasesPath + \"/core\";\n\n\tprivate const bool _useExternal = false;\n\tprivate const string _externalTestCasesPath = @\"../../../../../../json-schema-vocab-test-suites/tests/data\";\n\tprivate const string _externalRemoteSchemasPath = _externalTestCasesPath + \"/external-sources\";\n\tprivate const string _externalCoreSchemasPath = _externalTestCasesPath + \"/core\";\n\n\tpublic static IEnumerable TestCases()\n\t{\n\t\t// ReSharper disable once HeuristicUnreachableCode\n\t\tvar testCasesPath = _useExternal ? _externalTestCasesPath : _testCasesPath;\n\n\t\tvar testsPath = System.IO.Path.Combine(TestContext.CurrentContext.WorkDirectory, testCasesPath)\n\t\t\t.AdjustForPlatform();\n\t\tif (!Directory.Exists(testsPath)) return [];\n\n\t\tvar fileNames = Directory.GetFiles(testsPath, \"*.json\");\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t};\n\n\t\tvar allTests = new List();\n\t\tforeach (var fileName in fileNames)\n\t\t{\n\t\t\tvar shortFileName = System.IO.Path.GetFileNameWithoutExtension(fileName);\n\t\t\tvar contents = File.ReadAllText(fileName);\n\t\t\tvar collections = JsonSerializer.Deserialize>(contents, TestEnvironment.SerializerOptions);\n\n\t\t\tforeach (var collection in collections!)\n\t\t\t{\n\t\t\t\tcollection.IsOptional = fileName.Contains(\"optional\");\n\t\t\t\tforeach (var test in collection.Tests)\n\t\t\t\t{\n\t\t\t\t\tvar buildOptions = new BuildOptions\n\t\t\t\t\t{\n\t\t\t\t\t\tDialect = Dialect.Data_202012,\n\t\t\t\t\t\tSchemaRegistry = new()\n\t\t\t\t\t};\n\t\t\t\t\tvar optional = collection.IsOptional ? \"(optional)/\" : null;\n\t\t\t\t\tvar name = $\"{shortFileName}/{optional}{collection.Description.Kebaberize()}/{test.Description.Kebaberize()}\";\n\t\t\t\t\tvar evaluationOptionsCopy = EvaluationOptions.From(options);\n\t\t\t\t\tallTests.Add(new TestCaseData(collection, test, shortFileName, buildOptions, evaluationOptionsCopy) { TestName = name });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn allTests;\n\t}\n\n\t[OneTimeSetUp]\n\tpublic static void LoadRemoteSchemas()\n\t{\n\t\tvar remotesPath = _useExternal ? _externalRemoteSchemasPath : _remoteSchemasPath;\n\n\t\tvar remotesFilePath = System.IO.Path.Combine(TestContext.CurrentContext.WorkDirectory, remotesPath)\n\t\t\t.AdjustForPlatform();\n\t\tif (!Directory.Exists(remotesFilePath))\n\t\t\tthrow new Exception(\"cannot find remotes path\");\n\n\t\tBuildOptions.Default.GetDataRegistry().Fetch = uri =>\n\t\t{\n\t\t\tif (uri.OriginalString.StartsWith(\"https://json-everything.lib\")) return default;\n\t\t\tvar filePath = uri.OriginalString.Replace(\"http://localhost:1234\", remotesPath).Split(\"#\")[0];\n\t\t\tvar text = File.ReadAllText(filePath);\n\t\t\treturn JsonDocument.Parse(text).RootElement;\n\t\t};\n\t}\n\n\t[TestCaseSource(nameof(TestCases))]\n\tpublic void Test(TestCollection collection, TestCase test, string fileName, BuildOptions buildOptions, EvaluationOptions evaluationOptions)\n\t{\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(fileName);\n\t\tTestConsole.WriteLine(collection.Description);\n\t\tTestConsole.WriteLine(test.Description);\n\t\tif (test.Error)\n\t\t\tTestConsole.WriteLine(\"expected error\");\n\t\telse\n\t\t\tTestConsole.WriteLine(test.Valid ? \"valid\" : \"invalid\");\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(collection.Schema, TestEnvironment.SerializerOptions));\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(test.Data, TestEnvironment.SerializerOptions));\n\t\tTestConsole.WriteLine();\n\n\t\tJsonSchema schema;\n\t\ttry\n\t\t{\n\t\t\tschema = Measure.Run(\"Build\", () => JsonSchema.Build(collection.Schema, buildOptions));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tConsole.WriteLine(e);\n\t\t\tif (collection.IsOptional)\n\t\t\t{\n\t\t\t\tAssert.Inconclusive();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (test.Error) return;\n\n\t\t\tthrow;\n\t\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text.Json;\nusing Humanizer;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Data.Tests.Suite;\n\npublic class Suite\n{\n\tprivate " + }, + { + "title": "src/JsonSchema.Data.Tests/Suite/Suite.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/Suite/Suite.cs#L121-L182", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/Suite/Suite.cs", + "startLine": 121, + "endLine": 182, + "content": "EvaluationResults result;\n\t\ttry\n\t\t{\n\t\t\tresult = Measure.Run(\"Evaluate\", () => schema.Evaluate(test.Data, evaluationOptions));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tConsole.WriteLine(e);\n\t\t\tif (collection.IsOptional)\n\t\t\t{\n\t\t\t\tAssert.Inconclusive();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (test.Error) return;\n\n\t\t\tthrow;\n\t\t}\n\t\t//result.ToBasic();\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, TestEnvironment.SerializerOptions));\n\n\t\tif (collection.IsOptional && result.IsValid != test.Valid)\n\t\t\tAssert.Inconclusive(\"Test optional\");\n\t\tAssert.That(result.IsValid, Is.EqualTo(test.Valid));\n\t}\n\n\tpublic static IEnumerable CoreTestCases()\n\t{\n\t\t// ReSharper disable once HeuristicUnreachableCode\n\t\tvar testCasesPath = _useExternal ? _externalCoreSchemasPath : _coreSchemasPath;\n\n\t\tvar testsPath = System.IO.Path.Combine(TestContext.CurrentContext.WorkDirectory, testCasesPath)\n\t\t\t.AdjustForPlatform();\n\t\tif (!Directory.Exists(testsPath)) return [];\n\n\t\tvar fileNames = Directory.GetFiles(testsPath, \"*.json\");\n\n\t\tvar allTests = new List();\n\t\tforeach (var fileName in fileNames)\n\t\t{\n\t\t\tvar shortFileName = System.IO.Path.GetFileNameWithoutExtension(fileName);\n\t\t\tvar contents = File.ReadAllText(fileName);\n\n\t\t\tvar name = $\"${shortFileName}\";\n\t\t\tallTests.Add(new TestCaseData(contents) { TestName = name });\n\t\t}\n\n\t\treturn allTests;\n\t}\n\n\t[TestCaseSource(nameof(CoreTestCases))]\n\tpublic void CoreKeywordsAreInvalid(string schemaText)\n\t{\n\t\tAssert.Throws(() => JsonSerializer.Deserialize(schemaText, TestEnvironment.SerializerOptions));\n\t}\n\n\t[Test]\n\tpublic void EnsureTestSuiteConfiguredForServerBuild()\n\t{\n\t\tAssert.That(_useExternal, Is.False);\n\t}\n}", + "snippet": "EvaluationResults result;\n\t\ttry\n\t\t{\n\t\t\tresult = Measure.Run(\"Evaluate\", () => schema.Evaluate(test.Data, evaluationOptions));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tConsole.WriteLine(e);\n\t\t\tif (collection.IsOptional)\n\t\t\t{\n\t\t\t\t" + }, + { + "title": "src/JsonSchema.Data.Tests/Suite/TestCase.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/Suite/TestCase.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/Suite/TestCase.cs", + "startLine": 1, + "endLine": 18, + "content": "using System.Text.Json;\nusing System.Text.Json.Serialization;\n\n#pragma warning disable CS8618\n\nnamespace Json.Schema.Data.Tests.Suite;\n\npublic class TestCase\n{\n\t[JsonPropertyName(\"description\")]\n\tpublic string Description { get; set; }\n\t[JsonPropertyName(\"data\")]\n\tpublic JsonElement Data { get; set; }\n\t[JsonPropertyName(\"valid\")]\n\tpublic bool Valid { get; set; }\n\t[JsonPropertyName(\"error\")]\n\tpublic bool Error { get; set; }\n}", + "snippet": "using System.Text.Json;\nusing System.Text.Json.Serialization;\n\n#pragma warning disable CS8618\n\nnamespace Json.Schema.Data.Tests.Suite;\n\npublic class TestCase\n{\n\t[JsonPropertyName(\"description\")]\n\tpublic string Descriptio" + }, + { + "title": "src/JsonSchema.Data.Tests/Suite/TestCollection.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/Suite/TestCollection.cs#L1-L19", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/Suite/TestCollection.cs", + "startLine": 1, + "endLine": 19, + "content": "using System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\n#pragma warning disable CS8618\n\nnamespace Json.Schema.Data.Tests.Suite;\n\npublic class TestCollection\n{\n\t[JsonPropertyName(\"description\")]\n\tpublic string Description { get; set; }\n\t[JsonPropertyName(\"schema\")]\n\tpublic JsonElement Schema { get; set; }\n\t[JsonPropertyName(\"tests\")]\n\tpublic List Tests { get; set; }\n\t[JsonPropertyName(\"isOptional\")]\n\tpublic bool IsOptional { get; set; }\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\n#pragma warning disable CS8618\n\nnamespace Json.Schema.Data.Tests.Suite;\n\npublic class TestCollection\n{\n\t[JsonPropertyName(\"d" + }, + { + "title": "src/JsonSchema.Data.Tests/TestEnvironment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/TestEnvironment.cs#L1-L34", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/TestEnvironment.cs", + "startLine": 1, + "endLine": 34, + "content": "using System.Collections.Generic;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Data.Tests.Suite;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Data.Tests;\n\n[SetUpFixture]\npublic class TestEnvironment\n{\n\tpublic static readonly JsonSerializerOptions SerializerOptions =\n\t\tnew()\n\t\t{\n\t\t\tTypeInfoResolverChain = { DataTestsSerializerContext.Default },\n\t\t\tWriteIndented = true,\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t\t};\n\n\t[OneTimeSetUp]\n\tpublic void Setup()\n\t{\n\t\tBuildOptions.Default.Dialect = Dialect.Data_202012;\n\t\tMetaSchemas.Register();\n\t\tEvaluationOptions.Default.OutputFormat = OutputFormat.Hierarchical;\n\t}\n}\n\n[JsonSerializable(typeof(TestCollection))]\n[JsonSerializable(typeof(List))]\n[JsonSerializable(typeof(JsonSchema))]\n[JsonSerializable(typeof(EvaluationResults))]\ninternal partial class DataTestsSerializerContext : JsonSerializerContext;", + "snippet": "using System.Collections.Generic;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Data.Tests.Suite;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Data.Test" + }, + { + "title": "src/JsonSchema.Data.Tests/Tests.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/Tests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/Tests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Text.Json;\nusing Json.Schema.Tests;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Data.Tests;\n\npublic class Tests\n{\n\tprivate static readonly JsonSchema _instanceRef =\n\t\tnew JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Data_202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Data((\"minimum\", \"/minValue\"))\n\t\t\t\t)\n\t\t\t);\n\n\tprivate static readonly JsonSchema _instanceRefOptional =\n\t\tnew JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Data_202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.OptionalData((\"minimum\", \"/minValue\"))\n\t\t\t\t)\n\t\t\t);\n\n\tprivate static readonly JsonSchema _instanceRelativeRef =\n\t\tnew JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Data_202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"bar\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t\t\t.Data((\"minimum\", \"2/minValue\"))\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\n\t[Test]\n\tpublic void InstanceRef_Passing()\n\t{\n\t\tvar instanceData = \"\"\"{\"minValue\":5,\"foo\":10}\"\"\";\n\t\tvar instance = JsonDocument.Parse(instanceData).RootElement;\n\n\t\tvar result = _instanceRef.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void InstanceRef_Failing()\n\t{\n\t\tvar instanceData = \"\"\"{\"minValue\":15,\"foo\":10}\"\"\";\n\t\tvar instance = JsonDocument.Parse(instanceData).RootElement;\n\n\t\tvar result = _instanceRef.Evaluate(instance);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t[Test]\n\t[Ignore(\"Relative pointer unsupported\")]\n\tpublic void InstanceRelativeRef_Passing()\n\t{\n\t\tvar instanceData = \"\"\"{\"minValue\":5,\"foo\":{\"bar\":10}}\"\"\";\n\t\tvar instance = JsonDocument.Parse(instanceData).RootElement;\n\n\t\tvar result = _instanceRelativeRef.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\t[Ignore(\"Relative pointer unsupported\")]\n\tpublic void InstanceRelativeRef_Failing()\n\t{\n\t\tvar instanceData = \"\"\"{\"minValue\":15,\"foo\":{\"bar\":10}}\"\"\";\n\t\tvar instance = JsonDocument.Parse(instanceData).RootElement;\n\n\t\tvar result = _instanceRelativeRef.Evaluate(instance);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void InstanceRef_InvalidValueType()\n\t{\n\t\tvar instanceData = \"\"\"{\"minValue\":true,\"foo\":10}\"\"\";\n\t\tvar instance = JsonDocument.Parse(instanceData).RootElement;\n\n\t\tAssert.Throws(() => _instanceRef.Evaluate(instance));\n\t}\n\n\t[Test]\n\tpublic void InstanceRef_Unresolvable()\n\t{\n\t\tvar instanceData = \"\"\"{\"minValu\":5,\"foo\":10}\"\"\";\n\t\tvar instance = JsonDocument.Parse(instanceData).RootElement;\n\n\t\tAssert.Throws(() => _instanceRef.Evaluate(instance));\n\t}\n\n\t[Test]\n\tpublic void InstanceRefOptional_Unresolvable()\n\t{\n\t\tvar instanceData = \"\"\"{\"minValu\":5,\"foo\":10}\"\"\";\n\t\tvar instance = JsonDocument.Parse(instanceData).RootElement;\n\n\t\tvar result = _instanceRefOptional.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}", + "snippet": "using System.Text.Json;\nusing Json.Schema.Tests;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Data.Tests;\n\npublic class Tests\n{\n\tprivate static readonly JsonSchema _instanceRef =\n\t\tnew JsonSchemaBuilder()\n\t\t\t.Schema(Met" + }, + { + "title": "src/JsonSchema.Data.Tests/Tests.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/Tests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/Tests.cs", + "startLine": 121, + "endLine": 240, + "content": "[Test]\n\tpublic void ExternalRef_Passing()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new(),\n\t\t\tDialect = Dialect.Data_202012\n\t\t};\n\t\tMetaSchemas.Register(buildOptions);\n\t\tbuildOptions.GetDataRegistry().Fetch = _ => JsonDocument.Parse(\"\"\"{\"minValue\":5}\"\"\").RootElement;\n\n\t\tJsonSchema externalRef =\n\t\t\tnew JsonSchemaBuilder(buildOptions)\n\t\t\t\t.Schema(MetaSchemas.Data_202012Id)\n\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"foo\", new JsonSchemaBuilder()\n\t\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t\t.Data((\"minimum\", \"http://json.test/data#/minValue\"))\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\tvar instanceData = \"\"\"{\"foo\":10}\"\"\";\n\t\tvar instance = JsonDocument.Parse(instanceData).RootElement;\n\n\t\tvar result = externalRef.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void ExternalRef_Failing()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new(),\n\t\t\tDialect = Dialect.Data_202012\n\t\t};\n\t\tMetaSchemas.Register(buildOptions);\n\t\tbuildOptions.GetDataRegistry().Fetch = _ => JsonDocument.Parse(\"\"\"{\"minValue\":15}\"\"\").RootElement;\n\n\t\tJsonSchema externalRef =\n\t\t\tnew JsonSchemaBuilder(buildOptions)\n\t\t\t\t.Schema(MetaSchemas.Data_202012Id)\n\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"foo\", new JsonSchemaBuilder()\n\t\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t\t.Data((\"minimum\", \"http://json.test/data#/minValue\"))\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\tvar instanceData = \"\"\"{\"foo\":10}\"\"\";\n\t\tvar instance = JsonDocument.Parse(instanceData).RootElement;\n\n\t\tvar result = externalRef.Evaluate(instance);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\tprivate static readonly JsonSchema _pathRef = new JsonSchemaBuilder()\n\t\t.Schema(MetaSchemas.Data_202012Id)\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"options\", new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"id\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t\t\t(\"value\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t\t\t)\n\t\t\t\t\t.Required(\"id\", \"value\")\n\t\t\t\t)\n\t\t\t),\n\t\t\t(\"selected\", new JsonSchemaBuilder()\n\t\t\t\t.Data(\n\t\t\t\t\t(\"enum\", \"$.options[*].id\")\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\n\t[Test]\n\tpublic void SpecExamplePassing()\n\t{\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"options\": [\n\t\t\t { \"id\": 1, \"value\": \"foo\" },\n\t\t\t { \"id\": 2, \"value\": \"bar\" },\n\t\t\t { \"id\": 3, \"value\": \"baz\" },\n\t\t\t { \"id\": 4, \"value\": \"quux\" }\n\t\t\t ],\n\t\t\t \"selection\": 2\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\n\t\tvar result = _pathRef.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void SpecExampleFailing()\n\t{\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"options\": [\n\t\t\t { \"id\": 1, \"value\": \"foo\" },\n\t\t\t { \"id\": 2, \"value\": \"bar\" },\n\t\t\t { \"id\": 3, \"value\": \"baz\" },\n\t\t\t { \"id\": 4, \"value\": \"quux\" }\n\t\t\t ],\n\t\t\t \"selection\": 42\n\t\t\t}\n\t\t\t\"\"\").RootElement;", + "snippet": "[Test]\n\tpublic void ExternalRef_Passing()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new(),\n\t\t\tDialect = Dialect.Data_202012\n\t\t};\n\t\tMetaSchemas.Register(buildOptions);\n\t\tbuildOptions.GetDataRegistry" + }, + { + "title": "src/JsonSchema.Data.Tests/Tests.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data.Tests/Tests.cs#L241-L245", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data.Tests/Tests.cs", + "startLine": 241, + "endLine": 245, + "content": "var result = _pathRef.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n}", + "snippet": "var result = _pathRef.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n}" + }, + { + "title": "src/JsonSchema.Data/DataRefResolutionException.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/DataRefResolutionException.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/DataRefResolutionException.cs", + "startLine": 1, + "endLine": 30, + "content": "using System;\nusing System.Collections.Generic;\n\n// ReSharper disable once CheckNamespace\nnamespace Json.Schema;\n\n/// \n/// Thrown when a reference cannot be resolved.\n/// \n/// \n/// This class will be moved into a future version of JsonSchema.Net.\n/// \npublic class DataRefResolutionException : Exception\n{\n\t/// \n\t/// The URI that could not be resolved.\n\t/// \n\tpublic IEnumerable References { get; }\n\n\t/// \n\t/// Thrown when a reference cannot be resolved.\n\t/// \n\t/// The references that could not be resolved.\n\t/// The exception that caused this error.\n\tpublic DataRefResolutionException(IEnumerable references, Exception? innerException = null)\n\t\t: base(\"An error occurred attempting to resolve one or more references\", innerException)\n\t{\n\t\tReferences = references;\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\n\n// ReSharper disable once CheckNamespace\nnamespace Json.Schema;\n\n/// \n/// Thrown when a reference cannot be resolved.\n/// \n/// \n/// This class " + }, + { + "title": "src/JsonSchema.Data/DataRegistry.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/DataRegistry.cs#L1-L109", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/DataRegistry.cs", + "startLine": 1, + "endLine": 109, + "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Net.Http;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.Data;\n\n/// \n/// Provides a registry for associating URIs with JSON elements, supporting registration, retrieval, and optional\n/// automatic fetching of data by URI.\n/// \n/// The DataRegistry class enables applications to register and retrieve JSON data by URI, with support\n/// for a global registry and customizable fetch logic. Registered data can be retrieved from both instance and global\n/// registries. Thread safety is not guaranteed; callers should ensure appropriate synchronization if accessing\n/// instances from multiple threads.\npublic class DataRegistry\n{\n\tprivate static readonly Uri _empty = new(\"https://json-everything.lib/\");\n\n\tprivate readonly Dictionary _registered = [];\n\n\t/// \n\t/// The global registry.\n\t/// \n\tpublic static DataRegistry Global { get; } = new();\n\n\t/// \n\t/// Gets or sets a method to enable automatic download of data by URI ID.\n\t/// \n\tpublic Func Fetch\n\t{\n\t\tget => field ??= _ => default;\n\t\tset;\n\t}\n\n\t/// \n\t/// Registers the specified JSON element with the given URI, replacing any existing element associated with that URI.\n\t/// \n\t/// If an element is already registered for the given URI, it will be overwritten.\n\t/// The URI to associate with the JSON element. Must be an absolute or relative URI; relative URIs are resolved to\n\t/// absolute form.\n\t/// The JSON element to register with the specified URI.\n\tpublic void Register(Uri uri, JsonElement element)\n\t{\n\t\turi = MakeAbsolute(uri);\n\t\t_registered[uri] = element;\n\t}\n\n\t/// \n\t/// Gets data by URI ID.\n\t/// \n\t/// The URI ID.\n\t/// \n\t/// The , if registered in either this or the global registry;\n\t/// otherwise null.\n\t/// \n\t// For URI equality see https://docs.microsoft.com/en-us/dotnet/api/system.uri.op_equality?view=netcore-3.1\n\t// tl;dr - URI equality doesn't consider fragments\n\tpublic JsonElement? Get(Uri uri)\n\t{\n\t\tvar resolved = _registered.GetValueOrDefault(uri);\n\n\t\tif (resolved.ValueKind == JsonValueKind.Undefined)\n\t\t\tresolved = Global._registered.GetValueOrDefault(uri);\n\n\t\tif (resolved.ValueKind == JsonValueKind.Undefined)\n\t\t\tresolved = Fetch(uri);\n\n\t\tif (resolved.ValueKind == JsonValueKind.Undefined)\n\t\t\treturn null;\n\n\t\treturn resolved;\n\t}\n\n\tprivate static Uri MakeAbsolute(Uri? uri)\n\t{\n\t\tif (uri == null) return _empty;\n\n\t\tif (uri.IsAbsoluteUri) return uri;\n\n\t\treturn _empty.Resolve(uri);\n\t}\n\n\t/// \n\t/// Provides a simple data fetch method that supports `http`, `https`, and `file` URI schemes.\n\t/// \n\t/// The URI to fetch.\n\t/// A JSON string representing the data\n\t/// \n\t/// Thrown when the URI scheme is not `http`, `https`, or `file`.\n\t/// \n\tpublic static JsonNode? SimpleDownload(Uri uri)\n\t{\n\t\tswitch (uri.Scheme)\n\t\t{\n\t\t\tcase \"http\":\n\t\t\tcase \"https\":\n\t\t\t\treturn new HttpClient().GetStringAsync(uri).Result;\n\t\t\tcase \"file\":\n\t\t\t\tvar filename = Uri.UnescapeDataString(uri.AbsolutePath);\n\t\t\t\treturn File.ReadAllText(filename);\n\t\t\tdefault:\n\t\t\t\tthrow new FormatException($\"URI scheme '{uri.Scheme}' is not supported. Only HTTP(S) and local file system URIs are allowed.\");\n\t\t}\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Net.Http;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.Data;\n\n/// \n/// Provides a registry for associ" + }, + { + "title": "src/JsonSchema.Data/DataRegistryExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/DataRegistryExtensions.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/DataRegistryExtensions.cs", + "startLine": 1, + "endLine": 39, + "content": "using System.Runtime.CompilerServices;\n\nnamespace Json.Schema.Data;\n\n/// \n/// Provides extension methods for associating a custom with \n/// instances.\n/// \n/// These methods enable attaching and retrieving a to a object without modifying its structure. This is useful for scenarios where build options need\n/// to be linked with specific data registries at runtime. The association is maintained using a weak reference, so it\n/// does not prevent garbage collection of the instance.\npublic static class DataRegistryExtensions\n{\n\tprivate static readonly ConditionalWeakTable _associations = new();\n\n\t/// \n\t/// Associates the specified data registry with the given build options instance.\n\t/// \n\t/// The build options instance to which the data registry will be attached. Cannot be null.\n\t/// The data registry to associate with the build options. Cannot be null.\n\tpublic static void SetDataRegistry(this BuildOptions options, DataRegistry registry)\n\t{\n\t\t_associations.Add(options, registry);\n\t}\n\n\t/// \n\t/// Retrieves the data registry associated with the specified build options.\n\t/// \n\t/// The build options for which to obtain the corresponding data registry.\n\t/// The data registry linked to the provided build options. If no specific registry is associated, returns the global\n\t/// data registry.\n\tpublic static DataRegistry GetDataRegistry(this BuildOptions options)\n\t{\n\t\tif (_associations.TryGetValue(options, out var value)) return value;\n\n\t\treturn DataRegistry.Global;\n\t}\n}", + "snippet": "using System.Runtime.CompilerServices;\n\nnamespace Json.Schema.Data;\n\n/// \n/// Provides extension methods for associating a custom with \n/// instances.\n/// \n/// Provides extension vocabulary definitions for the draft 2020-12 JSON Schema dialect, including support for the data\n/// vocabulary.\n/// \n/// This class exposes constants and dialect configurations related to the draft 2020-12 extension\n/// vocabulary. It is intended for use when working with JSON Schema implementations that require the data vocabulary\n/// extension. All members are static and thread-safe.\npublic static class Dialect\n{\n\t/// \n\t/// Provides the JSON Schema dialect definition for the 2020-12 draft with support for the 'data' and 'optionalData'\n\t/// keywords.\n\t/// \n\t/// This dialect enables usage of the 'data' and 'optionalData' keywords as defined in the 2020-12\n\t/// draft of the JSON Schema specification. Use this dialect when validating schemas that require these keywords. The\n\t/// dialect is configured with the appropriate meta-schema identifier and keyword support.\n\t// ReSharper disable once InconsistentNaming\n\tpublic static readonly Schema.Dialect Data_202012 =\n\t\tSchema.Dialect.Draft202012.With([\n\t\t\t\tDataKeyword.Instance,\n\t\t\t\tOptionalDataKeyword.Instance\n\t\t\t],\n\t\t\tMetaSchemas.Data_202012Id,\n\t\t\tfalse,\n\t\t\ttrue);\n}", + "snippet": "using Json.Schema.Data.Keywords;\n\nnamespace Json.Schema.Data;\n\n/// \n/// Provides extension vocabulary definitions for the draft 2020-12 JSON Schema dialect, including support for the data\n/// vocabulary.\n/// \n/// Provides a fluent interface for .\n/// \npublic static class JsonSchemaBuilderExtensions\n{\n\t/// \n\t/// Adds a `data` keyword.\n\t/// \n\t/// The builder.\n\t/// The collection of keywords and references.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Data(this JsonSchemaBuilder builder, IReadOnlyDictionary data)\n\t{\n\t\tbuilder.Add(\"data\", new JsonObject(data.ToDictionary(x => x.Key, x => (JsonNode?)x.Value)));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Adds a `data` keyword.\n\t/// \n\t/// The builder.\n\t/// The collection of keywords and references.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Data(this JsonSchemaBuilder builder, params (string name, string reference)[] data)\n\t{\n\t\tbuilder.Add(\"data\", new JsonObject(data.ToDictionary(x => x.name, x => (JsonNode?)x.reference)));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Adds a `data` keyword.\n\t/// \n\t/// The builder.\n\t/// The collection of keywords and references.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder OptionalData(this JsonSchemaBuilder builder, IReadOnlyDictionary data)\n\t{\n\t\tbuilder.Add(\"optionalData\", new JsonObject(data.ToDictionary(x => x.Key, x => (JsonNode?)x.Value)));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Adds a `data` keyword.\n\t/// \n\t/// The builder.\n\t/// The collection of keywords and references.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder OptionalData(this JsonSchemaBuilder builder, params (string name, string reference)[] data)\n\t{\n\t\tbuilder.Add(\"optionalData\", new JsonObject(data.ToDictionary(x => x.name, x => (JsonNode?)x.reference)));\n\t\treturn builder;\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.Data;\n\n/// \n/// Provides a fluent interface for .\n/// \npublic st" + }, + { + "title": "src/JsonSchema.Data/JsonSchemaDataSerializerContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/JsonSchemaDataSerializerContext.cs#L1-L10", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/JsonSchemaDataSerializerContext.cs", + "startLine": 1, + "endLine": 10, + "content": "using System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\n\nnamespace Json.Schema.Data;\n\n[JsonSerializable(typeof(Dictionary))]\n[JsonSerializable(typeof(IEnumerable))]\ninternal partial class JsonSchemaDataSerializerContext : JsonSerializerContext;", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\n\nnamespace Json.Schema.Data;\n\n[JsonSerializable(typeof(Dictionary))]\n[Jso" + }, + { + "title": "src/JsonSchema.Data/Keywords/DataKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/Keywords/DataKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/Keywords/DataKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Path;\nusing Json.Pointer;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Represents the `data` keyword.\n/// \npublic class DataKeyword : IKeywordHandler\n{\n\tinternal static readonly string[] CoreKeywords =\n\t[\n\t\t\"$anchor\",\n\t\t\"$comment\",\n\t\t\"$defs\",\n\t\t\"$dynamicAnchor\",\n\t\t\"$dynamicRef\",\n\t\t\"$id\",\n\t\t\"$recursiveAnchor\",\n\t\t\"$recursiveRef\",\n\t\t\"$ref\",\n\t\t\"$schema\",\n\t\t\"$vocabulary\"\n\t];\n\n\t/// \n\t/// Gets or sets the singleton instance of the DataKeyword class.\n\t/// \n\tpublic static DataKeyword Instance { get; set; } = new();\n\n\t/// \n\t/// The JSON name of the keyword.\n\t/// \n\tpublic string Name => \"data\";\n\n\tprivate DataKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}.\");\n\n\t\tvar spec = new DataSpec();\n\t\tforeach (var property in value.EnumerateObject())\n\t\t{\n\t\t\tif (CoreKeywords.Contains(property.Name))\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' property values cannot be core keywords, found {property.Value.ValueKind}.\");\n\n\t\t\tif (property.Value.ValueKind is not JsonValueKind.String)\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' property values must be strings, found {property.Value.ValueKind}.\");\n\n\t\t\tvar reference = property.Value.GetString()!;\n\t\t\tif (!reference.StartsWith(\"#\") && JsonPointer.TryParse(reference, out var pointer))\n\t\t\t\tspec.References[property.Name] = new JsonPointerIdentifier(pointer);\n\t\t\telse if (RelativeJsonPointer.TryParse(reference, out var relativePointer))\n\t\t\t\tspec.References[property.Name] = new RelativeJsonPointerIdentifier(relativePointer);\n\t\t\telse if (JsonPath.TryParse(reference, out var path))\n\t\t\t\tspec.References[property.Name] = new JsonPathIdentifier(path);\n\t\t\telse if (Uri.TryCreate(reference, UriKind.RelativeOrAbsolute, out var uri))\n\t\t\t\tspec.References[property.Name] = new UriIdentifier(uri);\n\t\t\telse\n\t\t\t\tthrow new JsonSchemaException($\"Could not determine reference format for '{property.Name}'.\");\n\t\t}\n\n\t\treturn spec;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar spec = (DataSpec)keyword.Value!;\n\t\tvar buildContext = BuildContext.From(keyword);\n\t\tvar unresolved = new List();\n\t\tforeach (var reference in spec.References)\n\t\t{\n\t\t\tJsonElement instance;\n\t\t\tif (reference.Value is UriIdentifier uriIdentifier)\n\t\t\t{\n\t\t\t\tvar uri = buildContext.BaseUri.Resolve(uriIdentifier.Target);\n\t\t\t\tinstance = buildContext.Options.GetDataRegistry().Get(uri) ??\n\t\t\t\t (buildContext.Options.SchemaRegistry.Get(uri) as JsonSchema)?.Root.Source ??\n\t\t\t\t default;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tinstance = context.InstanceRoot;\n\t\t\t}\n\n\t\t\tif (!reference.Value.TryResolve(instance, out var data))\n\t\t\t{\n\t\t\t\tunresolved.Add(reference.Value.ToString()!);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tspec.Data[reference.Key] = data;", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Path;\nusing Json.Pointer;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Represents the `data` keyword.\n/// " + }, + { + "title": "src/JsonSchema.Data/Keywords/DataKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/Keywords/DataKeyword.cs#L121-L142", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/Keywords/DataKeyword.cs", + "startLine": 121, + "endLine": 142, + "content": "}\n\n\t\tif (unresolved.Count != 0)\n\t\t\tthrow new DataRefResolutionException(unresolved);\n\n\t\tbuildContext.LocalSchema = JsonSerializer.SerializeToElement(spec.Data, JsonSchemaDataSerializerContext.Default.DictionaryStringJsonElement);\n\t\tvar subschema = JsonSchema.BuildNode(buildContext);\n\n\t\tvar newContext = context with\n\t\t{\n\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t};\n\n\t\tvar result = subschema.Evaluate(newContext);\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = result.IsValid,\n\t\t\tDetails = [result]\n\t\t};\n\t}\n}", + "snippet": "}\n\n\t\tif (unresolved.Count != 0)\n\t\t\tthrow new DataRefResolutionException(unresolved);\n\n\t\tbuildContext.LocalSchema = JsonSerializer.SerializeToElement(spec.Data, JsonSchemaDataSerializerContext.Default.DictionaryStringJson" + }, + { + "title": "src/JsonSchema.Data/Keywords/DataSpec.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/Keywords/DataSpec.cs#L1-L10", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/Keywords/DataSpec.cs", + "startLine": 1, + "endLine": 10, + "content": "using System.Collections.Generic;\nusing System.Text.Json;\n\nnamespace Json.Schema.Data.Keywords;\n\ninternal class DataSpec\n{\n\tpublic Dictionary References { get; } = new();\n\tpublic Dictionary Data { get; } = new();\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\n\nnamespace Json.Schema.Data.Keywords;\n\ninternal class DataSpec\n{\n\tpublic Dictionary References { get; } = new();\n\tpublic Dictiona" + }, + { + "title": "src/JsonSchema.Data/Keywords/IDataResourceIdentifier.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/Keywords/IDataResourceIdentifier.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/Keywords/IDataResourceIdentifier.cs", + "startLine": 1, + "endLine": 18, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Provides an abstraction for different resource identifier types.\n/// \npublic interface IDataResourceIdentifier\n{\n\t/// \n\t/// Attempts to resolve a value from the specified JSON element.\n\t/// \n\t/// The root to search for the desired value.\n\t/// When this method returns, contains the resolved if the operation succeeds; otherwise,\n\t/// contains the default value.\n\t/// true if the value was successfully resolved; otherwise, false.\n\tbool TryResolve(JsonElement root, out JsonElement value);\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Provides an abstraction for different resource identifier types.\n/// \npublic interface IDataResourceIdentifier\n{\n\t/// \n\t" + }, + { + "title": "src/JsonSchema.Data/Keywords/JsonPathIdentifier.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/Keywords/JsonPathIdentifier.cs#L1-L41", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/Keywords/JsonPathIdentifier.cs", + "startLine": 1, + "endLine": 41, + "content": "using System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Path;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Handles data references that are JSON Paths.\n/// \npublic class JsonPathIdentifier : IDataResourceIdentifier\n{\n\t/// \n\t/// Gets the JSON Path query.\n\t/// \n\tpublic JsonPath Query { get; }\n\n\t/// \n\t/// Creates a new .\n\t/// \n\t/// \n\tpublic JsonPathIdentifier(JsonPath query)\n\t{\n\t\tQuery = query;\n\t}\n\n\t/// \n\t/// Attempts to resolve a value from the specified JSON element.\n\t/// \n\t/// The root to search for the desired value.\n\t/// When this method returns, contains the resolved if the operation succeeds; otherwise,\n\t/// contains the default value.\n\t/// true if the value was successfully resolved; otherwise, false.\n\tpublic bool TryResolve(JsonElement root, out JsonElement value)\n\t{\n\t\tvar results = Query.Evaluate(root.AsNode());\n\n\t\tvalue = JsonSerializer.SerializeToElement(results.Matches.Select(x => x.Value), JsonSchemaDataSerializerContext.Default.IEnumerableJsonNode!);\n\t\treturn true;\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Path;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Handles data references that are JSON Paths.\n/// \npublic class JsonPathIdent" + }, + { + "title": "src/JsonSchema.Data/Keywords/JsonPointerIdentifier.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/Keywords/JsonPointerIdentifier.cs#L1-L53", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/Keywords/JsonPointerIdentifier.cs", + "startLine": 1, + "endLine": 53, + "content": "using System.Diagnostics.CodeAnalysis;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.Pointer;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Handles data references that are JSON Pointers.\n/// \npublic class JsonPointerIdentifier : IDataResourceIdentifier\n{\n\t/// \n\t/// The JSON Pointer target.\n\t/// \n\tpublic JsonPointer Target { get; }\n\n\t/// \n\t/// Creates a new instance of .\n\t/// \n\t/// The target.\n\tpublic JsonPointerIdentifier(JsonPointer target)\n\t{\n\t\tTarget = target;\n\t}\n\n\t/// \n\t/// Attempts to resolve a value from the specified JSON element.\n\t/// \n\t/// The root to search for the desired value.\n\t/// When this method returns, contains the resolved if the operation succeeds; otherwise,\n\t/// contains the default value.\n\t/// true if the value was successfully resolved; otherwise, false.\n\tpublic bool TryResolve(JsonElement root, out JsonElement value)\n\t{\n\t\tvar result = Target.Evaluate(root);\n\t\tif (result.HasValue)\n\t\t{\n\t\t\tvalue = result.Value;\n\t\t\treturn true;\n\t\t}\n\n\t\tvalue = default;\n\t\treturn false;\n\t}\n\n\t/// Returns a string that represents the current object.\n\t/// A string that represents the current object.\n\tpublic override string ToString()\n\t{\n\t\treturn Target.ToString();\n\t}\n}", + "snippet": "using System.Diagnostics.CodeAnalysis;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.Pointer;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Handles data references that are JSON Pointers.\n//" + }, + { + "title": "src/JsonSchema.Data/Keywords/OptionalDataKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/Keywords/OptionalDataKeyword.cs#L1-L118", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/Keywords/OptionalDataKeyword.cs", + "startLine": 1, + "endLine": 118, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Path;\nusing Json.Pointer;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Represents the `data` keyword.\n/// \npublic class OptionalDataKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets or sets the singleton instance of the class used for keyword operations.\n\t/// \n\tpublic static OptionalDataKeyword Instance { get; set; } = new();\n\n\t/// \n\t/// The JSON name of the keyword.\n\t/// \n\tpublic string Name => \"optionalData\";\n\n\tprivate OptionalDataKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}.\");\n\n\t\tvar spec = new DataSpec();\n\t\tforeach (var property in value.EnumerateObject())\n\t\t{\n\t\t\tif (DataKeyword.CoreKeywords.Contains(property.Name))\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' property values cannot be core keywords, found {property.Value.ValueKind}.\");\n\n\t\t\tif (property.Value.ValueKind is not JsonValueKind.String)\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' property values must be strings, found {property.Value.ValueKind}.\");\n\n\t\t\tvar reference = property.Value.GetString()!;\n\t\t\tif (JsonPointer.TryParse(reference, out var pointer))\n\t\t\t\tspec.References[property.Name] = new JsonPointerIdentifier(pointer);\n\t\t\telse if (RelativeJsonPointer.TryParse(reference, out var relativePointer))\n\t\t\t\tspec.References[property.Name] = new RelativeJsonPointerIdentifier(relativePointer);\n\t\t\telse if (JsonPath.TryParse(reference, out var path))\n\t\t\t\tspec.References[property.Name] = new JsonPathIdentifier(path);\n\t\t\telse if (Uri.TryCreate(reference, UriKind.RelativeOrAbsolute, out var uri))\n\t\t\t\tspec.References[property.Name] = new UriIdentifier(uri);\n\t\t\telse\n\t\t\t\tthrow new JsonSchemaException($\"Could not determine reference format for '{property.Name}'.\");\n\t\t}\n\n\t\treturn spec;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar spec = (DataSpec)keyword.Value!;\n\t\tvar buildContext = BuildContext.From(keyword);\n\t\tforeach (var reference in spec.References)\n\t\t{\n\t\t\tJsonElement instance;\n\t\t\tif (reference.Value is UriIdentifier uriIdentifier)\n\t\t\t{\n\t\t\t\tvar uri = buildContext.BaseUri.Resolve(uriIdentifier.Target);\n\t\t\t\tinstance = buildContext.Options.GetDataRegistry().Get(uri) ??\n\t\t\t\t (buildContext.Options.SchemaRegistry.Get(uri) as JsonSchema)?.Root.Source ??\n\t\t\t\t default;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tinstance = context.InstanceRoot;\n\t\t\t}\n\n\t\t\tif (!reference.Value.TryResolve(instance, out var data)) continue;\n\n\t\t\tspec.Data[reference.Key] = data;\n\t\t}\n\n\t\tbuildContext.LocalSchema = JsonSerializer.SerializeToElement(spec.Data, JsonSchemaDataSerializerContext.Default.DictionaryStringJsonElement);\n\t\tvar subschema = JsonSchema.BuildNode(buildContext);\n\n\t\tvar newContext = context with\n\t\t{\n\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t};\n\n\t\tvar result = subschema.Evaluate(newContext);\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = result.IsValid,\n\t\t\tDetails = [result]\n\t\t};\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Path;\nusing Json.Pointer;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Represents the `data` keyword.\n/// \npublic class OptionalDa" + }, + { + "title": "src/JsonSchema.Data/Keywords/RelativeJsonPointerIdentifier.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/Keywords/RelativeJsonPointerIdentifier.cs#L1-L44", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/Keywords/RelativeJsonPointerIdentifier.cs", + "startLine": 1, + "endLine": 44, + "content": "using System;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Handles data references that are Relative JSON Pointers.\n/// \npublic class RelativeJsonPointerIdentifier : IDataResourceIdentifier\n{\n\t/// \n\t/// The Relative JSON Pointer target.\n\t/// \n\tpublic RelativeJsonPointer Target { get; }\n\n\t/// \n\t/// Creates a new instance of .\n\t/// \n\t/// The target.\n\tpublic RelativeJsonPointerIdentifier(RelativeJsonPointer target)\n\t{\n\t\tTarget = target;\n\t}\n\n\t/// \n\t/// Attempts to resolve a value from the specified JSON element.\n\t/// \n\t/// The root to search for the desired value.\n\t/// When this method returns, contains the resolved if the operation succeeds; otherwise,\n\t/// contains the default value.\n\t/// true if the value was successfully resolved; otherwise, false.\n\tpublic bool TryResolve(JsonElement root, out JsonElement value)\n\t{\n\t\tthrow new NotImplementedException(\"Relative JSON Pointer support is unavailable\");\n\t}\n\n\t/// Returns a string that represents the current object.\n\t/// A string that represents the current object.\n\tpublic override string ToString()\n\t{\n\t\treturn Target.ToString();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Handles data references that are Relative JSON Pointers.\n/// \npublic class RelativeJsonPointerI" + }, + { + "title": "src/JsonSchema.Data/Keywords/UriIdentifier.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/Keywords/UriIdentifier.cs#L1-L59", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/Keywords/UriIdentifier.cs", + "startLine": 1, + "endLine": 59, + "content": "using System;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Handles data references that are URIs.\n/// \npublic class UriIdentifier : IDataResourceIdentifier\n{\n\tprivate static readonly Uri _base = new(\"https://json-everything.lib\");\n\n\t/// \n\t/// The URI target.\n\t/// \n\tpublic Uri Target { get; }\n\n\t/// \n\t/// Creates a new instance of .\n\t/// \n\t/// The target.\n\tpublic UriIdentifier(Uri target)\n\t{\n\t\tTarget = target;\n\t}\n\n\t/// \n\t/// Attempts to resolve a value from the specified JSON element.\n\t/// \n\t/// The root to search for the desired value.\n\t/// When this method returns, contains the resolved if the operation succeeds; otherwise,\n\t/// contains the default value.\n\t/// true if the value was successfully resolved; otherwise, false.\n\tpublic bool TryResolve(JsonElement root, out JsonElement value)\n\t{\n\t\tvalue = default;\n\t\tvar fragment = _base.Resolve(Target).Fragment;\n\t\tif (JsonPointer.TryParse(fragment, out var pointerFragment))\n\t\t{\n\t\t\tvalue = pointerFragment.Evaluate(root) ?? default;\n\t\t}\n\t\telse if (!string.IsNullOrWhiteSpace(fragment))\n\t\t{\n\t\t\tvalue = default;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn value.ValueKind != JsonValueKind.Undefined;\n\t}\n\n\t/// Returns a string that represents the current object.\n\t/// A string that represents the current object.\n\tpublic override string ToString()\n\t{\n\t\treturn Target.ToString();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Data.Keywords;\n\n/// \n/// Handles data references that are URIs.\n/// \npublic class UriIdentifier : IDataResourceIdentifie" + }, + { + "title": "src/JsonSchema.Data/MetaSchemas.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/MetaSchemas.cs#L1-L50", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/MetaSchemas.cs", + "startLine": 1, + "endLine": 50, + "content": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Text.Json;\n\nnamespace Json.Schema.Data;\n\n/// \n/// Provides access to the data extensions vocabulary meta-schema and methods for registering its components.\n/// \n/// Use this class to register and retrieve the meta-schema required for working with the data\n/// vocabulary in JSON Schema processing. All members are static and intended for application-wide\n/// configuration.\npublic static class MetaSchemas\n{\n\t/// \n\t/// The ID for the draft 2020-12 extension vocabulary which includes the data vocabulary.\n\t/// \n\t// ReSharper disable once InconsistentNaming\n\tpublic static readonly Uri Data_202012Id = new(\"https://json-everything.net/meta/data-2023\");\n\n\t/// \n\t/// The array extensions vocabulary meta-schema.\n\t/// \n\tpublic static JsonSchema Data { get; private set; } = null!;\n\n\t/// \n\t/// Registers the all components required to use the array extensions vocabulary.\n\t/// \n\tpublic static void Register(BuildOptions? buildOptions = null)\n\t{\n\t\tbuildOptions ??= BuildOptions.Default;\n\n\t\tbuildOptions.DialectRegistry.Register(Dialect.Data_202012);\n\t\tbuildOptions.VocabularyRegistry.Register(Vocabulary.Data);\n\n\t\tData = LoadMetaSchema(\"data-2023\", buildOptions);\n\t}\n\n\tprivate static JsonSchema LoadMetaSchema(string resourceName, BuildOptions buildOptions)\n\t{\n\t\tvar resourceStream = typeof(MetaSchemas).Assembly.GetManifestResourceStream(@$\"Json.Schema.Data.Meta_Schemas.{resourceName}.json\");\n\t\tusing var reader = new StreamReader(resourceStream!, Encoding.UTF8);\n\n\t\tvar text = reader.ReadToEnd();\n\t\tvar json = JsonDocument.Parse(text).RootElement;\n\n\t\treturn JsonSchema.Build(json, buildOptions);\n\t}\n}", + "snippet": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Text.Json;\n\nnamespace Json.Schema.Data;\n\n/// \n/// Provides access to the data extensions vocabulary meta-schema and methods for registering its comp" + }, + { + "title": "src/JsonSchema.Data/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Data/obj/Debug/net10.0/JsonSchema.Data.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Debug/net10.0/JsonSchema.Data.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Debug/net10.0/JsonSchema.Data.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide the \\\"data\\\" keyword\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Data/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Data/obj/Debug/net8.0/JsonSchema.Data.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Debug/net8.0/JsonSchema.Data.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Debug/net8.0/JsonSchema.Data.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide the \\\"data\\\" keyword\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Data/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Data/obj/Debug/net9.0/JsonSchema.Data.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Debug/net9.0/JsonSchema.Data.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Debug/net9.0/JsonSchema.Data.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide the \\\"data\\\" keyword\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Data/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.Data/obj/Debug/netstandard2.0/JsonSchema.Data.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Debug/netstandard2.0/JsonSchema.Data.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Debug/netstandard2.0/JsonSchema.Data.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide the \\\"data\\\" keyword\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Data/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Data/obj/Release/net10.0/JsonSchema.Data.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Release/net10.0/JsonSchema.Data.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Release/net10.0/JsonSchema.Data.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide the \\\"data\\\" keyword\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Data/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Data/obj/Release/net8.0/JsonSchema.Data.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Release/net8.0/JsonSchema.Data.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Release/net8.0/JsonSchema.Data.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide the \\\"data\\\" keyword\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Data/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Data/obj/Release/net9.0/JsonSchema.Data.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Release/net9.0/JsonSchema.Data.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Release/net9.0/JsonSchema.Data.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide the \\\"data\\\" keyword\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Data/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.Data/obj/Release/netstandard2.0/JsonSchema.Data.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/obj/Release/netstandard2.0/JsonSchema.Data.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/obj/Release/netstandard2.0/JsonSchema.Data.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide the \\\"data\\\" keyword\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Data\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Data/Vocabulary.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Data/Vocabulary.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Data/Vocabulary.cs", + "startLine": 1, + "endLine": 24, + "content": "using System;\nusing Json.Schema.Data.Keywords;\n\nnamespace Json.Schema.Data;\n\n/// \n/// Declares the vocabularies of the supported drafts.\n/// \npublic static class Vocabulary\n{\n\t/// \n\t/// The data vocabulary ID.\n\t/// \n\tpublic static readonly Uri DataId = new(\"https://docs.json-everything.net/schema/vocabs/data-2023\");\n\n\t/// \n\t/// The data vocabulary.\n\t/// \n\tpublic static readonly Schema.Vocabulary Data =\n\t\tnew(DataId,\n\t\t\tDataKeyword.Instance,\n\t\t\tOptionalDataKeyword.Instance);\n}", + "snippet": "using System;\nusing Json.Schema.Data.Keywords;\n\nnamespace Json.Schema.Data;\n\n/// \n/// Declares the vocabularies of the supported drafts.\n/// \npublic static class Vocabulary\n{\n\t/// \n\t/// The da" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/AllOfGenerationTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/AllOfGenerationTests.cs#L1-L96", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/AllOfGenerationTests.cs", + "startLine": 1, + "endLine": 96, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\ninternal class AllOfGenerationTests\n{\n\t[Test]\n\tpublic void AllOfWithMinAndMaxNumber()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Number),\n\t\t\t\tnew JsonSchemaBuilder().Minimum(10),\n\t\t\t\tnew JsonSchemaBuilder().Maximum(20)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void AllOfWithDifferentTypesFails()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Number),\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.String)\n\t\t\t);\n\n\t\tRunFailure(schema);\n\t}\n\n\t[Test]\n\tpublic void AllOfConflictingMinimaFails()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Integer).Minimum(100),\n\t\t\t\tnew JsonSchemaBuilder().Maximum(5)\n\t\t\t);\n\n\t\tRunFailure(schema);\n\t}\n\n\t[Test]\n\tpublic void AllOfWithTypeRangeAndMultiple()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Integer),\n\t\t\t\tnew JsonSchemaBuilder().Minimum(10),\n\t\t\t\tnew JsonSchemaBuilder().Maximum(100),\n\t\t\t\tnew JsonSchemaBuilder().MultipleOf(5)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void AllOfConflictingNestedObjectConstraintsFails()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Required(\"workflow\")\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Properties((\"workflow\", new JsonSchemaBuilder()\n\t\t\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t\t\t.Required(\"step\", \"retries\", \"title\")\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"step\", new JsonSchemaBuilder().Const(\"start\")),\n\t\t\t\t\t\t\t(\"retries\", new JsonSchemaBuilder().Minimum(10)),\n\t\t\t\t\t\t\t(\"title\", new JsonSchemaBuilder().Const(\"ALPHA\"))\n\t\t\t\t\t\t)\n\t\t\t\t\t)),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Properties((\"workflow\", new JsonSchemaBuilder()\n\t\t\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t\t\t.Required(\"step\", \"retries\", \"title\")\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"step\", new JsonSchemaBuilder().Const(\"finish\")),\n\t\t\t\t\t\t\t(\"retries\", new JsonSchemaBuilder().Maximum(2)),\n\t\t\t\t\t\t\t(\"title\", new JsonSchemaBuilder().Const(\"BETA\"))\n\t\t\t\t\t\t)\n\t\t\t\t\t))\n\t\t\t);\n\n\t\tRunFailure(schema);\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\ninternal class AllOfGenerationTests\n{\n\t[Test]\n\tpublic void AllOfWithMinAndMaxNumber()\n\t{\n\t\tv" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/AnyOfGenerationTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/AnyOfGenerationTests.cs#L1-L54", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/AnyOfGenerationTests.cs", + "startLine": 1, + "endLine": 54, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\ninternal class AnyOfGenerationTests\n{\n\t[Test]\n\tpublic void AnyOfWithDifferentTypes()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Number),\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.String)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void AnyOfWithImpossibleFirstItem()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Number)\n\t\t\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Type(SchemaValueType.Number)),\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.String)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void AnyOfAllBranchesImpossibleFails()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Number)\n\t\t\t\t\t.Not(new JsonSchemaBuilder().Type(SchemaValueType.Number)),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.Not(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t);\n\n\t\tRunFailure(schema);\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\ninternal class AnyOfGenerationTests\n{\n\t[Test]\n\tpublic void AnyOfWithDifferentTypes()\n\t{\n\t\tva" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/ArrayGenerationTests.cs (1/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/ArrayGenerationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/ArrayGenerationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class ArrayGenerationTests\n{\n\t[Test]\n\tpublic void GenerateArrayOfNumbers()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t.Minimum(10)\n\t\t\t\t.Maximum(20)\n\t\t\t\t.MultipleOf(2)\n\t\t\t)\n\t\t\t.MinItems(3)\n\t\t\t.MaxItems(10);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateArrayOfNumbersNoMax()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t.Minimum(10)\n\t\t\t\t.Maximum(20)\n\t\t\t\t.MultipleOf(2)\n\t\t\t)\n\t\t\t.MinItems(3);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateArrayOfNumbersWithAllOf()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Items(new JsonSchemaBuilder().MultipleOf(3)),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Items(new JsonSchemaBuilder().MultipleOf(2))\n\t\t\t)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t.Minimum(10)\n\t\t\t\t.Maximum(50)\n\t\t\t)\n\t\t\t.MinItems(3)\n\t\t\t.MaxItems(10);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateArrayOfNumbersWithAnyOf()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Items(new JsonSchemaBuilder().MultipleOf(3)),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Items(new JsonSchemaBuilder().MultipleOf(2))\n\t\t\t)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t.Minimum(10)\n\t\t\t\t.Maximum(50)\n\t\t\t)\n\t\t\t.MinItems(3)\n\t\t\t.MaxItems(10);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateArrayThatContains100()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t.Minimum(10)\n\t\t\t\t.Maximum(100)\n\t\t\t)\n\t\t\t.Contains(new JsonSchemaBuilder()\n\t\t\t\t.Minimum(100)\n\t\t\t)\n\t\t\t.MinItems(3)\n\t\t\t.MaxItems(10);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateArrayThatContainsAtLeastTwo100s()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t.Minimum(10)\n\t\t\t\t.Maximum(100)\n\t\t\t)", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class ArrayGenerationTests\n{\n\t[Test]\n\tpublic void GenerateArrayOfNumbers()\n\t{\n\t\tvar b" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/ArrayGenerationTests.cs (2/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/ArrayGenerationTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/ArrayGenerationTests.cs", + "startLine": 121, + "endLine": 240, + "content": ".Contains(new JsonSchemaBuilder()\n\t\t\t\t.Minimum(100)\n\t\t\t)\n\t\t\t.MinContains(2)\n\t\t\t.MinItems(3)\n\t\t\t.MaxItems(10);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateArrayThatContainsAtMostThree100s()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t.Minimum(10)\n\t\t\t\t.Maximum(100)\n\t\t\t)\n\t\t\t.Contains(new JsonSchemaBuilder()\n\t\t\t\t.Minimum(100)\n\t\t\t)\n\t\t\t.MaxContains(3)\n\t\t\t.MinItems(3)\n\t\t\t.MaxItems(10);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateArrayThatContainsBetweenTwoAndFive100s()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t.Minimum(10)\n\t\t\t\t.Maximum(100)\n\t\t\t)\n\t\t\t.Contains(new JsonSchemaBuilder()\n\t\t\t\t.Minimum(100)\n\t\t\t)\n\t\t\t.MinContains(2)\n\t\t\t.MaxContains(5)\n\t\t\t.MinItems(3)\n\t\t\t.MaxItems(20);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateArrayWhereMinContainsIsMoreThanMaxItems_Fails()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t.Minimum(10)\n\t\t\t\t.Maximum(100)\n\t\t\t)\n\t\t\t.Contains(new JsonSchemaBuilder()\n\t\t\t\t.Minimum(100)\n\t\t\t)\n\t\t\t.MinContains(20)\n\t\t\t.MinItems(3)\n\t\t\t.MaxItems(10);\n\n\t\tRunFailure(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateSequentialArray()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.PrefixItems(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Minimum(10)\n\t\t\t\t\t.Maximum(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.MinLength(10)\n\t\t\t\t\t.MaxLength(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t)\n\t\t\t.MinItems(3)\n\t\t\t.MaxItems(3);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateSequentialArrayPlusMore()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.PrefixItems(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Minimum(10)\n\t\t\t\t\t.Maximum(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.MinLength(10)\n\t\t\t\t\t.MaxLength(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t)\n\t\t\t.MinItems(5)\n\t\t\t.MaxItems(10);\n\n\t\tRun(schema);", + "snippet": ".Contains(new JsonSchemaBuilder()\n\t\t\t\t.Minimum(100)\n\t\t\t)\n\t\t\t.MinContains(2)\n\t\t\t.MinItems(3)\n\t\t\t.MaxItems(10);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateArrayThatContainsAtMostThree100s()\n\t{\n\t\tvar buildOptions = ne" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/ArrayGenerationTests.cs (3/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/ArrayGenerationTests.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/ArrayGenerationTests.cs", + "startLine": 241, + "endLine": 360, + "content": "}\n\n\t[Test]\n\tpublic void GenerateSequentialArrayPlusSpecifiedMore()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.PrefixItems(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Minimum(10)\n\t\t\t\t\t.Maximum(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.MinLength(10)\n\t\t\t\t\t.MaxLength(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t)\n\t\t\t.MinItems(5)\n\t\t\t.MaxItems(10)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t.Minimum(100)\n\t\t\t\t.Maximum(200)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateSequentialArrayWithFewerItems()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.PrefixItems(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Minimum(10)\n\t\t\t\t\t.Maximum(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.MinLength(10)\n\t\t\t\t\t.MaxLength(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t)\n\t\t\t.MaxItems(2);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateSequentialArrayPlusMoreAndContains()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.PrefixItems(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Minimum(10)\n\t\t\t\t\t.Maximum(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.MinLength(10)\n\t\t\t\t\t.MaxLength(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t)\n\t\t\t.MinItems(5)\n\t\t\t.MaxItems(10)\n\t\t\t.Contains(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t.Minimum(50)\n\t\t\t\t.Maximum(100)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateSequentialArrayWithNoMoreItems()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.PrefixItems(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Minimum(10)\n\t\t\t\t\t.Maximum(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.MinLength(10)\n\t\t\t\t\t.MaxLength(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t)\n\t\t\t.Items(false);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateSequentialArrayWithNoMoreItemsAndMinItems()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.PrefixItems(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Minimum(10)\n\t\t\t\t\t.Maximum(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.MinLength(10)", + "snippet": "}\n\n\t[Test]\n\tpublic void GenerateSequentialArrayPlusSpecifiedMore()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.A" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/ArrayGenerationTests.cs (4/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/ArrayGenerationTests.cs#L361-L436", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/ArrayGenerationTests.cs", + "startLine": 361, + "endLine": 436, + "content": ".MaxLength(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t)\n\t\t\t.MinItems(3)\n\t\t\t.Items(false);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateSequentialArrayWithNoMoreItemsAndMinItemsGreaterThanSequential()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.PrefixItems(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Minimum(10)\n\t\t\t\t\t.Maximum(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.MinLength(10)\n\t\t\t\t\t.MaxLength(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t)\n\t\t\t.MinItems(4)\n\t\t\t.Items(false);\n\n\t\tRunFailure(schema);\n\t}\n\n\t[Test]\n\tpublic void AllOfWithCompatibleSequentialItemsGenerates()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().PrefixItems(\n\t\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Integer).Minimum(10),\n\t\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.String).MinLength(3)\n\t\t\t\t),\n\t\t\t\tnew JsonSchemaBuilder().PrefixItems(\n\t\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Integer).Maximum(20).MultipleOf(2),\n\t\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.String).MaxLength(10)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.MinItems(2)\n\t\t\t.MaxItems(2);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void AllOfWithConflictingSequentialItemsFails()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().PrefixItems(\n\t\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Integer)\n\t\t\t\t),\n\t\t\t\tnew JsonSchemaBuilder().PrefixItems(\n\t\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.String)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.MinItems(1)\n\t\t\t.MaxItems(1);\n\n\t\tRunFailure(schema);\n\t}\n}", + "snippet": ".MaxLength(20),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t)\n\t\t\t.MinItems(3)\n\t\t\t.Items(false);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GenerateSequentialArrayWithNoMoreItemsAndMinItemsGreaterThan" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/ConditionalGenerationTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/ConditionalGenerationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/ConditionalGenerationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class ConditionalGenerationTests\n{\n\t[Test]\n\tpublic void IfThenElse()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.If(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.Then(new JsonSchemaBuilder().MultipleOf(3))\n\t\t\t.Else(new JsonSchemaBuilder().Type(SchemaValueType.String));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ThenElse()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t.Then(new JsonSchemaBuilder().MultipleOf(3))\n\t\t\t.Else(new JsonSchemaBuilder().Type(SchemaValueType.String));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void IfThen()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.If(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.Then(new JsonSchemaBuilder().MultipleOf(3));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void IfThen_WithGuaranteedIfCondition()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.If(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.Then(new JsonSchemaBuilder().MultipleOf(3));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void IfElse()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.If(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.Else(new JsonSchemaBuilder().Type(SchemaValueType.String));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ConstInConditional()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.If(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t.Then(new JsonSchemaBuilder().Const(\"foo\"))\n\t\t\t.Else(new JsonSchemaBuilder().Type(SchemaValueType.String));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void TypeInConditionalResult()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.If(new JsonSchemaBuilder().Required(\"foo\"))\n\t\t\t.Then(new JsonSchemaBuilder().Type(SchemaValueType.Object))\n\t\t\t.Else(true);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void TypeInConditionalResult2()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"people\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t\t(\"id\", new JsonSchemaBuilder().Const(\"uLqeBv\"))\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.Required(\"id\")\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t\t(\"id\", new JsonSchemaBuilder().Const(\"uLqeBv\")),\n\t\t\t\t\t\t\t\t(\"relationshipStatus\", new JsonSchemaBuilder().Const(\"married\"))\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.Required(\"id\", \"relationshipStatus\")\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Required(\"people\");\n\n\t\tRun(schema);", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class ConditionalGenerationTests\n{\n\t[Test]\n\tpublic void IfThenElse()\n\t{\n\t\tvar buildOp" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/ConditionalGenerationTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/ConditionalGenerationTests.cs#L121-L145", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/ConditionalGenerationTests.cs", + "startLine": 121, + "endLine": 145, + "content": "}\n\n\t[Test]\n\tpublic void AllOfWithMutuallyExclusiveConditionals()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"kind\", new JsonSchemaBuilder().Type(SchemaValueType.String).Enum(\"A\", \"B\")),\n\t\t\t\t(\"value\", new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t)\n\t\t\t.Required(\"kind\", \"value\")\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.If(new JsonSchemaBuilder().Properties((\"kind\", new JsonSchemaBuilder().Const(\"A\"))).Required(\"kind\"))\n\t\t\t\t\t.Then(new JsonSchemaBuilder().Properties((\"value\", new JsonSchemaBuilder().Const(1))).Required(\"value\")),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.If(new JsonSchemaBuilder().Properties((\"kind\", new JsonSchemaBuilder().Const(\"B\"))).Required(\"kind\"))\n\t\t\t\t\t.Then(new JsonSchemaBuilder().Properties((\"value\", new JsonSchemaBuilder().Const(2))).Required(\"value\"))\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n}", + "snippet": "}\n\n\t[Test]\n\tpublic void AllOfWithMutuallyExclusiveConditionals()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/ConstGenerationTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/ConstGenerationTests.cs#L1-L86", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/ConstGenerationTests.cs", + "startLine": 1, + "endLine": 86, + "content": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class ConstGenerationTests\n{\n\t[Test]\n\tpublic void ConstSchemaGeneratesItsValue()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Const(\"this is totally a random string\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void NotConstSchemaGeneratesAnythingButItsValue()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t.Const(\"anything but this value\"));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void AllOfWithSameConstValueGenerates()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().Const(\"same value\"),\n\t\t\t\tnew JsonSchemaBuilder().Const(\"same value\")\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void AllOfWithDifferentConstValuesFails()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().Const(\"value 1\"),\n\t\t\t\tnew JsonSchemaBuilder().Const(\"value 2\")\n\t\t\t);\n\n\t\tRunFailure(schema);\n\t}\n\n\t[Test]\n\tpublic void ConstNull()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Const((JsonNode?)null);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ConstBoolean()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Const(true);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ConstNumber()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Const(42);\n\n\t\tRun(schema);\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\nusing NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class ConstGenerationTests\n{\n\t[Test]\n\tpublic void Const" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/DevTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/DevTests.cs#L1-L21", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/DevTests.cs", + "startLine": 1, + "endLine": 21, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class DevTests\n{\n\t[Test]\n\tpublic void Test()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.Minimum(0)\n\t\t\t.Maximum(100)\n\t\t\t.Not(new JsonSchemaBuilder().MultipleOf(3));\n\n\t\tRun(schema);\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class DevTests\n{\n\t[Test]\n\tpublic void Test()\n\t{\n\t\tvar buildOptions = new BuildOptions" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/EnumGenerationTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/EnumGenerationTests.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/EnumGenerationTests.cs", + "startLine": 1, + "endLine": 38, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class EnumGenerationTests\n{\n\t[Test]\n\tpublic void EnumPicksAValue()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Enum(\"these\", \"are\", \"all\", \"the\", \"options\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void EnumSingleValue()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Enum(\"only\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void EnumMixedTypes()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Enum(1, \"two\", true, null);\n\n\t\tRun(schema);\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class EnumGenerationTests\n{\n\t[Test]\n\tpublic void EnumPicksAValue()\n\t{\n\t\tvar buildOpti" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/GithubTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/GithubTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/GithubTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Text.Json;\nusing Json.Schema.Tests;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\ninternal class GithubTests\n{\n\t[Test]\n\tpublic void Issue384_NodeAlreadyHasParent()\n\t{\n\t\tvar schemaText = @\"\n {\n \"\"$schema\"\": \"\"https://json-schema.org/draft/2020-12/schema\"\",\n \"\"title\"\": \"\"Product\"\",\n \"\"description\"\": \"\"A product from Acme's catalog\"\",\n \"\"type\"\": \"\"object\"\",\n \"\"properties\"\": {\n \"\"productId\"\": {\n \"\"description\"\": \"\"The unique identifier for a product\"\",\n \"\"type\"\": \"\"integer\"\",\n \"\"default\"\": 3\n },\n \"\"productName\"\": {\n \"\"description\"\": \"\"Name of the product\"\",\n \"\"type\"\": \"\"string\"\"\n },\n \"\"price\"\": {\n \"\"description\"\": \"\"The price of the product\"\",\n \"\"type\"\": \"\"number\"\",\n \"\"exclusiveMinimum\"\": 0\n },\n \"\"propNotRequired\"\": {\n \"\"description\"\": \"\"This is not required\"\",\n \"\"type\"\": \"\"number\"\"\n },\n \"\"enumPropertyHappy\"\": {\n \"\"description\"\": \"\"Happy enum\"\",\n \"\"type\"\": \"\"number\"\",\n \"\"enum\"\": [3,5,1]\n }\n },\n \"\"required\"\": [ \"\"productId\"\", \"\"productName\"\", \"\"price\"\" ],\n \"\"additionalProperties\"\" : true\n }\n \";\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = JsonSchema.FromText(schemaText, buildOptions);\n\n\t\t// This is intermittent, but 10 times seems to be enough to cause this to fail.\n\t\tfor (int i = 0; i < 10; i++)\n\t\t{\n\t\t\tvar generationResult = schema.GenerateData();\n\t\t\tvar sampleData = generationResult.Result;\n\n\t\t\tTestConsole.WriteLine(\"Generated data result: \" + sampleData);\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(generationResult, TestRunner.SerializerOptions));\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void Issue646_EitherPropertyButNotBoth_WithNot()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.OneOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"A\", new JsonSchemaBuilder()),\n\t\t\t\t\t\t(\"B\", new JsonSchemaBuilder().Not(new JsonSchemaBuilder()))\n\t\t\t\t\t),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"A\", new JsonSchemaBuilder().Not(new JsonSchemaBuilder())),\n\t\t\t\t\t\t(\"B\", new JsonSchemaBuilder())\n\t\t\t\t\t)\n\t\t\t)\n\t\t\t.Build();\n\n\t\tvar generationResult = schema.GenerateData();\n\t\tvar resultElt = JsonSerializer.SerializeToElement(generationResult.Result, TestRunner.SerializerOptions);\n\t\tTestConsole.WriteLine(resultElt.GetRawText());\n\n\t\tvar result = schema.Evaluate(resultElt);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void Issue646_EitherPropertyButNotBoth_WithFalse()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.OneOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"A\", new JsonSchemaBuilder()),\n\t\t\t\t\t\t(\"B\", false)\n\t\t\t\t\t),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"A\", false),\n\t\t\t\t\t\t(\"B\", new JsonSchemaBuilder())\n\t\t\t\t\t)\n\t\t\t)\n\t\t\t.Build();\n\n\t\tvar generationResult = schema.GenerateData();\n\t\tvar resultElt = JsonSerializer.SerializeToElement(generationResult.Result, TestRunner.SerializerOptions);\n\t\tTestConsole.WriteLine(resultElt.GetRawText());\n\n\t\tvar result = schema.Evaluate(resultElt);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]", + "snippet": "using System.Text.Json;\nusing Json.Schema.Tests;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\ninternal class GithubTests\n{\n\t[Test]\n\tpublic void Issue384_NodeAlreadyHasParent()\n\t" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/GithubTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/GithubTests.cs#L121-L201", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/GithubTests.cs", + "startLine": 121, + "endLine": 201, + "content": "public void Issue646_EitherPropertyButNotBoth_WithIntegerAndFalse()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.OneOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"A\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t\t\t(\"B\", false)\n\t\t\t\t\t),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"A\", false),\n\t\t\t\t\t\t(\"B\", new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t\t\t)\n\t\t\t)\n\t\t\t.Build();\n\n\t\tvar generationResult = schema.GenerateData();\n\t\tvar resultElt = JsonSerializer.SerializeToElement(generationResult.Result, TestRunner.SerializerOptions);\n\t\tTestConsole.WriteLine(resultElt.GetRawText());\n\n\t\tvar result = schema.Evaluate(resultElt);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void Issue646_PropertyWithFalse()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"A\", new JsonSchemaBuilder()),\n\t\t\t\t(\"B\", false)\n\t\t\t)\n\t\t\t.MinProperties(4)\n\t\t\t.Build();\n\n\t\tvar generationResult = schema.GenerateData();\n\t\tvar resultElt = JsonSerializer.SerializeToElement(generationResult.Result, TestRunner.SerializerOptions);\n\t\tTestConsole.WriteLine(resultElt.GetRawText());\n\n\t\tvar result = schema.Evaluate(resultElt);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void Issue647_EitherPropertyButNotBoth_WithUnevaluatedProperties()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.OneOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"A\", new JsonSchemaBuilder()),\n\t\t\t\t\t\t(\"B\", false)\n\t\t\t\t\t),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"A\", false),\n\t\t\t\t\t\t(\"B\", new JsonSchemaBuilder())\n\t\t\t\t\t)\n\t\t\t)\n\t\t\t.UnevaluatedProperties(false)\n\t\t\t.Build();\n\n\t\tvar generationResult = schema.GenerateData();\n\t\tvar resultElt = JsonSerializer.SerializeToElement(generationResult.Result, TestRunner.SerializerOptions);\n\t\tTestConsole.WriteLine(resultElt.GetRawText());\n\n\t\tvar result = schema.Evaluate(resultElt);\n\n\t\tresult.AssertValid();\n\t}\n}", + "snippet": "public void Issue646_EitherPropertyButNotBoth_WithIntegerAndFalse()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft2020" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/IntegerGenerationTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/IntegerGenerationTests.cs#L1-L74", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/IntegerGenerationTests.cs", + "startLine": 1, + "endLine": 74, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class IntegerGenerationTests\n{\n\t[Test]\n\tpublic void GenerateInteger()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Integer);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void Minimum()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Minimum(10);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void Maximum()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Maximum(20);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void MultipleOf()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.MultipleOf(20);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void DecimalMultipleOf()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.MultipleOf(0.84m);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void MultipleOfAndNotMultipleOf()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.MultipleOf(3)\n\t\t\t.Not(new JsonSchemaBuilder().MultipleOf(6));\n\n\t\tRun(schema);\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class IntegerGenerationTests\n{\n\t[Test]\n\tpublic void GenerateInteger()\n\t{\n\t\tvar buildO" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/NotGenerationTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/NotGenerationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/NotGenerationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class NotGenerationTests\n{\n\t[Test]\n\tpublic void NotAnObject()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Not(new JsonSchemaBuilder().Type(SchemaValueType.Object));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void DefinitelyAString()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Object |\n\t\t\t\t\t SchemaValueType.Array |\n\t\t\t\t\t SchemaValueType.Integer |\n\t\t\t\t\t SchemaValueType.Number |\n\t\t\t\t\t SchemaValueType.Null |\n\t\t\t\t\t SchemaValueType.Boolean)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void NotInRange()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t.Minimum(100)\n\t\t\t\t.Maximum(500)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void NumberNotInSubrange()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Minimum(0)\n\t\t\t.Maximum(1000)\n\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t.Minimum(100)\n\t\t\t\t.Maximum(500)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t// TODO: verify that array generation is checking bound type for min/max items (and props, too)\n\t[Test]\n\tpublic void ItemCountNotInRange()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.MaxItems(20)\n\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t.MinItems(5)\n\t\t\t\t.MaxItems(10)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ItemsAreNotString()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.MinItems(1)\n\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\t[Ignore(\"flaky, not sure why\")]\n\tpublic void DoesNotContainString()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t.Contains(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ContainsAtLeastOneNonstring()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Contains(new JsonSchemaBuilder()\n\t\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t)\n\t\t\t);", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class NotGenerationTests\n{\n\t[Test]\n\tpublic void NotAnObject()\n\t{\n\t\tvar buildOptions =" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/NotGenerationTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/NotGenerationTests.cs#L121-L182", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/NotGenerationTests.cs", + "startLine": 121, + "endLine": 182, + "content": "Run(schema);\n\t}\n\n\t[Test]\n\t[Ignore(\"flaky, not sure why\")]\n\tpublic void DoesNotContainStringOrNull()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Contains(new JsonSchemaBuilder().Type(SchemaValueType.String)\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Contains(new JsonSchemaBuilder().Type(SchemaValueType.Null)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void AnObjectThatDoesNotContainAFooPropertyWithoutSpecifyingType()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Not(new JsonSchemaBuilder().Required(\"foo\"));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void StringNotInLengthRange()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t.MinLength(10)\n\t\t\t\t.MaxLength(20)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void StringNotMatchingFormat()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Not(new JsonSchemaBuilder().Format(Formats.Date));\n\n\t\tRun(schema);\n\t}\n}", + "snippet": "Run(schema);\n\t}\n\n\t[Test]\n\t[Ignore(\"flaky, not sure why\")]\n\tpublic void DoesNotContainStringOrNull()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOp" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/NullGenerationTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/NullGenerationTests.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/NullGenerationTests.cs", + "startLine": 1, + "endLine": 18, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class NullGenerationTests\n{\n\t[Test]\n\tpublic void GenerateNull()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Null);\n\n\t\tRun(schema);\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class NullGenerationTests\n{\n\t[Test]\n\tpublic void GenerateNull()\n\t{\n\t\tvar buildOptions" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/NumberGenerationTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/NumberGenerationTests.cs#L1-L114", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/NumberGenerationTests.cs", + "startLine": 1, + "endLine": 114, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class NumberGenerationTests\n{\n\t[Test]\n\tpublic void GenerateNumber()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Number);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void Minimum()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.Minimum(0.2m);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ExclusiveMinimum()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.ExclusiveMinimum(0.2m);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void Maximum()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.Maximum(0.8m);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ExclusiveMaximum()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.ExclusiveMaximum(0.8m);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void MultipleOf()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.MultipleOf(0.3m);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void NotMultipleOf()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.Not(new JsonSchemaBuilder().MultipleOf(0.6m));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void MultipleOfAndNotMultipleOf()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.MultipleOf(0.3m)\n\t\t\t.Not(new JsonSchemaBuilder().MultipleOf(0.6m));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\t[Ignore(\"flaky\")]\n\tpublic void MultipleOfWithRange()\n\t{\n\t\t// This test highlights an issue with the number generation:\n\t\t// Periodically, the rounding can cause the generation to be\n\t\t// out of the range. Generation is tried 5 times per range.\n\t\t// If it fails all 5 times, this test will fail.\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.Minimum(10)\n\t\t\t.Maximum(20)\n\t\t\t.MultipleOf(2.3m);\n\n\t\tRun(schema);\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class NumberGenerationTests\n{\n\t[Test]\n\tpublic void GenerateNumber()\n\t{\n\t\tvar buildOpt" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/NumberRangeSetTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/NumberRangeSetTests.cs#L1-L117", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/NumberRangeSetTests.cs", + "startLine": 1, + "endLine": 117, + "content": "using FluentAssertions;\nusing NUnit.Framework;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class NumberRangeSetTests\n{\n\t[Test]\n\tpublic void DualIntersection()\n\t{\n\t\tvar a = new NumberRangeSet(\n\t\t[\n\t\t\tnew NumberRange(-100, -10),\n\t\t\tnew NumberRange(10, 100)\n\t\t]);\n\t\tvar b = new NumberRangeSet(new NumberRange(-20, 20));\n\t\tvar expected = new NumberRangeSet(\n\t\t[\n\t\t\tnew NumberRange(-20, -10),\n\t\t\tnew NumberRange(10, 20)\n\t\t]);\n\n\t\tvar result = a * b;\n\n\t\tresult.Should().BeEquivalentTo(expected);\n\t}\n\n\t[Test]\n\tpublic void DualIntersectionTheOtherWay()\n\t{\n\t\tvar a = new NumberRangeSet(\n\t\t[\n\t\t\tnew NumberRange(-100, -10),\n\t\t\tnew NumberRange(10, 100)\n\t\t]);\n\t\tvar b = new NumberRangeSet(new NumberRange(-20, 20));\n\t\tvar expected = new NumberRangeSet(\n\t\t[\n\t\t\tnew NumberRange(-20, -10),\n\t\t\tnew NumberRange(10, 20)\n\t\t]);\n\n\t\tvar result = b * a;\n\n\t\tresult.Should().BeEquivalentTo(expected);\n\t}\n\n\t[Test]\n\tpublic void UnionOfDisjointRanges()\n\t{\n\t\tvar a = new NumberRangeSet(new NumberRange(1, 5));\n\t\tvar b = new NumberRangeSet(new NumberRange(10, 20));\n\n\t\tvar result = a + b;\n\n\t\tAssert.That(result.Ranges, Has.Count.EqualTo(2));\n\t\tAssert.That(result.Ranges[0], Is.EqualTo(new NumberRange(1, 5)));\n\t\tAssert.That(result.Ranges[1], Is.EqualTo(new NumberRange(10, 20)));\n\t}\n\n\t[Test]\n\tpublic void SubtractProducesCorrectDifference()\n\t{\n\t\tvar a = new NumberRangeSet(new NumberRange(0, 100));\n\t\tvar b = new NumberRangeSet(new NumberRange(40, 60));\n\n\t\tvar result = a - b;\n\n\t\tAssert.That(result.Ranges, Has.Count.EqualTo(2));\n\t\tAssert.That(result.Ranges[0].Minimum.Value, Is.EqualTo(0));\n\t\tAssert.That(result.Ranges[1].Maximum.Value, Is.EqualTo(100));\n\t}\n\n\t[Test]\n\tpublic void IntersectionOfDisjointRangesIsEmpty()\n\t{\n\t\tvar a = new NumberRangeSet(new NumberRange(1, 5));\n\t\tvar b = new NumberRangeSet(new NumberRange(10, 20));\n\n\t\tvar result = a * b;\n\n\t\tAssert.That(result.Ranges, Is.Empty);\n\t}\n\n\t[Test]\n\tpublic void GetComplementInvertsRange()\n\t{\n\t\tvar a = new NumberRangeSet(new NumberRange(0, 1000000m));\n\n\t\tvar complement = a.GetComplement();\n\n\t\tAssert.That(complement.Ranges, Has.Count.GreaterThanOrEqualTo(1));\n\t\tAssert.That(complement.Ranges[0].Maximum.Value, Is.LessThanOrEqualTo(0));\n\t}\n\n\t[Test]\n\tpublic void FloorCapsMinimum()\n\t{\n\t\tvar a = NumberRangeSet.Full;\n\n\t\tvar result = a.Floor(5);\n\n\t\tAssert.That(result.Ranges, Has.Count.EqualTo(1));\n\t\tAssert.That(result.Ranges[0].Minimum.Value, Is.EqualTo(5));\n\t}\n\n\t[Test]\n\tpublic void CeilingCapsMaximum()\n\t{\n\t\tvar a = NumberRangeSet.Full;\n\n\t\tvar result = a.Ceiling(50);\n\n\t\tAssert.That(result.Ranges, Has.Count.EqualTo(1));\n\t\tAssert.That(result.Ranges[0].Maximum.Value, Is.EqualTo(50));\n\t}\n}", + "snippet": "using FluentAssertions;\nusing NUnit.Framework;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class NumberRangeSetTests\n{\n\t[Test]\n\tpublic void DualIntersection()\n\t{\n\t\tvar a = new NumberRangeSet(\n\t\t[\n\t\t\tnew NumberRa" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/NumberRangeTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/NumberRangeTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/NumberRangeTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing FluentAssertions;\nusing NUnit.Framework;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class NumberRangeTests\n{\n\tpublic static IEnumerable UnionCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(0, 1),\n\t\t\t\tnew NumberRange(2, 3),\n\t\t\t\tnew[] { new NumberRange(0, 1), new NumberRange(2, 3) }\n\t\t\t)\n\t\t\t{ TestName = \"Disjoint, A first\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(2, 3),\n\t\t\t\tnew NumberRange(0, 1),\n\t\t\t\tnew[] { new NumberRange(0, 1), new NumberRange(2, 3) }\n\t\t\t)\n\t\t\t{ TestName = \"Disjoint, B first\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(0, 2),\n\t\t\t\tnew NumberRange(1, 3),\n\t\t\t\tnew[] { new NumberRange(0, 3) }\n\t\t\t)\n\t\t\t{ TestName = \"Overlap, A first\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, 3),\n\t\t\t\tnew NumberRange(0, 2),\n\t\t\t\tnew[] { new NumberRange(0, 3) }\n\t\t\t)\n\t\t\t{ TestName = \"Overlap, B first\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(0, 3),\n\t\t\t\tnew NumberRange(1, 2),\n\t\t\t\tnew[] { new NumberRange(0, 3) }\n\t\t\t)\n\t\t\t{ TestName = \"Contained, A is outer\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, 2),\n\t\t\t\tnew NumberRange(0, 3),\n\t\t\t\tnew[] { new NumberRange(0, 3) }\n\t\t\t)\n\t\t\t{ TestName = \"Contained, A is inner\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, (2, false)),\n\t\t\t\tnew NumberRange((2, false), 3),\n\t\t\t\tnew[] { new NumberRange(1, (2, false)), new NumberRange((2, false), 3) }\n\t\t\t)\n\t\t\t{ TestName = \"Tangent, A ends exclusive, b starts exclusive\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, 2),\n\t\t\t\tnew NumberRange((2, false), 3),\n\t\t\t\tnew[] { new NumberRange(1, 3) }\n\t\t\t)\n\t\t\t{ TestName = \"Tangent, A ends inclusive, b starts exclusive\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, (2, false)),\n\t\t\t\tnew NumberRange(2, 3),\n\t\t\t\tnew[] { new NumberRange(1, 3) }\n\t\t\t)\n\t\t\t{ TestName = \"Tangent, A ends exclusive, b starts inclusive\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, 2),\n\t\t\t\tnew NumberRange(2, 3),\n\t\t\t\tnew[] { new NumberRange(1, 3) }\n\t\t\t)\n\t\t\t{ TestName = \"Tangent, A ends inclusive, b starts inclusive\" };\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(UnionCases))]\n\tpublic void Union(NumberRange a, NumberRange b, IEnumerable expected)\n\t{\n\t\tvar result = NumberRange.Union(a, b);\n\n\t\tresult.Should().BeEquivalentTo(expected);\n\t}\n\n\tpublic static IEnumerable IntersectionCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(0, 1),\n\t\t\t\tnew NumberRange(2, 3),\n\t\t\t\tnew NumberRange[] { }\n\t\t\t)\n\t\t\t{ TestName = \"Disjoint, A first\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(2, 3),\n\t\t\t\tnew NumberRange(0, 1),\n\t\t\t\tnew NumberRange[] { }\n\t\t\t)\n\t\t\t{ TestName = \"Disjoint, B first\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(0, 2),\n\t\t\t\tnew NumberRange(1, 3),\n\t\t\t\tnew[] { new NumberRange(1, 2) }\n\t\t\t)\n\t\t\t{ TestName = \"Overlap, A first\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, 3),\n\t\t\t\tnew NumberRange(0, 2),\n\t\t\t\tnew[] { new NumberRange(1, 2) }\n\t\t\t)\n\t\t\t{ TestName = \"Overlap, B first\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(0, 3),\n\t\t\t\tnew NumberRange(1, 2),\n\t\t\t\tnew[] { new NumberRange(1, 2) }\n\t\t\t)\n\t\t\t{ TestName = \"Contained, A is outer\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, 2),\n\t\t\t\tnew NumberRange(0, 3),", + "snippet": "using System.Collections.Generic;\nusing FluentAssertions;\nusing NUnit.Framework;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class NumberRangeTests\n{\n\tpublic static IEnumerable UnionCases\n\t{\n\t\tget\n" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/NumberRangeTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/NumberRangeTests.cs#L121-L158", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/NumberRangeTests.cs", + "startLine": 121, + "endLine": 158, + "content": "new[] { new NumberRange(1, 2) }\n\t\t\t)\n\t\t\t{ TestName = \"Contained, A is inner\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, (2, false)),\n\t\t\t\tnew NumberRange((2, false), 3),\n\t\t\t\tnew NumberRange[] { }\n\t\t\t)\n\t\t\t{ TestName = \"Tangent, A ends exclusive, b starts exclusive\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, 2),\n\t\t\t\tnew NumberRange((2, false), 3),\n\t\t\t\tnew NumberRange[] { }\n\t\t\t)\n\t\t\t{ TestName = \"Tangent, A ends inclusive, b starts exclusive\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, (2, false)),\n\t\t\t\tnew NumberRange(2, 3),\n\t\t\t\tnew NumberRange[] { }\n\t\t\t)\n\t\t\t{ TestName = \"Tangent, A ends exclusive, b starts inclusive\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, 2),\n\t\t\t\tnew NumberRange(2, 3),\n\t\t\t\tnew[] { new NumberRange(2, 2) }\n\t\t\t)\n\t\t\t{ TestName = \"Tangent, A ends inclusive, b starts inclusive\" };\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(IntersectionCases))]\n\tpublic void Intersection(NumberRange a, NumberRange b, IEnumerable expected)\n\t{\n\t\tvar result = NumberRange.Intersection(a, b);\n\n\t\tresult.Should().BeEquivalentTo(expected);\n\t}\n}", + "snippet": "new[] { new NumberRange(1, 2) }\n\t\t\t)\n\t\t\t{ TestName = \"Contained, A is inner\" };\n\t\t\tyield return new TestCaseData(\n\t\t\t\tnew NumberRange(1, (2, false)),\n\t\t\t\tnew NumberRange((2, false), 3),\n\t\t\t\tnew NumberRange[] { }\n\t\t\t)\n\t\t\t" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net10.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Debug/net10.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net10.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Debug/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETFramework,Version=v4.8.1\", FrameworkDisplayName = \".NET Framework 4.8.1\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETFramework,Version=v4.8.1\", FrameworkDisplayName = \".NET Framework 4.8.1\")]" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net481/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Debug/net481/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net481/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net8.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Debug/net8.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net8.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net9.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Debug/net9.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Debug/net9.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Release/net10.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Release/net10.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Release/net10.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Release/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Release/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Release/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETFramework,Version=v4.8.1\", FrameworkDisplayName = \".NET Framework 4.8.1\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETFramework,Version=v4.8.1\", FrameworkDisplayName = \".NET Framework 4.8.1\")]" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Release/net481/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Release/net481/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Release/net481/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Release/net8.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Release/net8.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Release/net8.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/obj/Release/net9.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/obj/Release/net9.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/obj/Release/net9.0/JsonSchema.DataGeneration.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.DataGeneration.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/ObjectGenerationTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/ObjectGenerationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/ObjectGenerationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class ObjectGenerationTests\n{\n\t[Test]\n\tpublic void GeneratesSingleProperty()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", true)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void GeneratesMultipleProperties()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", true),\n\t\t\t\t(\"bar\", new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void AdditionalPropertiesFalse()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", true),\n\t\t\t\t(\"bar\", new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t)\n\t\t\t.AdditionalProperties(false);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void RequiredPropertyNotListedInProperties()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", true),\n\t\t\t\t(\"bar\", new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t)\n\t\t\t.Required(\"baz\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void DefineThreePickTwo()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", true),\n\t\t\t\t(\"bar\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"baz\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.MaxProperties(2);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void DefineThreePickTwoButMustContainBaz()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", true),\n\t\t\t\t(\"bar\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"baz\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Required(\"baz\")\n\t\t\t.MaxProperties(2);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void MinProperties()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.MinProperties(3);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void MinAndMaxProperties()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.MinProperties(2)\n\t\t\t.MaxProperties(4);\n\n\t\tRun(schema);\n\t}", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class ObjectGenerationTests\n{\n\t[Test]\n\tpublic void GeneratesSingleProperty()\n\t{\n\t\tvar" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/ObjectGenerationTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/ObjectGenerationTests.cs#L121-L233", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/ObjectGenerationTests.cs", + "startLine": 121, + "endLine": 233, + "content": "[Test]\n\tpublic void AdditionalPropertiesWithSchema()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"id\", new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t)\n\t\t\t.AdditionalProperties(new JsonSchemaBuilder().Type(SchemaValueType.String));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void PropertyWithPatternConstraint()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"name\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.Pattern(@\"^[A-Z][a-z]+$\")\n\t\t\t\t\t.MinLength(2)\n\t\t\t\t\t.MaxLength(20))\n\t\t\t)\n\t\t\t.Required(\"name\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void MinPropertiesExceedsMaxPropertiesFails()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.MinProperties(3)\n\t\t\t.MaxProperties(1);\n\n\t\tRunFailure(schema);\n\t}\n\n\t[Test]\n\tpublic void PropertyNamesPatternForGeneratedProperties()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.MinProperties(3)\n\t\t\t.MaxProperties(5)\n\t\t\t.PropertyNames(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t.Pattern(\"^[a-z]{3,8}$\")\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void PropertyNamesLengthForGeneratedProperties()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.MinProperties(2)\n\t\t\t.MaxProperties(4)\n\t\t\t.PropertyNames(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t.MinLength(4)\n\t\t\t\t.MaxLength(6)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void RequiredNameViolatesPropertyNamesFails()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"A\", true)\n\t\t\t)\n\t\t\t.Required(\"A\")\n\t\t\t.PropertyNames(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t.Pattern(\"^[a-z]+$\")\n\t\t\t);\n\n\t\tRunFailure(schema);\n\t}\n\n\t[Test]\n\tpublic void PropertyNamesFromEnum()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.MinProperties(2)\n\t\t\t.MaxProperties(2)\n\t\t\t.PropertyNames(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t.Enum(\"alpha\", \"beta\")\n\t\t\t)\n\t\t\t.AdditionalProperties(true);\n\n\t\tRun(schema);\n\t}\n}", + "snippet": "[Test]\n\tpublic void AdditionalPropertiesWithSchema()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/OneOfGenerationTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/OneOfGenerationTests.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/OneOfGenerationTests.cs", + "startLine": 1, + "endLine": 39, + "content": "using NUnit.Framework;\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\ninternal class OneOfGenerationTests\n{\n\t[Test]\n\tpublic void OneOfWithDifferentTypesButOneTypeIsDuplicatedForcingTheOther()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.OneOf(\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Integer),\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Integer),\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.String)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void OneOfWithMultipleOfCannotBeMultipleOfBoth()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.OneOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.MultipleOf(2),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.MultipleOf(3)\n\t\t\t)\n\t\t\t.Minimum(0)\n\t\t\t.Maximum(50);\n\n\t\tRun(schema);\n\t}\n}", + "snippet": "using NUnit.Framework;\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\ninternal class OneOfGenerationTests\n{\n\t[Test]\n\tpublic void OneOfWithDifferentTypesButOneTypeI" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/RefTests.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/RefTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/RefTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\ninternal class RefTests\n{\n\t[Test]\n\tpublic void PointerRef()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = JsonSchema.FromText(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"type\": \"array\",\n\t\t\t \"items\": { \"$ref\": \"#/$defs/positiveInteger\" },\n\t\t\t \"$defs\": {\n\t\t\t \"positiveInteger\": {\n\t\t\t \"type\": \"integer\",\n\t\t\t \"exclusiveMinimum\": 0\n\t\t\t }\n\t\t\t },\n\t\t\t \"minItems\": 2\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void AnchorRef()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = JsonSchema.FromText(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"type\": \"array\",\n\t\t\t \"items\": { \"$ref\": \"#positiveInteger\" },\n\t\t\t \"$defs\": {\n\t\t\t \"positiveInteger\": {\n\t\t\t \"$anchor\": \"positiveInteger\",\n\t\t\t \"type\": \"integer\",\n\t\t\t \"exclusiveMinimum\": 0\n\t\t\t }\n\t\t\t },\n\t\t\t \"minItems\": 2\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ExternalRef()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar foo = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Id(\"https://json-everything.test/foo\")\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.ExclusiveMinimum(0)\n\t\t\t.Build();\n\n\t\tvar schema = JsonSchema.FromText(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"type\": \"array\",\n\t\t\t \"items\": { \"$ref\": \"https://json-everything.test/foo\" },\n\t\t\t \"minItems\": 2\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ExternalPointerRef()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar foo = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Id(\"https://json-everything.test/foo\")\n\t\t\t.Defs(\n\t\t\t\t(\"positiveInteger\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.ExclusiveMinimum(0)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Build();\n\n\t\tvar schema = JsonSchema.FromText(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"type\": \"array\",\n\t\t\t \"items\": { \"$ref\": \"https://json-everything.test/foo#/$defs/positiveInteger\" },\n\t\t\t \"minItems\": 2\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ExternalAnchorRef()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar foo = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Id(\"https://json-everything.test/foo\")\n\t\t\t.Defs(\n\t\t\t\t(\"positiveInteger\", new JsonSchemaBuilder()\n\t\t\t\t\t.Anchor(\"positiveInteger\")\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.ExclusiveMinimum(0)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Build();\n\n\t\tvar schema = JsonSchema.FromText(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"type\": \"array\",", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\ninternal class RefTests\n{\n\t[Test]\n\tpublic void PointerRef()\n\t{\n\t\tvar buildOptions = new Buil" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/RefTests.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/RefTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/RefTests.cs", + "startLine": 121, + "endLine": 240, + "content": "\"items\": { \"$ref\": \"https://json-everything.test/foo#positiveInteger\" },\n\t\t\t \"minItems\": 2\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void RecursiveLinkedListRef()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = JsonSchema.FromText(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$ref\": \"#/$defs/node\",\n\t\t\t \"$defs\": {\n\t\t\t \"node\": {\n\t\t\t \"type\": [\"object\", \"null\"],\n\t\t\t \"properties\": {\n\t\t\t \"value\": { \"type\": \"integer\" },\n\t\t\t \"next\": { \"$ref\": \"#/$defs/node\" }\n\t\t\t },\n\t\t\t \"required\": [\"value\", \"next\"],\n\t\t\t \"additionalProperties\": false\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void RecursiveMutualRef()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = JsonSchema.FromText(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$ref\": \"#/$defs/a\",\n\t\t\t \"$defs\": {\n\t\t\t \"a\": {\n\t\t\t \"type\": [\"object\", \"null\"],\n\t\t\t \"properties\": {\n\t\t\t \"value\": { \"type\": \"integer\" },\n\t\t\t \"next\": { \"$ref\": \"#/$defs/b\" }\n\t\t\t },\n\t\t\t \"required\": [\"value\", \"next\"],\n\t\t\t \"additionalProperties\": false\n\t\t\t },\n\t\t\t \"b\": {\n\t\t\t \"type\": [\"object\", \"null\"],\n\t\t\t \"properties\": {\n\t\t\t \"value\": { \"type\": \"integer\" },\n\t\t\t \"next\": { \"$ref\": \"#/$defs/a\" }\n\t\t\t },\n\t\t\t \"required\": [\"value\", \"next\"],\n\t\t\t \"additionalProperties\": false\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void DynamicRefResolvesByEntryPoint()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new(),\n\t\t\tDialect = Dialect.Draft202012\n\t\t};\n\n\t\t_ = JsonSchema.FromText(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t\t \"$id\": \"https://json-everything.test/tree-core\",\n\t\t\t \"$defs\": {\n\t\t\t \"node\": {\n\t\t\t \"$dynamicRef\": \"#nodeType\"\n\t\t\t },\n\t\t\t \"default\": {\n\t\t\t \"$dynamicAnchor\": \"nodeType\",\n\t\t\t \"not\": true\n\t\t\t }\n\t\t\t },\n\t\t\t \"$ref\": \"#/$defs/node\"\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tvar integerEntry = JsonSchema.FromText(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t\t \"$id\": \"https://json-everything.test/entry-int\",\n\t\t\t \"$defs\": {\n\t\t\t \"intNode\": {\n\t\t\t \"$dynamicAnchor\": \"nodeType\",\n\t\t\t \"type\": \"integer\",\n\t\t\t \"minimum\": 0\n\t\t\t }\n\t\t\t },\n\t\t\t \"$ref\": \"https://json-everything.test/tree-core\"\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tvar stringEntry = JsonSchema.FromText(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t\t \"$id\": \"https://json-everything.test/entry-string\",\n\t\t\t \"$defs\": {\n\t\t\t \"stringNode\": {\n\t\t\t \"$dynamicAnchor\": \"nodeType\",\n\t\t\t \"type\": \"string\",\n\t\t\t \"minLength\": 1", + "snippet": "\"items\": { \"$ref\": \"https://json-everything.test/foo#positiveInteger\" },\n\t\t\t \"minItems\": 2\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void RecursiveLinkedListRef()\n\t{\n\t\tvar buildOptions = new BuildO" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/RefTests.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/RefTests.cs#L241-L250", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/RefTests.cs", + "startLine": 241, + "endLine": 250, + "content": "}\n\t\t\t },\n\t\t\t \"$ref\": \"https://json-everything.test/tree-core\"\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tRun(integerEntry);\n\t\tRun(stringEntry);\n\t}\n}", + "snippet": "}\n\t\t\t },\n\t\t\t \"$ref\": \"https://json-everything.test/tree-core\"\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tRun(integerEntry);\n\t\tRun(stringEntry);\n\t}\n}" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs (1/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing NUnit.Framework;\nusing TestHelpers;\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class StringGenerationTests\n{\n\t[Test]\n\tpublic void SimpleString()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void MinLength()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.MinLength(30);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void MaxLength()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.MaxLength(20);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void SpecifiedRange()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.MinLength(10)\n\t\t\t.MaxLength(20);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ContainsDog()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(\"dog\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ContainsDogWithSizeConstraints()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(\"dog\")\n\t\t\t.MinLength(10)\n\t\t\t.MaxLength(20);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void DoesNotContainDog()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Not(new JsonSchemaBuilder().Pattern(\"dog\"));\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void DoesNotContainDogWithSizeConstraints()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Not(new JsonSchemaBuilder().Pattern(\"dog\"))\n\t\t\t.MinLength(10)\n\t\t\t.MaxLength(20);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ContainsCatAndDoesNotContainDogWithSizeConstraints()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Not(new JsonSchemaBuilder().Pattern(\"dog\"))\n\t\t\t.Pattern(\"cat\")\n\t\t\t.MinLength(10)\n\t\t\t.MaxLength(20);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ContainsEitherCatOrDog()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)", + "snippet": "using System;\nusing NUnit.Framework;\nusing TestHelpers;\nusing static Json.Schema.DataGeneration.Tests.TestRunner;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic class StringGenerationTests\n{\n\t[Test]\n\tpublic void Si" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs (2/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs", + "startLine": 121, + "endLine": 240, + "content": ".Type(SchemaValueType.String)\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"dog\"),\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"cat\")\n\t\t\t)\n\t\t\t.MinLength(10)\n\t\t\t.MaxLength(20);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ContainsExclusivelyEitherCatOrDog()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.OneOf(\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"dog\"),\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"cat\")\n\t\t\t)\n\t\t\t.MinLength(10)\n\t\t\t.MaxLength(20);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatDate()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Date);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatDateTime()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.DateTime);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatDuration()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Duration);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatEmail()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Email);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatHostname()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Hostname);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatIdnEmail()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.IdnEmail);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatIdnHostname()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.IdnHostname);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatIpv4()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Ipv4);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatIpv6()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)", + "snippet": ".Type(SchemaValueType.String)\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"dog\"),\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"cat\")\n\t\t\t)\n\t\t\t.MinLength(10)\n\t\t\t.MaxLength(20);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void ContainsE" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs (3/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs", + "startLine": 241, + "endLine": 360, + "content": ".Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Ipv6);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatIri()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Iri);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatIriReference()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.IriReference);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatJsonPointer()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.JsonPointer);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatRelativeJsonPointer()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.RelativeJsonPointer);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatTime()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Time);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatUri()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Uri);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatUriReference()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.UriReference);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatUuid()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Uuid);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void MultipleFormats()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.Format(Formats.DateTime),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.Format(Formats.Uuid)\n\t\t\t);\n\n\t\tvar result = schema.GenerateData();\n\n\t\tTestConsole.WriteLine(result.ErrorMessage);\n\t\tAssert.That(result.IsSuccess, Is.False);\n\t}\n\n\t[Test]\n\tpublic void PatternDigitsOnly()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)", + "snippet": ".Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Ipv6);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void FormatIri()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilde" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs (4/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs", + "startLine": 361, + "endLine": 480, + "content": ".Pattern(@\"^\\d+$\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void PatternWordCharacters()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(@\"^\\w{5,10}$\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void PatternCharacterClass()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(@\"^[a-z]{3}$\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void PatternAlternation()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(@\"^(foo|bar|baz)$\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void PatternExplicitQuantifier()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(@\"^\\d{4}-\\d{2}-\\d{2}$\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void PatternWithOptionalGroup()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(@\"^https?://\\S+$\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void PatternNegatedCharacterClass()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(@\"^[^0-9]+$\");\n\n\t\tRun(schema);\n\t}\n\n\t// ---- Pattern + length ----\n\n\t[Test]\n\tpublic void PatternWithMinLength()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(\"cat\")\n\t\t\t.MinLength(5);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void PatternWithMinAndMaxLength()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(\"cat\")\n\t\t\t.MinLength(5)\n\t\t\t.MaxLength(15);\n\n\t\tRun(schema);\n\t}\n\n\t// ---- allOf: multiple required patterns (AND) ----\n\n\t[Test]\n\tpublic void AllOfTwoCompatiblePatterns()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"cat\"),\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"hat\")\n\t\t\t)\n\t\t\t.MinLength(6)\n\t\t\t.MaxLength(30);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void AllOfPatternAndLength()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };", + "snippet": ".Pattern(@\"^\\d+$\");\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void PatternWordCharacters()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs (5/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs", + "startLine": 481, + "endLine": 600, + "content": "JsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.String).Pattern(\"foo\").MinLength(5),\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.String).MaxLength(20)\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void AllOfWithSamePatternIsNotAConflict()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"dog\"),\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"dog\")\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t// ---- not: anti-pattern (NOT) ----\n\n\t[Test]\n\tpublic void NotPatternDigits()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Not(new JsonSchemaBuilder().Pattern(@\"\\d\"))\n\t\t\t.MinLength(5)\n\t\t\t.MaxLength(20);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void NotPatternWithExplicitLiteral()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Not(new JsonSchemaBuilder().Pattern(\"forbidden\"))\n\t\t\t.MinLength(5)\n\t\t\t.MaxLength(30);\n\n\t\tRun(schema);\n\t}\n\n\t// ---- Positive AND negative combined ----\n\n\t[Test]\n\tpublic void PatternRequiredAndForbiddenCombined()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(\"cat\")\n\t\t\t.Not(new JsonSchemaBuilder().Pattern(\"dog\"))\n\t\t\t.MinLength(5)\n\t\t\t.MaxLength(30);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void TwoRequiredAndOneForbiddenPattern()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"cat\"),\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"hat\")\n\t\t\t)\n\t\t\t.Not(new JsonSchemaBuilder().Pattern(\"dog\"))\n\t\t\t.MinLength(6)\n\t\t\t.MaxLength(30);\n\n\t\tRun(schema);\n\t}\n\n\t// ---- anyOf / oneOf ----\n\n\t[Test]\n\tpublic void AnyOfPatternNoLengthConstraint()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"cat\"),\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"dog\")\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void OneOfPatternNoLengthConstraint()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.OneOf(\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"cat\"),\n\t\t\t\tnew JsonSchemaBuilder().Pattern(\"dog\")\n\t\t\t);\n\n\t\tRun(schema);\n\t}\n\n\t// ---- pattern + format ----\n\n\t[Test]\n\tpublic void PatternWithFormat()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };", + "snippet": "JsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.String).Pattern(\"foo\").MinLength(5),\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.String).MaxLength(" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs (6/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs#L601-L659", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/StringGenerationTests.cs", + "startLine": 601, + "endLine": 659, + "content": "JsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(@\"\\w+\")\n\t\t\t.Format(Formats.Email);\n\n\t\tRun(schema);\n\t}\n\n\t// ---- pattern inside structural keywords ----\n\n\t[Test]\n\tpublic void PatternInsideArrayItems()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t.Pattern(\"cat\")\n\t\t\t\t.MinLength(3)\n\t\t\t\t.MaxLength(20))\n\t\t\t.MinItems(2)\n\t\t\t.MaxItems(5);\n\n\t\tRun(schema);\n\t}\n\n\t[Test]\n\tpublic void PatternOnObjectProperty()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"name\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.Pattern(@\"\\w+\")\n\t\t\t\t\t.MinLength(1)\n\t\t\t\t\t.MaxLength(30))\n\t\t\t)\n\t\t\t.Required(\"name\");\n\n\t\tRun(schema);\n\t}\n\n\t// ---- failure cases ----\n\n\t[Test]\n\tpublic void ImpossiblePatternWithLengthFails()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(@\"^\\d{100}$\")\n\t\t\t.MaxLength(5);\n\n\t\tRunFailure(schema);\n\t}\n}", + "snippet": "JsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Pattern(@\"\\w+\")\n\t\t\t.Format(Formats.Email);\n\n\t\tRun(schema);\n\t}\n\n\t// ---- pattern inside structural keywords ----\n\n\t[Test]\n\tpubli" + }, + { + "title": "src/JsonSchema.DataGeneration.Tests/TestRunner.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration.Tests/TestRunner.cs#L1-L77", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration.Tests/TestRunner.cs", + "startLine": 1, + "endLine": 77, + "content": "using System;\nusing System.Diagnostics;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.DataGeneration.Tests;\n\npublic static class TestRunner\n{\n\tpublic static readonly JsonSerializerOptions SerializerOptions =\n\t\tnew()\n\t\t{\n\t\t\tWriteIndented = true,\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\t\tTypeInfoResolverChain = { DataGenerationTestsSerializerContext.Default }\n\t\t};\n\n\tpublic static void Run(JsonSchema schema)\n\t{\n\t\tvar result = schema.GenerateData();\n\t\tif (!result.IsSuccess)\n\t\t{\n\t\t\tif (!string.IsNullOrWhiteSpace(result.ErrorMessage))\n\t\t\t\tTestConsole.WriteLine(result.ErrorMessage);\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, SerializerOptions));\n\t\t}\n\n\t\tAssert.That(result.IsSuccess, Is.True, \"failed generation\");\n\t\tvar resultElt = JsonSerializer.SerializeToElement(result.Result, SerializerOptions);\n\t\tTestConsole.WriteLine(resultElt.GetRawText());\n\t\tvar validation = schema.Evaluate(resultElt);\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(validation, SerializerOptions));\n\t\tif (!validation.IsValid)\n\t\t{\n\t\t\tTestConsole.WriteLine(\"Validation failed\");\n\t\t\tif (validation.Details != null)\n\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(validation.Details, SerializerOptions));\n\t\t}\n\t\tAssert.That(validation.IsValid, Is.True, \"failed validation\");\n\t}\n\n\tpublic static void RunFailure(JsonSchema schema)\n\t{\n\t\tvar result = schema.GenerateData();\n\t\tif (!result.IsSuccess)\n\t\t{\n\t\t\tif (!string.IsNullOrWhiteSpace(result.ErrorMessage))\n\t\t\t\tTestConsole.WriteLine(result.ErrorMessage);\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, SerializerOptions));\n\t\t}\n\t\tif (result.IsSuccess)\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result.Result, SerializerOptions));\n\t\tAssert.That(result.IsSuccess, Is.False, \"generation succeeded\");\n\t}\n\n\tpublic static void RunInLoopForDebugging(JsonSchema schema)\n\t{\n\t\tif (!Debugger.IsAttached)\n\t\t\tthrow new InvalidOperationException(\"Don't call this unless you're debugging\");\n\n\t\twhile (true)\n\t\t{\n\t\t\tschema.GenerateData();\n\t\t}\n\t}\n}\n\n[JsonSerializable(typeof(GenerationResult))]\n[JsonSerializable(typeof(JsonSchema))]\n[JsonSerializable(typeof(EvaluationResults))]\ninternal partial class DataGenerationTestsSerializerContext : JsonSerializerContext;", + "snippet": "using System;\nusing System.Diagnostics;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.DataGeneration.Tests" + }, + { + "title": "src/JsonSchema.DataGeneration/Bound.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Bound.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Bound.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\n\nnamespace Json.Schema.DataGeneration;\n\n/// \n/// Describes a lower or upper bound to a .\n/// \npublic readonly struct Bound : IComparable, IEquatable\n{\n\t/// \n\t/// Gets the bound value.\n\t/// \n\tpublic decimal Value { get; }\n\t/// \n\t/// Gets whether the value is included in the bound.\n\t/// \n\tpublic bool Inclusive { get; }\n\n\t/// \n\t/// Creates a new .\n\t/// \n\t/// The value\n\t/// Whether the value is included. Default is true.\n\tpublic Bound(decimal value, bool inclusive = true)\n\t{\n\t\tValue = value;\n\t\tInclusive = inclusive;\n\t}\n\n\t/// \n\t/// Converts and integer to an inclusive bound.\n\t/// \n\t/// The value.\n\tpublic static implicit operator Bound(int value)\n\t{\n\t\treturn new Bound(value);\n\t}\n\n\t/// \n\t/// Converts a decimal to an inclusive bound.\n\t/// \n\t/// The value.\n\tpublic static implicit operator Bound(decimal value)\n\t{\n\t\treturn new Bound(value);\n\t}\n\n\t/// \n\t/// Converts an integer-bool tuple to a bound.\n\t/// \n\t/// The value and its inclusivity.\n\tpublic static implicit operator Bound((int value, bool inclusive) pair)\n\t{\n\t\treturn new Bound(pair.value, pair.inclusive);\n\t}\n\n\t/// \n\t/// Converts a decimal-bool tuple to a bound.\n\t/// \n\t/// The value and its inclusivity.\n\tpublic static implicit operator Bound((decimal value, bool inclusive) pair)\n\t{\n\t\treturn new Bound(pair.value, pair.inclusive);\n\t}\n\n\t/// Defines a generalized comparison method that a value type or class implements to create a type-specific comparison method for ordering or sorting its instances.\n\tpublic int CompareTo(Bound other)\n\t{\n\t\tif (Value < other.Value) return -1;\n\t\tif (Value > other.Value) return 1;\n\n\t\tif (Inclusive == other.Inclusive) return 0;\n\t\tif (Inclusive) return -1;\n\t\treturn 1;\n\t}\n\n\t/// Indicates whether this instance and a specified object are equal.\n\t/// The object to compare with the current instance.\n\t/// true if obj and this instance are the same type and represent the same value; otherwise, false.\n\tpublic override bool Equals(object? obj)\n\t{\n\t\treturn obj is not null && Equals((Bound)obj);\n\t}\n\n\t/// Indicates whether the current object is equal to another object of the same type.\n\t/// An object to compare with this object.\n\t/// true if the current object is equal to the other parameter; otherwise, false.\n\tpublic bool Equals(Bound other)\n\t{\n\t\treturn Value == other.Value && Inclusive == other.Inclusive;\n\t}\n\n\t/// Returns the hash code for this instance.\n\t/// A 32-bit signed integer that is the hash code for this instance.\n\tpublic override int GetHashCode()\n\t{\n\t\tunchecked\n\t\t{\n\t\t\treturn (Value.GetHashCode() * 397) ^ Inclusive.GetHashCode();\n\t\t}\n\t}\n\n\t/// \n\t/// Compares two bounds for equality\n\t/// \n\t/// True if the bounds share a value and inclusivity; false otherwise.\n\tpublic static bool operator ==(Bound left, Bound right)\n\t{\n\t\treturn left.Equals(right);\n\t}\n\n\t/// \n\t/// Compares two bounds for non-equality\n\t/// \n\t/// False if the bounds share a value and inclusivity; true otherwise.\n\tpublic static bool operator !=(Bound left, Bound right)\n\t{\n\t\treturn !left.Equals(right);\n\t}", + "snippet": "using System;\nusing System.Collections.Generic;\n\nnamespace Json.Schema.DataGeneration;\n\n/// \n/// Describes a lower or upper bound to a .\n/// \npublic readonly struct Bound : ICo" + }, + { + "title": "src/JsonSchema.DataGeneration/Bound.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Bound.cs#L121-L213", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Bound.cs", + "startLine": 121, + "endLine": 213, + "content": "/// \n\t/// Compares two bounds for linear order.\n\t/// \n\t/// True if left.Value < right.Value or if right is inclusive and left is not.\n\tpublic static bool operator <(Bound left, Bound right)\n\t{\n\t\treturn left.CompareTo(right) == -1;\n\t}\n\n\t/// \n\t/// Compares two bounds for linear order.\n\t/// \n\t/// True if left.Value <= right.Value or if right is inclusive or both are not.\n\tpublic static bool operator <=(Bound left, Bound right)\n\t{\n\t\treturn left.CompareTo(right) is -1 or 0;\n\t}\n\n\t/// \n\t/// Compares two bounds for linear order.\n\t/// \n\t/// True if left.Value > right.Value or if left is inclusive and right is not.\n\tpublic static bool operator >(Bound left, Bound right)\n\t{\n\t\treturn left.CompareTo(right) == 1;\n\t}\n\n\t/// \n\t/// Compares two bounds for linear order.\n\t/// \n\t/// True if left.Value >= right.Value or if left is inclusive or both are not.\n\tpublic static bool operator >=(Bound left, Bound right)\n\t{\n\t\treturn left.CompareTo(right) is 1 or 0;\n\t}\n\n\t/// \n\t/// Identifies the minimum of two bounds, including their inclusivity.\n\t/// \n\tpublic static Bound Minimum(Bound a, Bound b)\n\t{\n\t\treturn a.CompareTo(b) == 1 ? b : a;\n\t}\n\n\t/// \n\t/// Identifies the maximum of two bounds, including their inclusivity.\n\t/// \n\tpublic static Bound Maximum(Bound a, Bound b)\n\t{\n\t\treturn a.CompareTo(b) == -1 ? b : a;\n\t}\n\n\t/// \n\t/// Identifies the complement of a bound, which is the same value and inverted inclusivity.\n\t/// \n\tpublic static Bound Complement(Bound b)\n\t{\n\t\treturn new Bound(b.Value, !b.Inclusive);\n\t}\n}\n\n/// \n/// Comparator for .\n/// \npublic sealed class BoundEqualityComparer : IEqualityComparer\n{\n\t/// \n\t/// Static instance of the comparer.\n\t/// \n\tpublic static IEqualityComparer Instance { get; } = new BoundEqualityComparer();\n\n\t/// Determines whether the specified objects are equal.\n\t/// The first object of type T to compare.\n\t/// The second object of type T to compare.\n\t/// true if the specified objects are equal; otherwise, false.\n\tpublic bool Equals(Bound x, Bound y)\n\t{\n\t\treturn x.Value == y.Value && x.Inclusive == y.Inclusive;\n\t}\n\n\t/// Returns a hash code for the specified object.\n\t/// The for which a hash code is to be returned.\n\t/// A hash code for the specified object.\n\t/// The type of obj is a reference type and obj is null.\n\tpublic int GetHashCode(Bound obj)\n\t{\n\t\tunchecked\n\t\t{\n\t\t\treturn (obj.Value.GetHashCode() * 397) ^ obj.Inclusive.GetHashCode();\n\t\t}\n\t}\n}", + "snippet": "/// \n\t/// Compares two bounds for linear order.\n\t/// \n\t/// True if left.Value < right.Value or if right is inclusive and left is not.\n\tpublic static bool operator <(Bound left, Bo" + }, + { + "title": "src/JsonSchema.DataGeneration/DotnetCompatibility.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/DotnetCompatibility.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/DotnetCompatibility.cs", + "startLine": 1, + "endLine": 15, + "content": "#if NETSTANDARD2_0\n\nusing System.Collections.Generic;\n\nnamespace Json.Schema.DataGeneration;\n\ninternal static class DotnetCompatibility\n{\n\tpublic static HashSet ToHashSet(this IEnumerable items)\n\t{\n\t\treturn new HashSet(items);\n\t}\n}\n\n#endif", + "snippet": "#if NETSTANDARD2_0\n\nusing System.Collections.Generic;\n\nnamespace Json.Schema.DataGeneration;\n\ninternal static class DotnetCompatibility\n{\n\tpublic static HashSet ToHashSet(this IEnumerable items)\n\t{\n\t" + }, + { + "title": "src/JsonSchema.DataGeneration/GenerationResult.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/GenerationResult.cs#L1-L67", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/GenerationResult.cs", + "startLine": 1, + "endLine": 67, + "content": "using System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration;\n\n/// \n/// Holds the result of an instance generation operation.\n/// \npublic class GenerationResult\n{\n\t/// \n\t/// Gets the resulting JSON data, if successful.\n\t/// \n\tpublic JsonNode? Result { get; }\n\t/// \n\t/// Gets the error message from the generation, if unsuccessful.\n\t/// \n\tpublic string? ErrorMessage { get; }\n\t/// \n\t/// Gets the result objects from nested data generations.\n\t/// \n\tpublic IEnumerable? InnerResults { get; }\n\t/// \n\t/// Gets the relative instance location at which this failure occurred, if known.\n\t/// \n\tpublic JsonPointer? Location { get; }\n\t/// \n\t/// Gets the related schema locations for this failure, if known.\n\t/// \n\tpublic IReadOnlyList? SchemaLocations { get; }\n\n\t/// \n\t/// Gets whether the data generation was successful.\n\t/// \n\tpublic bool IsSuccess => ErrorMessage == null && InnerResults == null;\n\n\tprivate GenerationResult(JsonNode? result, string? errorMessage, IEnumerable? inner, JsonPointer? location, IReadOnlyList? schemaLocations)\n\t{\n\t\tResult = result ?? null;\n\t\tErrorMessage = errorMessage;\n\t\tInnerResults = inner;\n\t\tLocation = location;\n\t\tSchemaLocations = schemaLocations;\n\t}\n\n\tinternal static GenerationResult Success(JsonElement? result)\n\t{\n\t\treturn new GenerationResult(JsonNode.Parse(result!.Value.GetRawText()), null, null, null, null);\n\t}\n\n\tinternal static GenerationResult Success(JsonNode? result)\n\t{\n\t\treturn new GenerationResult(result, null, null, null, null);\n\t}\n\n\tinternal static GenerationResult Fail(string errorMessage, JsonPointer? location = null, IReadOnlyList? schemaLocations = null)\n\t{\n\t\treturn new GenerationResult(null, errorMessage, null, location, schemaLocations);\n\t}\n\n\tinternal static GenerationResult Fail(IEnumerable inner, JsonPointer? location = null, IReadOnlyList? schemaLocations = null)\n\t{\n\t\treturn new GenerationResult(null, null, inner, location, schemaLocations);\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration;\n\n/// \n/// Holds the result of an instance generation operation.\n" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/ArrayGenerator.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/ArrayGenerator.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/ArrayGenerator.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class ArrayGenerator : IDataGenerator\n{\n\tpublic static ArrayGenerator Instance { get; } = new();\n\n\t// TODO: move these to a public settings object\n\tpublic static uint DefaultMinItems { get; set; } = 0;\n\tpublic static uint DefaultMaxItems { get; set; } = 10;\n\tpublic static uint DefaultMinContains { get; set; } = 1;\n\tpublic static uint DefaultMaxContains { get; set; } = 10;\n\n\tprivate ArrayGenerator() { }\n\n\tpublic SchemaValueType Type => SchemaValueType.Array;\n\n\tpublic GenerationResult Generate(RequirementsContext context)\n\t{\n\t\tvar minItems = DefaultMinItems;\n\t\tvar maxItems = DefaultMaxItems;\n\t\tif (context.ItemCounts != null)\n\t\t{\n\t\t\tif (!context.ItemCounts.Ranges.Any())\n\t\t\t\treturn GenerationResult.Fail(\"No valid item counts possible\");\n\n\t\t\tvar numberRange = JsonSchemaExtensions.Randomizer.ArrayElement(context.ItemCounts.Ranges.ToArray());\n\t\t\tif (numberRange.Minimum.Value != NumberRangeSet.MinRangeValue)\n\t\t\t\tminItems = (uint)(numberRange.Minimum.Inclusive\n\t\t\t\t\t? numberRange.Minimum.Value\n\t\t\t\t\t: numberRange.Minimum.Value + 1);\n\t\t\tif (numberRange.Maximum.Value != NumberRangeSet.MaxRangeValue)\n\t\t\t\tmaxItems = (uint)(numberRange.Maximum.Inclusive\n\t\t\t\t\t? numberRange.Maximum.Value\n\t\t\t\t\t: numberRange.Maximum.Value - 1);\n\t\t}\n\n\t\tvar itemCount = (int)JsonSchemaExtensions.Randomizer.UInt(minItems, maxItems);\n\t\tvar sequenceCount = (uint?)context.SequentialItems?.Count ?? 0;\n\t\tvar containsCount = 0;\n\t\tif (context.Contains != null)\n\t\t{\n\t\t\tvar minContains = DefaultMinContains;\n\t\t\tvar maxContains = Math.Min(maxItems - sequenceCount, DefaultMaxContains + minContains);\n\t\t\tif (context.ContainsCounts != null)\n\t\t\t{\n\t\t\t\tvar numberRange = JsonSchemaExtensions.Randomizer.ArrayElement(context.ContainsCounts.Ranges.ToArray());\n\t\t\t\tif (numberRange.Minimum.Value != NumberRangeSet.MinRangeValue)\n\t\t\t\t\tminContains = (uint)numberRange.Minimum.Value;\n\t\t\t\tif (numberRange.Maximum.Value != NumberRangeSet.MaxRangeValue)\n\t\t\t\t\tmaxContains = (uint)numberRange.Maximum.Value;\n\t\t\t}\n\n\t\t\t// some simple checks to ensure an instance can be generated\n\t\t\tif (minContains > maxContains)\n\t\t\t\treturn GenerationResult.Fail(\"minContains is greater than maxContains\");\n\t\t\tif (minContains > maxItems - sequenceCount)\n\t\t\t\treturn GenerationResult.Fail(\"minContains is greater than maxItems less sequential items count\");\n\n\t\t\tcontainsCount = (int)JsonSchemaExtensions.Randomizer.UInt(minContains, maxContains);\n\t\t\tif (itemCount < containsCount)\n\t\t\t\titemCount = containsCount;\n\t\t}\n\n\t\tvar itemGenerationResults = new List();\n\n\t\tvar currentSequenceIndex = 0;\n\t\tif (context.SequentialItems != null)\n\t\t{\n\t\t\twhile (currentSequenceIndex < itemCount && currentSequenceIndex < context.SequentialItems.Count)\n\t\t\t{\n\t\t\t\tvar itemRequirement = context.SequentialItems[currentSequenceIndex];\n\t\t\t\tvar itemResult = itemRequirement.GenerateData();\n\t\t\t\tif (!itemResult.IsSuccess)\n\t\t\t\t\titemResult = GenerationResult.Fail([itemResult], JsonPointer.Create(currentSequenceIndex.ToString()));\n\t\t\t\titemGenerationResults.Add(itemResult);\n\t\t\t\tcurrentSequenceIndex++;\n\t\t\t}\n\t\t}\n\n\t\tvar possibleIndices = Enumerable.Range(currentSequenceIndex, itemCount - currentSequenceIndex).ToArray();\n\t\tvar containsIndices = JsonSchemaExtensions.Randomizer\n\t\t\t.ArrayElements(possibleIndices, Math.Min(possibleIndices.Length, containsCount))\n\t\t\t.OrderBy(x => x)\n\t\t\t.ToArray();\n\t\tvar remainingRequirements = context.RemainingItems ?? new RequirementsContext();\n\t\tvar hasExplicitMaxContains = context.ContainsCounts?.Ranges.All(x => x.Maximum.Value != NumberRangeSet.MaxRangeValue) ?? false;\n\t\tRequirementsContext? nonContainsRequirement = null;\n\t\tif (hasExplicitMaxContains)\n\t\t{\n\t\t\tfor (var i = 0; i < 10; i++)\n\t\t\t{\n\t\t\t\tvar candidate = new RequirementsContext(remainingRequirements);\n\t\t\t\tcandidate.And(context.Contains!.Break());\n\t\t\t\tif (!candidate.HasConflict)\n\t\t\t\t{\n\t\t\t\t\tnonContainsRequirement = candidate;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (nonContainsRequirement == null && context.Contains?.NumberRanges != null)\n\t\t\t{\n\t\t\t\tvar numericCandidate = new RequirementsContext(remainingRequirements)\n\t\t\t\t{\n\t\t\t\t\tNumberRanges = remainingRequirements.NumberRanges != null\n\t\t\t\t\t\t? remainingRequirements.NumberRanges * context.Contains.NumberRanges.GetComplement()\n\t\t\t\t\t\t: context.Contains.NumberRanges.GetComplement()\n\t\t\t\t};\n\n\t\t\t\tif (numericCandidate.NumberRanges?.Ranges.Any() == true)\n\t\t\t\t\tnonContainsRequirement = numericCandidate;\n\t\t\t}\n\n\t\t\tif (nonContainsRequirement == null)", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class ArrayGenerator : IDataGenerator\n{\n\tpublic static A" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/ArrayGenerator.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/ArrayGenerator.cs#L121-L154", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/ArrayGenerator.cs", + "startLine": 121, + "endLine": 154, + "content": "hasExplicitMaxContains = false;\n\t\t}\n\t\tif (!remainingRequirements.IsFalse)\n\t\t{\n\t\t\tint currentContainsIndex = 0;\n\t\t\tfor (int i = currentSequenceIndex; i < itemCount; i++)\n\t\t\t{\n\t\t\t\tvar itemRequirement = remainingRequirements;\n\t\t\t\tvar isContainsIndex = containsCount > 0 && currentContainsIndex < containsIndices.Length && i == containsIndices[currentContainsIndex];\n\t\t\t\tif (isContainsIndex)\n\t\t\t\t{\n\t\t\t\t\titemRequirement = new RequirementsContext(itemRequirement);\n\t\t\t\t\titemRequirement.And(context.Contains!);\n\t\t\t\t\tcurrentContainsIndex++;\n\t\t\t\t}\n\t\t\t\telse if (hasExplicitMaxContains)\n\t\t\t\t{\n\t\t\t\t\titemRequirement = nonContainsRequirement!;\n\t\t\t\t}\n\n\t\t\t\tvar itemResult = itemRequirement.GenerateData();\n\t\t\t\tif (!itemResult.IsSuccess)\n\t\t\t\t\titemResult = GenerationResult.Fail([itemResult], JsonPointer.Create(i.ToString()));\n\t\t\t\titemGenerationResults.Add(itemResult);\n\t\t\t}\n\t\t}\n\t\telse if (itemGenerationResults.Count < minItems)\n\t\t\treturn GenerationResult.Fail(\"Could not generate sufficient items to meet requirements\");\n\n\t\treturn itemGenerationResults.All(x => x.IsSuccess)\n\t\t\t? GenerationResult.Success(itemGenerationResults.Select(x => x.Result).ToJsonArray())\n\t\t\t: GenerationResult.Fail(itemGenerationResults);\n\t}\n}", + "snippet": "hasExplicitMaxContains = false;\n\t\t}\n\t\tif (!remainingRequirements.IsFalse)\n\t\t{\n\t\t\tint currentContainsIndex = 0;\n\t\t\tfor (int i = currentSequenceIndex; i < itemCount; i++)\n\t\t\t{\n\t\t\t\tvar itemRequirement = remainingRequirement" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/BooleanGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/BooleanGenerator.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/BooleanGenerator.cs", + "startLine": 1, + "endLine": 15, + "content": "namespace Json.Schema.DataGeneration.Generators;\n\ninternal class BooleanGenerator : IDataGenerator\n{\n\tpublic static BooleanGenerator Instance { get; } = new();\n\n\tprivate BooleanGenerator() { }\n\n\tpublic SchemaValueType Type => SchemaValueType.Boolean;\n\n\tpublic GenerationResult Generate(RequirementsContext context)\n\t{\n\t\treturn GenerationResult.Success(JsonSchemaExtensions.Randomizer.Bool());\n\t}\n}", + "snippet": "namespace Json.Schema.DataGeneration.Generators;\n\ninternal class BooleanGenerator : IDataGenerator\n{\n\tpublic static BooleanGenerator Instance { get; } = new();\n\n\tprivate BooleanGenerator() { }\n\n\tpublic SchemaValueType Ty" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/ConstGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/ConstGenerator.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/ConstGenerator.cs", + "startLine": 1, + "endLine": 18, + "content": "namespace Json.Schema.DataGeneration.Generators;\n\ninternal class ConstGenerator : IPrioritizedDataGenerator\n{\n\tpublic static ConstGenerator Instance { get; } = new();\n\n\tprivate ConstGenerator() { }\n\n\tpublic bool Applies(RequirementsContext context)\n\t{\n\t\treturn context.ConstIsSet;\n\t}\n\n\tpublic GenerationResult Generate(RequirementsContext context)\n\t{\n\t\treturn GenerationResult.Success(context.Const);\n\t}\n}", + "snippet": "namespace Json.Schema.DataGeneration.Generators;\n\ninternal class ConstGenerator : IPrioritizedDataGenerator\n{\n\tpublic static ConstGenerator Instance { get; } = new();\n\n\tprivate ConstGenerator() { }\n\n\tpublic bool Applies(" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/EnumGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/EnumGenerator.cs#L1-L21", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/EnumGenerator.cs", + "startLine": 1, + "endLine": 21, + "content": "using System.Linq;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class EnumGenerator : IPrioritizedDataGenerator\n{\n\tpublic static EnumGenerator Instance { get; } = new();\n\n\tprivate EnumGenerator() { }\n\n\tpublic bool Applies(RequirementsContext context)\n\t{\n\t\treturn context.EnumOptions?.Any(x => x.Item1) == true;\n\t}\n\n\tpublic GenerationResult Generate(RequirementsContext context)\n\t{\n\t\tvar value = JsonSchemaExtensions.Randomizer.ListItem(context.EnumOptions!.Where(x => x.Item1).ToList());\n\t\treturn GenerationResult.Success(value.Item2);\n\t}\n}", + "snippet": "using System.Linq;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class EnumGenerator : IPrioritizedDataGenerator\n{\n\tpublic static EnumGenerator Instance { get; } = new();\n\n\tprivate EnumGenerator() { }\n\n\tpub" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/IntegerGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/IntegerGenerator.cs#L1-L93", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/IntegerGenerator.cs", + "startLine": 1, + "endLine": 93, + "content": "using System;\nusing System.Linq;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class IntegerGenerator : IDataGenerator\n{\n\tpublic static IntegerGenerator Instance { get; } = new();\n\n\tprivate IntegerGenerator() { }\n\n\tpublic SchemaValueType Type => SchemaValueType.Integer;\n\n\tpublic GenerationResult Generate(RequirementsContext context)\n\t{\n\t\tcontext.NumberRanges ??= NumberRangeSet.Full;\n\n\t\tvar rangeSet = context.NumberRanges.Ranges.Any()\n\t\t\t? context.NumberRanges\n\t\t\t: NumberRangeSet.Full;\n\t\trangeSet = rangeSet.Ceiling(long.MaxValue >> 3).Floor(long.MinValue >> 3);\n\n\t\tvar range = JsonSchemaExtensions.Randomizer.ArrayElement(rangeSet.Ranges.ToArray());\n\n\t\tvar minValue = (long)Math.Ceiling(range.Minimum.Value);\n\t\tvar maxValue = (long)Math.Floor(range.Maximum.Value);\n\n\t\tif (!range.Minimum.Inclusive) minValue++;\n\t\tif (!range.Maximum.Inclusive) maxValue--;\n\n\t\tvar value = GetValue(minValue, maxValue, context.Multiples?.ToArray() ?? [],\n\t\t\tcontext.AntiMultiples?.ToArray() ?? []);\n\n\t\treturn value.HasValue\n\t\t\t? GenerationResult.Success(value.Value)\n\t\t\t: GenerationResult.Fail(\"Cannot generate random with that meets all requirements\", schemaLocations: context.NumberRangesSource.HasValue ? [context.NumberRangesSource.Value] : null);\n\t}\n\n\tprivate static long? GetValue(long lowerBound, long upperBound, decimal[] requireMultiple, decimal[] requireNotMultiple)\n\t{\n\t\tvar period = (int)Lcm([.. requireNotMultiple, .. requireMultiple, .. new[] { 1m }]);\n\t\tif (period == 1) return JsonSchemaExtensions.Randomizer.Long(lowerBound, upperBound);\n\n\t\tvar range = upperBound - lowerBound;\n\t\tvar lowBound = range < period ? lowerBound % period : lowerBound;\n\t\tvar highBound = range < period ? upperBound % period : upperBound;\n\t\tvar multipleOf = Lcm(requireMultiple);\n\t\tvar offset = 0;\n\t\tif (requireNotMultiple.Length != 0)\n\t\t{\n\t\t\tvar nonMultiples = Enumerable.Range(0, period)\n\t\t\t\t.Where(x => requireNotMultiple.All(n => x % n != 0) &&\n\t\t\t\t\t\t\tx % multipleOf == 0 &&\n\t\t\t\t\t\t\tlowBound <= x && x <= highBound)\n\t\t\t\t.ToArray();\n\t\t\tif (nonMultiples.Length == 0) return null;\n\t\t\toffset = nonMultiples[JsonSchemaExtensions.Randomizer.Int(0, nonMultiples.Length - 1)];\n\t\t}\n\n\t\tvar scaledRange = (upperBound - lowerBound) / period;\n\t\tvar lowOffset = (lowerBound / period) * period;\n\t\tvar value = JsonSchemaExtensions.Randomizer.Long(0, scaledRange) * period + lowOffset + offset;\n\t\tif (value > upperBound) value -= period;\n\t\tif (lowerBound > value) value += period;\n\n\t\treturn value;\n\t}\n\n\tprivate static decimal Gcf(decimal a, decimal b)\n\t{\n\t\twhile (b != 0)\n\t\t{\n\t\t\tvar temp = b;\n\t\t\tb = a % b;\n\t\t\ta = temp;\n\t\t}\n\n\t\treturn a;\n\t}\n\n\tprivate static decimal Lcm(decimal a, decimal b)\n\t{\n\t\treturn (a / Gcf(a, b)) * b;\n\t}\n\n\tprivate static decimal Lcm(decimal[] nums)\n\t{\n\t\tif (nums.Length == 0) return 1;\n\t\tif (nums.Length == 1) return nums[0];\n\t\tvar first = Lcm(nums[0], nums[1]);\n\t\treturn nums.Skip(2).Aggregate(first, Lcm);\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class IntegerGenerator : IDataGenerator\n{\n\tpublic static IntegerGenerator Instance { get; } = new();\n\n\tprivate IntegerGenerator" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/NullGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/NullGenerator.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/NullGenerator.cs", + "startLine": 1, + "endLine": 17, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class NullGenerator : IDataGenerator\n{\n\tpublic static NullGenerator Instance { get; } = new();\n\n\tprivate NullGenerator() { }\n\n\tpublic SchemaValueType Type => SchemaValueType.Null;\n\n\tpublic GenerationResult Generate(RequirementsContext context)\n\t{\n\t\treturn GenerationResult.Success((JsonNode?)null);\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class NullGenerator : IDataGenerator\n{\n\tpublic static NullGenerator Instance { get; } = new();\n\n\tprivate NullGenerator() { }\n\n\tpub" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/NumberGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/NumberGenerator.cs#L1-L111", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/NumberGenerator.cs", + "startLine": 1, + "endLine": 111, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class NumberGenerator : IDataGenerator\n{\n\tpublic static NumberGenerator Instance { get; } = new();\n\n\tprivate NumberGenerator() { }\n\n\tpublic SchemaValueType Type => SchemaValueType.Number;\n\n\tpublic GenerationResult Generate(RequirementsContext context)\n\t{\n\t\tcontext.NumberRanges ??= NumberRangeSet.Full;\n\n\t\t// we have no requirements, so use the full range\n\t\tif (!context.NumberRanges.Ranges.Any())\n\t\t\tcontext.NumberRanges = NumberRangeSet.Full;\n\n\t\tvar availableRanges = context.NumberRanges.Ranges.ToList();\n\n\t\twhile (availableRanges.Count != 0)\n\t\t{\n\t\t\tvar selectedIndex = JsonSchemaExtensions.Randomizer.Int(0, availableRanges.Count - 1);\n\t\t\tvar selectedRange = availableRanges[selectedIndex];\n\n\t\t\tvar minValue = selectedRange.Minimum.Value;\n\t\t\tvar isInclusiveMin = selectedRange.Minimum.Inclusive;\n\t\t\tvar maxValue = selectedRange.Maximum.Value;\n\t\t\tvar isInclusiveMax = selectedRange.Maximum.Inclusive;\n\t\t\tdecimal? multipleOf = null;\n\t\t\tif (context.Multiples != null && context.Multiples.Count != 0)\n\t\t\t{\n\t\t\t\tif (context.Multiples.Count == 1)\n\t\t\t\t\tmultipleOf = context.Multiples.Single();\n\t\t\t\telse\n\t\t\t\t\tmultipleOf = Lcm(context.Multiples);\n\t\t\t}\n\n\t\t\tdecimal value;\n\t\t\tint attempts = 0;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tvalue = JsonSchemaExtensions.Randomizer.Decimal(minValue, maxValue);\n\t\t\t\tif (multipleOf.HasValue)\n\t\t\t\t{\n\t\t\t\t\tvar factor = multipleOf.Value;\n\t\t\t\t\tvalue = Math.Round(value / factor, MidpointRounding.AwayFromZero) * factor;\n\t\t\t\t}\n\n\t\t\t\tif (!selectedRange.Contains(value))\n\t\t\t\t{\n\t\t\t\t\tattempts++;\n\t\t\t\t\tif (attempts > 5) break;\n\t\t\t\t}\n\n\t\t\t} while (context.AntiMultiples != null && context.AntiMultiples.Any(x => value % x == 0));\n\n\t\t\tvar meetsMinimum = isInclusiveMin ? minValue <= value : minValue < value;\n\t\t\tvar meetsMaximum = isInclusiveMax ? value <= maxValue : value < maxValue;\n\n\t\t\tif (meetsMinimum && meetsMaximum)\n\t\t\t\treturn GenerationResult.Success(value);\n\n\t\t\tavailableRanges.RemoveAt(selectedIndex);\n\t\t}\n\n\t\treturn GenerationResult.Fail(\"Could not generate a numeric value that met all requirements.\", schemaLocations: context.NumberRangesSource.HasValue ? [context.NumberRangesSource.Value] : null);\n\t}\n\n\tprivate static decimal Lcm(IEnumerable values)\n\t{\n\t\tvar gcd = Gcd(values);\n\t\tvar product = values.Aggregate(1m, (c, x) => c * x);\n\n\t\treturn product / gcd;\n\t}\n\n\tprivate static decimal Gcd(IEnumerable values)\n\t{\n\t\tvar current = values.First();\n\t\tforeach (var value in values.Skip(1))\n\t\t{\n\t\t\tcurrent = Gcd(current, value);\n\t\t}\n\n\t\treturn current;\n\t}\n\n\tprivate static decimal Gcd(decimal a, decimal b)\n\t{\n\t\twhile (true)\n\t\t{\n\t\t\tif (a < b)\n\t\t\t{\n\t\t\t\t(a, b) = (b, a);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// base case\n\t\t\tif (b == 0) return a;\n\n\t\t\tvar a1 = a;\n\t\t\ta = b;\n\t\t\tb = a1 - Math.Floor(a1 / b) * b;\n\t\t}\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class NumberGenerator : IDataGenerator\n{\n\tpublic static NumberGenerator Instance { get; } = n" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/ObjectGenerator.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/ObjectGenerator.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/ObjectGenerator.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\nusing Bogus;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class ObjectGenerator : IDataGenerator\n{\n\tprivate static readonly Faker _faker = new();\n\n\t// TODO: move these to a public settings object\n\tpublic static uint DefaultMinProperties { get; set; } = 0;\n\tpublic static uint DefaultMaxProperties { get; set; } = 10;\n\tpublic static uint DefaultMinContains { get; set; } = 1;\n\tpublic static uint DefaultMaxContains { get; set; } = 10;\n\n\tpublic static ObjectGenerator Instance { get; } = new();\n\tpublic SchemaValueType Type => SchemaValueType.Object;\n\n\tprivate ObjectGenerator() { }\n\n\tpublic GenerationResult Generate(RequirementsContext context)\n\t{\n\t\tvar propertyNameRequirements = context.PropertyNames;\n\t\tif (propertyNameRequirements?.HasConflict == true || propertyNameRequirements?.IsFalse == true)\n\t\t\treturn GenerationResult.Fail(\"No valid property names possible\");\n\n\t\tvar minProperties = DefaultMinProperties;\n\t\tvar maxProperties = DefaultMaxProperties;\n\t\tif (context.PropertyCounts != null)\n\t\t{\n\t\t\tif (!context.PropertyCounts.Ranges.Any()) return GenerationResult.Fail(\"No valid property counts possible\");\n\n\t\t\tvar numberRange = JsonSchemaExtensions.Randomizer.ArrayElement(context.PropertyCounts.Ranges.ToArray());\n\t\t\tif (numberRange.Minimum.Value != NumberRangeSet.MinRangeValue)\n\t\t\t\tminProperties = (uint)(numberRange.Minimum.Inclusive\n\t\t\t\t\t? numberRange.Minimum.Value\n\t\t\t\t\t: numberRange.Minimum.Value + 1);\n\t\t\tif (numberRange.Maximum.Value != NumberRangeSet.MaxRangeValue)\n\t\t\t\tmaxProperties = (uint)(numberRange.Maximum.Inclusive\n\t\t\t\t\t? numberRange.Maximum.Value\n\t\t\t\t\t: numberRange.Maximum.Value - 1);\n\t\t}\n\n\t\tvar propertyCount = (int)JsonSchemaExtensions.Randomizer.UInt(minProperties, maxProperties);\n\t\tvar containsCount = 0;\n\t\tif (context.Contains != null)\n\t\t{\n\t\t\tvar minContains = DefaultMinContains;\n\t\t\tvar maxContains = Math.Min(maxProperties, DefaultMaxContains + minContains);\n\t\t\tif (context.ContainsCounts != null)\n\t\t\t{\n\t\t\t\tvar numberRange = JsonSchemaExtensions.Randomizer.ArrayElement(context.ContainsCounts.Ranges.ToArray());\n\t\t\t\tif (numberRange.Minimum.Value != NumberRangeSet.MinRangeValue)\n\t\t\t\t\tminContains = (uint)numberRange.Minimum.Value;\n\t\t\t\tif (numberRange.Maximum.Value != NumberRangeSet.MaxRangeValue)\n\t\t\t\t\tmaxContains = (uint)numberRange.Maximum.Value;\n\t\t\t}\n\n\t\t\tif (minContains > maxContains) return GenerationResult.Fail(\"minContains is greater than maxContains\");\n\t\t\tif (minContains > maxProperties) return GenerationResult.Fail(\"minContains is greater than maxItems less property count\");\n\n\t\t\tcontainsCount = (int)JsonSchemaExtensions.Randomizer.UInt(minContains, maxContains);\n\t\t\tif (propertyCount < containsCount)\n\t\t\t\tpropertyCount = containsCount;\n\t\t}\n\n\t\tvar propertyGenerationResults = new Dictionary();\n\t\tvar propertyGenerationFailures = new List();\n\t\tvar definedPropertyNames = new List();\n\t\tvar remainingPropertyCount = propertyCount;\n\t\tif (context.RequiredProperties != null)\n\t\t{\n\t\t\tif (context.RequiredProperties.Any(x => !SatisfiesPropertyNameRequirements(x, propertyNameRequirements)))\n\t\t\t\treturn GenerationResult.Fail(\"Required property names do not satisfy propertyNames constraints\");\n\n\t\t\tdefinedPropertyNames.AddRange(context.RequiredProperties);\n\t\t\tremainingPropertyCount -= context.RequiredProperties.Count;\n\t\t}\n\n\t\tif (context.AvoidProperties != null)\n\t\t{\n\t\t\tforeach (var avoidProperty in context.AvoidProperties)\n\t\t\t{\n\t\t\t\tif (definedPropertyNames.Remove(avoidProperty))\n\t\t\t\t\tremainingPropertyCount++;\n\t\t\t}\n\t\t}\n\n\t\tif (context.Properties != null)\n\t\t{\n\t\t\tvar propertyNames = context.Properties\n\t\t\t\t.Where(x => !definedPropertyNames.Contains(x.Key) && !x.Value.IsFalse && !x.Value.HasConflict && SatisfiesPropertyNameRequirements(x.Key, propertyNameRequirements))\n\t\t\t\t.Select(x => x.Key)\n\t\t\t\t.ToArray();\n\t\t\tif (propertyNames.Length != 0)\n\t\t\t{\n\t\t\t\tpropertyNames = JsonSchemaExtensions.Randomizer.ArrayElements(propertyNames, Math.Min(propertyNames.Length, remainingPropertyCount));\n\t\t\t\tdefinedPropertyNames.AddRange(propertyNames);\n\t\t\t\tremainingPropertyCount -= propertyNames.Length;\n\t\t\t}\n\t\t}\n\n\t\tvar remainingProperties = context.RemainingProperties ?? new RequirementsContext();\n\t\tif (remainingProperties.IsFalse)\n\t\t\tremainingPropertyCount = 0;\n\t\tremainingPropertyCount = Math.Max(0, remainingPropertyCount);\n\n\t\tvar usedPropertyNames = new HashSet(definedPropertyNames);\n\t\tvar otherPropertyNames = GenerateAdditionalPropertyNames(remainingPropertyCount, usedPropertyNames, propertyNameRequirements);\n\t\tif (otherPropertyNames.Length != remainingPropertyCount)\n\t\t\treturn GenerationResult.Fail(\"Could not generate enough property names that satisfy propertyNames constraints\");\n\n\t\tvar allPropertyNames = definedPropertyNames.Concat(otherPropertyNames).ToArray();\n\t\tvar containsProperties = JsonSchemaExtensions.Randomizer\n\t\t\t.ArrayElements(allPropertyNames, Math.Min(allPropertyNames.Length, containsCount))", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\nusing Bogus;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ni" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/ObjectGenerator.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/ObjectGenerator.cs#L121-L234", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/ObjectGenerator.cs", + "startLine": 121, + "endLine": 234, + "content": ".ToHashSet();\n\n\t\tforeach (var propertyName in allPropertyNames)\n\t\t{\n\t\t\tif (context.Properties?.TryGetValue(propertyName, out var propertyRequirement) != true)\n\t\t\t\tpropertyRequirement = context.RemainingProperties ?? new RequirementsContext();\n\n\t\t\tif (containsCount > 0 && containsProperties.Contains(propertyName))\n\t\t\t{\n\t\t\t\tpropertyRequirement = new RequirementsContext(propertyRequirement!);\n\t\t\t\tpropertyRequirement.And(context.Contains!);\n\t\t\t}\n\n\t\t\tvar propertyGenerationResult = propertyRequirement!.GenerateData();\n\t\t\tif (!propertyGenerationResult.IsSuccess)\n\t\t\t{\n\t\t\t\tpropertyGenerationFailures.Add(GenerationResult.Fail([propertyGenerationResult], JsonPointer.Create(propertyName)));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tpropertyGenerationResults[propertyName] = propertyGenerationResult;\n\t\t}\n\n\t\tif (propertyGenerationFailures.Count != 0)\n\t\t\treturn GenerationResult.Fail(propertyGenerationFailures);\n\n\t\treturn GenerationResult.Success(new JsonObject(propertyGenerationResults.ToDictionary(x => x.Key, x => x.Value.Result?.DeepClone())));\n\t}\n\n\tprivate static bool SatisfiesPropertyNameRequirements(string propertyName, RequirementsContext? propertyNameRequirements)\n\t{\n\t\tif (propertyNameRequirements == null) return true;\n\t\tif (propertyNameRequirements.IsFalse || propertyNameRequirements.HasConflict) return false;\n\t\tif (propertyNameRequirements.Type.HasValue &&\n\t\t !propertyNameRequirements.Type.Value.HasFlag(SchemaValueType.String))\n\t\t\treturn false;\n\t\tif (propertyNameRequirements.StringLengths != null &&\n\t\t propertyNameRequirements.StringLengths.Ranges.Any() &&\n\t\t !propertyNameRequirements.StringLengths.Ranges.Any(x => x.Contains(propertyName.Length)))\n\t\t\treturn false;\n\n\t\tif (propertyNameRequirements.Patterns != null)\n\t\t{\n\t\t\tforeach (var pattern in propertyNameRequirements.Patterns)\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tif (!Regex.IsMatch(propertyName, pattern)) return false;\n\t\t\t\t}\n\t\t\t\tcatch (ArgumentException)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (propertyNameRequirements.AntiPatterns != null)\n\t\t{\n\t\t\tforeach (var antiPattern in propertyNameRequirements.AntiPatterns)\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tif (Regex.IsMatch(propertyName, antiPattern)) return false;\n\t\t\t\t}\n\t\t\t\tcatch (ArgumentException)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate static string[] GenerateAdditionalPropertyNames(int count, HashSet usedPropertyNames, RequirementsContext? propertyNameRequirements)\n\t{\n\t\tif (count <= 0) return [];\n\n\t\tif (propertyNameRequirements == null)\n\t\t{\n\t\t\treturn _faker.Lorem.Sentence(count * 2).Split(' ')\n\t\t\t\t.Distinct()\n\t\t\t\t.Where(x => !usedPropertyNames.Contains(x))\n\t\t\t\t.Take(count)\n\t\t\t\t.ToArray();\n\t\t}\n\n\t\tvar generatedNames = new List(count);\n\t\tfor (var i = 0; i < 100 && generatedNames.Count < count; i++)\n\t\t{\n\t\t\tvar nameRequirements = new RequirementsContext(propertyNameRequirements);\n\t\t\tnameRequirements.InferredType |= SchemaValueType.String;\n\t\t\tvar generationResult = nameRequirements.GenerateData();\n\t\t\tif (!generationResult.IsSuccess || generationResult.Result == null) continue;\n\n\t\t\tstring? candidate;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tcandidate = generationResult.Result.GetValue();\n\t\t\t}\n\t\t\tcatch\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (string.IsNullOrEmpty(candidate) || usedPropertyNames.Contains(candidate)) continue;\n\n\t\t\tusedPropertyNames.Add(candidate);\n\t\t\tgeneratedNames.Add(candidate);\n\t\t}\n\n\t\treturn generatedNames.ToArray();\n\t}\n}", + "snippet": ".ToHashSet();\n\n\t\tforeach (var propertyName in allPropertyNames)\n\t\t{\n\t\t\tif (context.Properties?.TryGetValue(propertyName, out var propertyRequirement) != true)\n\t\t\t\tpropertyRequirement = context.RemainingProperties ?? new " + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/RegexValueGenerator.cs (1/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/RegexValueGenerator.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/RegexValueGenerator.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing Bogus;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal static class RegexValueGenerator\n{\n\tprivate const int _maxPatternGenerationAttempts = 128;\n\tprivate const string _fallbackAlphabet = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -_./\";\n\tprivate static readonly Faker _faker = new();\n\n\tpublic static GenerationResult Generate(IEnumerable? requiredPatterns, IEnumerable? antiPatterns, string? format, uint minimum, uint maximum)\n\t{\n\t\tvar required = requiredPatterns?.Where(x => !string.IsNullOrWhiteSpace(x)).Distinct().ToList() ?? [];\n\t\tvar forbidden = antiPatterns?.Where(x => !string.IsNullOrWhiteSpace(x)).Distinct().ToList() ?? [];\n\n\t\tif (required.Count == 0 && forbidden.Count == 0)\n\t\t\treturn GenerationResult.Fail(\"No regex constraints were provided.\");\n\n\t\tvar requiredRegexes = new List(required.Count);\n\t\tforeach (var pattern in required)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\trequiredRegexes.Add(new Regex(pattern));\n\t\t\t}\n\t\t\tcatch (ArgumentException ex)\n\t\t\t{\n\t\t\t\treturn GenerationResult.Fail($\"Cannot parse required regex pattern '{pattern}': {ex.Message}\");\n\t\t\t}\n\t\t}\n\n\t\tvar antiRegexes = new List(forbidden.Count);\n\t\tforeach (var pattern in forbidden)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tantiRegexes.Add(new Regex(pattern));\n\t\t\t}\n\t\t\tcatch (ArgumentException ex)\n\t\t\t{\n\t\t\t\treturn GenerationResult.Fail($\"Cannot parse forbidden regex pattern '{pattern}': {ex.Message}\");\n\t\t\t}\n\t\t}\n\n\t\tbool IsValidCandidate(string candidate)\n\t\t{\n\t\t\tif (candidate.Length < minimum || candidate.Length > maximum)\n\t\t\t\treturn false;\n\n\t\t\tif (requiredRegexes.Any(regex => !regex.IsMatch(candidate)))\n\t\t\t\treturn false;\n\n\t\t\tif (antiRegexes.Any(regex => regex.IsMatch(candidate)))\n\t\t\t\treturn false;\n\n\t\t\tif (!string.IsNullOrEmpty(format) && !MatchesKnownFormat(candidate, format!))\n\t\t\t\treturn false;\n\n\t\t\treturn true;\n\t\t}\n\n\t\tfor (var i = 0; i < _maxPatternGenerationAttempts; i++)\n\t\t{\n\t\t\tvar candidate = CreatePatternCandidate(required, format, minimum, maximum);\n\t\t\tif (IsValidCandidate(candidate))\n\t\t\t\treturn GenerationResult.Success(candidate);\n\t\t}\n\n\t\treturn GenerationResult.Fail(\"Could not generate data matching combined regex constraints.\");\n\t}\n\n\tprivate static string CreatePatternCandidate(List requiredPatterns, string? format, uint minimum, uint maximum)\n\t{\n\t\tif (!string.IsNullOrWhiteSpace(format) && TryGenerateKnownFormatMatch(format, minimum, maximum, out var knownFormatMatch))\n\t\t\treturn knownFormatMatch;\n\n\t\tif (requiredPatterns.Count == 0)\n\t\t\treturn GenerateNoise((int)JsonSchemaExtensions.Randomizer.UInt(minimum, maximum));\n\n\t\tvar targetLength = (int)JsonSchemaExtensions.Randomizer.UInt(minimum, maximum);\n\n\t\t// Generate a fragment from every required pattern so that all are satisfied.\n\t\t// Anchored patterns govern the whole string, so only one can win — use the last one.\n\t\tstring? anchoredCore = null;\n\t\tvar fragments = new List(requiredPatterns.Count);\n\t\tforeach (var pattern in requiredPatterns)\n\t\t{\n\t\t\tvar alternatives = SplitTopLevelAlternatives(pattern);\n\t\t\tvar chosen = JsonSchemaExtensions.Randomizer.ArrayElement(alternatives.ToArray());\n\t\t\tvar fragment = GenerateFromRegexFragment(chosen, (int)maximum);\n\t\t\tif (IsAnchored(pattern))\n\t\t\t\tanchoredCore = fragment;\n\t\t\telse\n\t\t\t\tfragments.Add(fragment);\n\t\t}\n\n\t\tif (anchoredCore != null)\n\t\t\treturn anchoredCore;\n\n\t\t// Shuffle fragments so the sub-strings appear in random order.\n\t\tvar shuffled = JsonSchemaExtensions.Randomizer.Shuffle(fragments).ToList();\n\t\tvar core = string.Concat(shuffled);\n\n\t\tif (targetLength <= 0 || core.Length >= targetLength)\n\t\t\treturn core;\n\n\t\tvar extraLength = targetLength - core.Length;\n\t\t// Scatter fragments with noise between them for broader coverage.\n\t\tvar prefixLength = JsonSchemaExtensions.Randomizer.Int(0, extraLength);\n\t\tvar suffixLength = extraLength - prefixLength;\n\t\treturn $\"{GenerateNoise(prefixLength)}{core}{GenerateNoise(suffixLength)}\";\n\t}\n\n\tprivate static string GenerateNoise(int length)\n\t{", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing Bogus;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal static class RegexValue" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/RegexValueGenerator.cs (2/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/RegexValueGenerator.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/RegexValueGenerator.cs", + "startLine": 121, + "endLine": 240, + "content": "if (length <= 0) return string.Empty;\n\n\t\tvar chars = new char[length];\n\t\tfor (var i = 0; i < length; i++)\n\t\t{\n\t\t\tchars[i] = _fallbackAlphabet[JsonSchemaExtensions.Randomizer.Int(0, _fallbackAlphabet.Length - 1)];\n\t\t}\n\n\t\treturn new string(chars);\n\t}\n\n\tprivate static bool TryGenerateKnownFormatMatch(string? format, uint minimum, uint maximum, out string match)\n\t{\n\t\tList candidates =\n\t\t[\n\t\t\t_faker.Person.Email,\n\t\t\t_faker.Internet.UrlWithPath(),\n\t\t\tGuid.NewGuid().ToString(\"D\"),\n\t\t\t_faker.Internet.DomainName(),\n\t\t\t_faker.Internet.Ip(),\n\t\t\t_faker.Internet.Ipv6()\n\t\t];\n\n\t\tif (!string.IsNullOrWhiteSpace(format))\n\t\t{\n\t\t\tvar lowered = format!.ToLowerInvariant();\n\t\t\tcandidates = lowered switch\n\t\t\t{\n\t\t\t\t\"email\" or \"idn-email\" => [_faker.Person.Email],\n\t\t\t\t\"uri\" or \"iri\" or \"uri-reference\" or \"iri-reference\" => [_faker.Internet.UrlWithPath()],\n\t\t\t\t\"uuid\" => [Guid.NewGuid().ToString(\"D\")],\n\t\t\t\t\"hostname\" or \"idn-hostname\" => [_faker.Internet.DomainName()],\n\t\t\t\t\"ipv4\" => [_faker.Internet.Ip()],\n\t\t\t\t\"ipv6\" => [_faker.Internet.Ipv6()],\n\t\t\t\t_ => candidates\n\t\t\t};\n\t\t}\n\n\t\tforeach (var candidate in candidates)\n\t\t{\n\t\t\tif (candidate.Length < minimum || candidate.Length > maximum) continue;\n\n\t\t\tmatch = candidate;\n\t\t\treturn true;\n\t\t}\n\n\t\tmatch = string.Empty;\n\t\treturn false;\n\t}\n\n\tprivate static bool MatchesKnownFormat(string candidate, string format)\n\t{\n\t\tvar lowered = format.ToLowerInvariant();\n\t\treturn lowered switch\n\t\t{\n\t\t\t\"email\" or \"idn-email\" => candidate.Contains(\"@\"),\n\t\t\t\"uri\" or \"iri\" => Uri.TryCreate(candidate, UriKind.Absolute, out _),\n\t\t\t\"uri-reference\" or \"iri-reference\" => Uri.TryCreate(candidate, UriKind.RelativeOrAbsolute, out _),\n\t\t\t\"uuid\" => Guid.TryParse(candidate, out _),\n\t\t\t\"hostname\" or \"idn-hostname\" => candidate.Contains('.'),\n\t\t\t\"ipv4\" => candidate.Count(x => x == '.') == 3,\n\t\t\t\"ipv6\" => candidate.Contains(':'),\n\t\t\t_ => true\n\t\t};\n\t}\n\n\tprivate static string GenerateFromRegexFragment(string pattern, int maxLength)\n\t{\n\t\tif (string.IsNullOrEmpty(pattern) || maxLength <= 0)\n\t\t\treturn string.Empty;\n\n\t\tvar sb = new StringBuilder(Math.Min(pattern.Length, maxLength));\n\t\tvar i = 0;\n\t\twhile (i < pattern.Length && sb.Length < maxLength)\n\t\t{\n\t\t\tvar c = pattern[i];\n\t\t\tif (c is '^' or '$')\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar token = GenerateSingleToken(pattern, ref i, maxLength - sb.Length);\n\t\t\tvar repeats = ReadQuantifier(pattern, ref i, token.Length == 0 ? 0 : (maxLength - sb.Length) / Math.Max(token.Length, 1));\n\t\t\tfor (var j = 0; j < repeats && sb.Length + token.Length <= maxLength; j++)\n\t\t\t{\n\t\t\t\tsb.Append(token);\n\t\t\t}\n\t\t}\n\n\t\treturn sb.ToString();\n\t}\n\n\tprivate static string GenerateSingleToken(string pattern, ref int index, int maxTokenLength)\n\t{\n\t\tif (index >= pattern.Length || maxTokenLength <= 0)\n\t\t\treturn string.Empty;\n\n\t\tvar c = pattern[index];\n\t\tif (c == '\\\\')\n\t\t{\n\t\t\tindex++;\n\t\t\tif (index >= pattern.Length) return \"\\\\\";\n\n\t\t\tvar escaped = pattern[index++];\n\t\t\treturn escaped switch\n\t\t\t{\n\t\t\t\t'd' => RandomChar(\"0123456789\").ToString(),\n\t\t\t\t'w' => RandomChar(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\").ToString(),\n\t\t\t\t's' => \" \",\n\t\t\t\t'D' => RandomChar(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\").ToString(),\n\t\t\t\t'W' => RandomChar(\".-/ \").ToString(),\n\t\t\t\t'S' => RandomChar(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\").ToString(),\n\t\t\t\t_ => escaped.ToString()\n\t\t\t};\n\t\t}\n\n\t\tif (c == '[')\n\t\t{\n\t\t\tindex++;", + "snippet": "if (length <= 0) return string.Empty;\n\n\t\tvar chars = new char[length];\n\t\tfor (var i = 0; i < length; i++)\n\t\t{\n\t\t\tchars[i] = _fallbackAlphabet[JsonSchemaExtensions.Randomizer.Int(0, _fallbackAlphabet.Length - 1)];\n\t\t}\n\n\t\t" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/RegexValueGenerator.cs (3/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/RegexValueGenerator.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/RegexValueGenerator.cs", + "startLine": 241, + "endLine": 360, + "content": "var characterClass = ReadCharacterClass(pattern, ref index);\n\t\t\treturn characterClass.Length == 0 ? string.Empty : RandomChar(characterClass).ToString();\n\t\t}\n\n\t\tif (c == '(')\n\t\t{\n\t\t\tvar group = ReadGroup(pattern, ref index);\n\t\t\tvar alternatives = SplitTopLevelAlternatives(group);\n\t\t\tvar chosen = JsonSchemaExtensions.Randomizer.ArrayElement(alternatives.ToArray());\n\t\t\treturn GenerateFromRegexFragment(chosen, maxTokenLength);\n\t\t}\n\n\t\tif (c == '.')\n\t\t{\n\t\t\tindex++;\n\t\t\treturn RandomChar(_fallbackAlphabet).ToString();\n\t\t}\n\n\t\tindex++;\n\t\treturn c.ToString();\n\t}\n\n\tprivate static int ReadQuantifier(string pattern, ref int index, int maxRepeats)\n\t{\n\t\tif (maxRepeats <= 0)\n\t\t\treturn 0;\n\t\tif (index >= pattern.Length)\n\t\t\treturn 1;\n\n\t\tvar c = pattern[index];\n\t\tint min;\n\t\tint max;\n\t\tswitch (c)\n\t\t{\n\t\t\tcase '*':\n\t\t\t\tindex++;\n\t\t\t\tmin = 0;\n\t\t\t\tmax = 3;\n\t\t\t\tbreak;\n\t\t\tcase '+':\n\t\t\t\tindex++;\n\t\t\t\tmin = 1;\n\t\t\t\tmax = 3;\n\t\t\t\tbreak;\n\t\t\tcase '?':\n\t\t\t\tindex++;\n\t\t\t\tmin = 0;\n\t\t\t\tmax = 1;\n\t\t\t\tbreak;\n\t\t\tcase '{':\n\t\t\t\t(index, min, max) = ParseExplicitQuantifier(pattern, index);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn 1;\n\t\t}\n\n\t\tmax = Math.Min(max, Math.Max(min, maxRepeats));\n\t\treturn JsonSchemaExtensions.Randomizer.Int(min, max);\n\t}\n\n\tprivate static (int NextIndex, int Min, int Max) ParseExplicitQuantifier(string pattern, int index)\n\t{\n\t\tvar closeBrace = pattern.IndexOf('}', index);\n\t\tif (closeBrace == -1) return (index, 1, 1);\n\n\t\tvar content = pattern.Substring(index + 1, closeBrace - index - 1);\n\t\tvar parts = content.Split(',');\n\t\tif (!int.TryParse(parts[0], out var min)) return (closeBrace + 1, 1, 1);\n\n\t\tint max;\n\t\tif (parts.Length == 1)\n\t\t\tmax = min;\n\t\telse if (string.IsNullOrWhiteSpace(parts[1]))\n\t\t\tmax = min + 5;\n\t\telse if (!int.TryParse(parts[1], out max))\n\t\t\tmax = min;\n\n\t\tif (max < min) max = min;\n\t\treturn (closeBrace + 1, min, max);\n\t}\n\n\tprivate static string ReadCharacterClass(string pattern, ref int index)\n\t{\n\t\tvar builder = new StringBuilder();\n\t\tvar isNegated = index < pattern.Length && pattern[index] == '^';\n\t\tif (isNegated) index++;\n\n\t\twhile (index < pattern.Length && pattern[index] != ']')\n\t\t{\n\t\t\tif (index + 2 < pattern.Length && pattern[index + 1] == '-' && pattern[index + 2] != ']')\n\t\t\t{\n\t\t\t\tvar start = pattern[index];\n\t\t\t\tvar end = pattern[index + 2];\n\t\t\t\tif (start <= end)\n\t\t\t\t{\n\t\t\t\t\tfor (var c = start; c <= end; c++)\n\t\t\t\t\t\tbuilder.Append(c);\n\t\t\t\t}\n\t\t\t\tindex += 3;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (pattern[index] == '\\\\' && index + 1 < pattern.Length)\n\t\t\t{\n\t\t\t\tindex++;\n\t\t\t\tbuilder.Append(pattern[index]);\n\t\t\t\tindex++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tbuilder.Append(pattern[index]);\n\t\t\tindex++;\n\t\t}\n\n\t\tif (index < pattern.Length && pattern[index] == ']')\n\t\t\tindex++;\n\n\t\tvar characters = builder.Length == 0 ? _fallbackAlphabet : builder.ToString();\n\t\tif (!isNegated) return characters;", + "snippet": "var characterClass = ReadCharacterClass(pattern, ref index);\n\t\t\treturn characterClass.Length == 0 ? string.Empty : RandomChar(characterClass).ToString();\n\t\t}\n\n\t\tif (c == '(')\n\t\t{\n\t\t\tvar group = ReadGroup(pattern, ref ind" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/RegexValueGenerator.cs (4/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/RegexValueGenerator.cs#L361-L467", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/RegexValueGenerator.cs", + "startLine": 361, + "endLine": 467, + "content": "var negated = new string(_fallbackAlphabet.Where(c => !characters.Contains(c)).ToArray());\n\t\treturn string.IsNullOrEmpty(negated) ? _fallbackAlphabet : negated;\n\t}\n\n\tprivate static string ReadGroup(string pattern, ref int index)\n\t{\n\t\tindex++; // (\n\t\tif (index < pattern.Length - 1 && pattern[index] == '?' && pattern[index + 1] == ':')\n\t\t\tindex += 2;\n\n\t\tvar depth = 1;\n\t\tvar start = index;\n\t\tvar inCharacterClass = false;\n\t\twhile (index < pattern.Length)\n\t\t{\n\t\t\tvar c = pattern[index];\n\t\t\tif (c == '\\\\')\n\t\t\t{\n\t\t\t\tindex += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (c == '[')\n\t\t\t\tinCharacterClass = true;\n\t\t\telse if (c == ']')\n\t\t\t\tinCharacterClass = false;\n\n\t\t\tif (!inCharacterClass)\n\t\t\t{\n\t\t\t\tif (c == '(') depth++;\n\t\t\t\tif (c == ')')\n\t\t\t\t{\n\t\t\t\t\tdepth--;\n\t\t\t\t\tif (depth == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar groupContent = pattern.Substring(start, index - start);\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\treturn groupContent;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tindex++;\n\t\t}\n\n\t\treturn pattern.Substring(start);\n\t}\n\n\tprivate static IEnumerable SplitTopLevelAlternatives(string pattern)\n\t{\n\t\tif (string.IsNullOrEmpty(pattern)) return [string.Empty];\n\n\t\tvar parts = new List();\n\t\tvar depth = 0;\n\t\tvar inCharacterClass = false;\n\t\tvar escaped = false;\n\t\tvar segmentStart = 0;\n\n\t\tfor (var i = 0; i < pattern.Length; i++)\n\t\t{\n\t\t\tvar c = pattern[i];\n\t\t\tif (escaped)\n\t\t\t{\n\t\t\t\tescaped = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (c == '\\\\')\n\t\t\t{\n\t\t\t\tescaped = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (c == '[')\n\t\t\t\tinCharacterClass = true;\n\t\t\telse if (c == ']')\n\t\t\t\tinCharacterClass = false;\n\n\t\t\tif (inCharacterClass)\n\t\t\t\tcontinue;\n\n\t\t\tif (c == '(') depth++;\n\t\t\telse if (c == ')') depth--;\n\t\t\telse if (c == '|' && depth == 0)\n\t\t\t{\n\t\t\t\tparts.Add(pattern.Substring(segmentStart, i - segmentStart));\n\t\t\t\tsegmentStart = i + 1;\n\t\t\t}\n\t\t}\n\n\t\tparts.Add(pattern.Substring(segmentStart));\n\t\treturn parts;\n\t}\n\n\tprivate static bool IsAnchored(string pattern)\n\t{\n\t\tif (string.IsNullOrEmpty(pattern)) return false;\n\t\treturn pattern[0] == '^' && pattern[^1] == '$';\n\t}\n\n\tprivate static char RandomChar(string chars)\n\t{\n\t\tif (string.IsNullOrEmpty(chars)) return 'a';\n\t\treturn chars[JsonSchemaExtensions.Randomizer.Int(0, chars.Length - 1)];\n\t}\n}", + "snippet": "var negated = new string(_fallbackAlphabet.Where(c => !characters.Contains(c)).ToArray());\n\t\treturn string.IsNullOrEmpty(negated) ? _fallbackAlphabet : negated;\n\t}\n\n\tprivate static string ReadGroup(string pattern, ref in" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/StringGenerator.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/StringGenerator.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/StringGenerator.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Bogus;\nusing Bogus.Extensions;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class StringGenerator : IDataGenerator\n{\n\tprivate const int _maxStringLength = 1000;\n\tprivate static readonly NumberRangeSet _defaultRange = NumberRangeSet.NonNegative.Floor(0).Ceiling(_maxStringLength);\n\tprivate static readonly Faker _faker = new();\n\tprivate static readonly Dictionary> _formatGenerators =\n\t\tnew()\n\t\t{\n\t\t\t[Formats.Date.Key] = GenerateDate,\n\t\t\t[Formats.DateTime.Key] = GenerateDateTime,\n\t\t\t[Formats.Duration.Key] = GenerateDuration,\n\t\t\t[Formats.Email.Key] = GenerateEmail,\n\t\t\t[Formats.Hostname.Key] = GenerateHostname,\n\t\t\t[Formats.IdnEmail.Key] = GenerateEmail,\n\t\t\t[Formats.IdnHostname.Key] = GenerateHostname,\n\t\t\t[Formats.Ipv4.Key] = GenerateIpv4,\n\t\t\t[Formats.Ipv6.Key] = GenerateIpv6,\n\t\t\t[Formats.Iri.Key] = GenerateUri,\n\t\t\t[Formats.IriReference.Key] = GenerateUriReference,\n\t\t\t[Formats.JsonPointer.Key] = GenerateJsonPointer,\n\t\t\t[Formats.RelativeJsonPointer.Key] = GenerateRelativeJsonPointer,\n\t\t\t[Formats.Time.Key] = GenerateTime,\n\t\t\t[Formats.Uri.Key] = GenerateUri,\n\t\t\t[Formats.UriReference.Key] = GenerateUriReference,\n\t\t\t[Formats.Uuid.Key] = GenerateUuid\n\t\t};\n\n\t// TODO: move these to a public settings object\n\tpublic static uint DefaultMinLength { get; set; } = 0;\n\tpublic static uint DefaultMaxLength { get; set; } = 100;\n\n\tpublic static StringGenerator Instance { get; } = new();\n\n\tprivate StringGenerator() { }\n\n\tpublic SchemaValueType Type => SchemaValueType.String;\n\n\tpublic GenerationResult Generate(RequirementsContext context)\n\t{\n\t\tvar ranges = context.StringLengths ?? _defaultRange;\n\t\tvar range = JsonSchemaExtensions.Randomizer.ArrayElement(ranges.Ranges.ToArray());\n\t\tvar minimum = range.Minimum.Value != NumberRangeSet.MinRangeValue\n\t\t\t? (uint)Math.Max(0, (long)range.Minimum.Value + (range.Minimum.Inclusive ? 0 : 1))\n\t\t\t: Math.Max(0, DefaultMinLength);\n\t\tvar maximum = range.Maximum.Value != NumberRangeSet.MaxRangeValue\n\t\t\t? (uint)Math.Min(_maxStringLength, Math.Max(0, (long)range.Maximum.Value - (range.Maximum.Inclusive ? 0 : 1)))\n\t\t\t: Math.Min(_maxStringLength, DefaultMaxLength);\n\n\t\tif (minimum > maximum)\n\t\t\treturn GenerationResult.Fail(\"No valid string lengths possible\", schemaLocations: context.StringLengthsSource.HasValue ? [context.StringLengthsSource.Value] : null);\n\n\t\tif ((context.Patterns?.Count ?? 0) > 0 || (context.AntiPatterns?.Count ?? 0) > 0)\n\t\t\treturn RegexValueGenerator.Generate(context.Patterns, context.AntiPatterns, context.Format, minimum, maximum);\n\n\t\tif (context.Format != null)\n\t\t{\n\t\t\tif (!_formatGenerators.TryGetValue(context.Format, out var generate))\n\t\t\t\treturn GenerationResult.Fail($\"Cannot generate data for format '{context.Format}'\", schemaLocations: context.FormatSource.HasValue ? [context.FormatSource.Value] : null);\n\n\t\t\treturn GenerationResult.Success(generate(range));\n\t\t}\n\n\t\tvar data = _faker.Lorem.Text().ClampLength((int)minimum, (int)maximum);\n\t\treturn GenerationResult.Success(data);\n\t}\n\n\tprivate static JsonNode? GenerateDate(NumberRange numberRange)\n\t{\n\t\treturn _faker.Date.Recent().ToString(\"yyyy-MM-dd\");\n\t}\n\n\tprivate static JsonNode? GenerateDateTime(NumberRange numberRange)\n\t{\n\t\treturn _faker.Date.Recent().ToString(\"O\");\n\t}\n\n\tprivate static JsonNode? GenerateDuration(NumberRange arg)\n\t{\n\t\tvar days = JsonSchemaExtensions.Randomizer.Int(0, 6);\n\t\tvar hours = JsonSchemaExtensions.Randomizer.Int(0, 23);\n\t\tvar minutes = JsonSchemaExtensions.Randomizer.Int(0, 59);\n\t\tvar seconds = JsonSchemaExtensions.Randomizer.Int(0, 59);\n\n\t\treturn $\"P{days}DT{hours}H{minutes}M{seconds}S\";\n\t}\n\n\tprivate static JsonNode? GenerateEmail(NumberRange arg)\n\t{\n\t\treturn _faker.Person.Email;\n\t}\n\n\tprivate static JsonNode? GenerateHostname(NumberRange arg)\n\t{\n\t\treturn _faker.Internet.DomainName();\n\t}\n\n\tprivate static JsonNode? GenerateIpv4(NumberRange arg)\n\t{\n\t\treturn _faker.Internet.Ip();\n\t}\n\n\tprivate static JsonNode? GenerateIpv6(NumberRange arg)\n\t{\n\t\treturn _faker.Internet.Ipv6();\n\t}\n\n\tprivate static JsonNode? GenerateJsonPointer(NumberRange arg)\n\t{\n\t\tvar segmentCount = JsonSchemaExtensions.Randomizer.Int(0, 10);\n\t\tvar segments = Enumerable.Range(0, segmentCount)\n\t\t\t.Select(_ => JsonSchemaExtensions.Randomizer.UInt(0, 2) == 0", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Bogus;\nusing Bogus.Extensions;\n\nnamespace Json.Schema.DataGeneration.Generators;\n\ninternal class StringGenerator : ID" + }, + { + "title": "src/JsonSchema.DataGeneration/Generators/StringGenerator.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Generators/StringGenerator.cs#L121-L153", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Generators/StringGenerator.cs", + "startLine": 121, + "endLine": 153, + "content": "? JsonSchemaExtensions.Randomizer.UInt(0, 10).ToString()\n\t\t\t\t: _faker.Lorem.Word());\n\n\t\treturn $\"/{string.Join(\"/\", segments)}\";\n\t}\n\n\tprivate static JsonNode? GenerateRelativeJsonPointer(NumberRange arg)\n\t{\n\t\tvar countUp = JsonSchemaExtensions.Randomizer.Int(0, 7);\n\t\tvar pointer = GenerateJsonPointer(arg);\n\t\treturn $\"{countUp}{pointer!.GetValue()}\";\n\t}\n\n\tprivate static JsonNode? GenerateTime(NumberRange arg)\n\t{\n\t\treturn _faker.Date.Recent().ToString(\"HH':'mm':'ssZ\");\n\t}\n\n\tprivate static JsonNode? GenerateUri(NumberRange arg)\n\t{\n\t\treturn _faker.Internet.UrlWithPath();\n\t}\n\n\tprivate static JsonNode? GenerateUriReference(NumberRange arg)\n\t{\n\t\treturn _faker.Internet.UrlWithPath();\n\t}\n\n\tprivate static JsonNode? GenerateUuid(NumberRange arg)\n\t{\n\t\treturn Guid.NewGuid().ToString(\"D\");\n\t}\n}", + "snippet": "? JsonSchemaExtensions.Randomizer.UInt(0, 10).ToString()\n\t\t\t\t: _faker.Lorem.Word());\n\n\t\treturn $\"/{string.Join(\"/\", segments)}\";\n\t}\n\n\tprivate static JsonNode? GenerateRelativeJsonPointer(NumberRange arg)\n\t{\n\t\tvar countUp" + }, + { + "title": "src/JsonSchema.DataGeneration/HelperExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/HelperExtensions.cs#L1-L22", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/HelperExtensions.cs", + "startLine": 1, + "endLine": 22, + "content": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.DataGeneration;\n\ninternal static class HelperExtensions\n{\n\tpublic static string RequireOne(string pattern) => $\"(?=.*({pattern}))\";\n\tpublic static string ForbidOne(string pattern) => $\"((?!{pattern}).)*\";\n\n\tpublic static string Require(IEnumerable patterns) => string.Concat(patterns.Select(RequireOne));\n\tpublic static string Forbid(IEnumerable patterns) => string.Concat(patterns.Select(ForbidOne));\n\n\tpublic static KeywordData? GetKeyword(this JsonSchemaNode schema)\n\t\twhere T : IKeywordHandler =>\n\t\tschema.Keywords.FirstOrDefault(x => x.Handler.GetType() == typeof(T));\n\n\tpublic static KeywordData? GetKeyword(this JsonSchemaNode schema, string keywordName)\n\t{\n\t\treturn schema.Keywords.FirstOrDefault(x => x.Handler.Name == keywordName);\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.DataGeneration;\n\ninternal static class HelperExtensions\n{\n\tpublic static string RequireOne(string pattern) => $\"(?=.*({pattern}))\";\n\tpublic stat" + }, + { + "title": "src/JsonSchema.DataGeneration/IDataGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/IDataGenerator.cs#L1-L8", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/IDataGenerator.cs", + "startLine": 1, + "endLine": 8, + "content": "namespace Json.Schema.DataGeneration;\n\ninternal interface IDataGenerator\n{\n\tSchemaValueType Type { get; }\n\n\tGenerationResult Generate(RequirementsContext context);\n}", + "snippet": "namespace Json.Schema.DataGeneration;\n\ninternal interface IDataGenerator\n{\n\tSchemaValueType Type { get; }\n\n\tGenerationResult Generate(RequirementsContext context);\n}" + }, + { + "title": "src/JsonSchema.DataGeneration/IPrioritizedDataGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/IPrioritizedDataGenerator.cs#L1-L7", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/IPrioritizedDataGenerator.cs", + "startLine": 1, + "endLine": 7, + "content": "namespace Json.Schema.DataGeneration;\n\ninternal interface IPrioritizedDataGenerator\n{\n\tbool Applies(RequirementsContext context);\n\tGenerationResult Generate(RequirementsContext context);\n}", + "snippet": "namespace Json.Schema.DataGeneration;\n\ninternal interface IPrioritizedDataGenerator\n{\n\tbool Applies(RequirementsContext context);\n\tGenerationResult Generate(RequirementsContext context);\n}" + }, + { + "title": "src/JsonSchema.DataGeneration/IRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/IRequirementsGatherer.cs#L1-L6", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/IRequirementsGatherer.cs", + "startLine": 1, + "endLine": 6, + "content": "namespace Json.Schema.DataGeneration;\n\ninternal interface IRequirementsGatherer\n{\n\tvoid AddRequirements(RequirementsContext context, JsonSchemaNode schema);\n}", + "snippet": "namespace Json.Schema.DataGeneration;\n\ninternal interface IRequirementsGatherer\n{\n\tvoid AddRequirements(RequirementsContext context, JsonSchemaNode schema);\n}" + }, + { + "title": "src/JsonSchema.DataGeneration/JsonSchemaExtensions.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/JsonSchemaExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/JsonSchemaExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Bogus;\nusing Json.Pointer;\nusing Json.Schema.DataGeneration.Generators;\nusing Json.Schema.DataGeneration.Requirements;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration;\n\n/// \n/// Provides extension methods for to generate sample data.\n/// \npublic static class JsonSchemaExtensions\n{\n\tprivate static readonly IPrioritizedDataGenerator[] _priorityGenerators =\n\t{\n\t\tConstGenerator.Instance,\n\t\tEnumGenerator.Instance\n\t};\n\t// simplest weighting is just to duplicate entries\n\tprivate static readonly IDataGenerator[] _generators =\n\t{\n\t\tObjectGenerator.Instance,\n\t\tArrayGenerator.Instance,\n\t\tIntegerGenerator.Instance,\n\t\tIntegerGenerator.Instance,\n\t\tNumberGenerator.Instance,\n\t\tNumberGenerator.Instance,\n\t\tStringGenerator.Instance,\n\t\tStringGenerator.Instance,\n\t\tBooleanGenerator.Instance,\n\t\tBooleanGenerator.Instance,\n\t\tNullGenerator.Instance,\n\t\tNullGenerator.Instance,\n\t};\n\n\tinternal static readonly Randomizer Randomizer = new();\n\n\t/// \n\t/// Attempts to generate sample data that meets the requirements of the schema.\n\t/// \n\t/// The schema.\n\t/// not used\n\t/// A result object indicating success and containing the result or error message.\n\t[Obsolete(\"Options is no longer used. Parameter will be removed at next major version.\")]\n\tpublic static GenerationResult GenerateData(this JsonSchema schema, BuildOptions? options) => schema.GenerateData();\n\n\t/// \n\t/// Attempts to generate sample data that meets the requirements of the schema.\n\t/// \n\t/// The schema.\n\t/// A result object indicating success and containing the result or error message.\n\tpublic static GenerationResult GenerateData(this JsonSchema schema)\n\t{\n\t\tvar requirements = schema.Root.GetRequirements(new RequirementsContext { RemainingRefDepth = RequirementsContext.RecursiveRefHardStop });\n\n\t\treturn requirements.GenerateData();\n\t}\n\n\tinternal static GenerationResult GenerateData(this RequirementsContext requirements)\n\t{\n\t\tif (requirements.IsFalse)\n\t\t\treturn GenerationResult.Fail(\"Boolean schema `false` allows no values\");\n\n\t\tvar failures = new List();\n\t\tvar conflictVariations = 0;\n\t\tvar noGeneratorVariations = 0;\n\t\tforeach (var variation in Randomizer.Shuffle(requirements.GetAllVariations()))\n\t\t{\n\t\t\tif (variation.HasConflict)\n\t\t\t{\n\t\t\t\tconflictVariations++;\n\t\t\t\tif (failures.Count < 5)\n\t\t\t\t{\n\t\t\t\t\tif (variation.ErrorReasons != null && variation.ErrorReasons.Count != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tforeach (var reason in variation.ErrorReasons)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (failures.Count >= 5) break;\n\t\t\t\t\t\t\tvar schemaLocations = new List(2);\n\t\t\t\t\t\t\tif (reason.LeftSchemaLocation.HasValue)\n\t\t\t\t\t\t\t\tschemaLocations.Add(reason.LeftSchemaLocation.Value);\n\t\t\t\t\t\t\tif (reason.RightSchemaLocation.HasValue)\n\t\t\t\t\t\t\t\tschemaLocations.Add(reason.RightSchemaLocation.Value);\n\t\t\t\t\t\t\tfailures.Add(GenerationResult.Fail(reason.Message, schemaLocations: schemaLocations.Count != 0 ? schemaLocations : null));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tfailures.Add(GenerationResult.Fail(\"Conflicting constraints were detected while combining schema requirements.\"));\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar priorityGenerator = _priorityGenerators.FirstOrDefault(x => x.Applies(variation));\n\t\t\tif (priorityGenerator != null)\n\t\t\t\treturn priorityGenerator.Generate(variation);\n\n\t\t\tvar applicableGenerators = _generators\n\t\t\t\t.Where(x =>\n\t\t\t\t{\n\t\t\t\t\tif (variation.Type.HasValue) return variation.Type.Value.HasFlag(x.Type);\n\t\t\t\t\tif (variation.InferredType == default) return true;\n\t\t\t\t\treturn variation.InferredType.HasFlag(x.Type);\n\t\t\t\t})\n\t\t\t\t.ToArray();\n\t\t\tif (applicableGenerators.Length == 0)\n\t\t\t{\n\t\t\t\tnoGeneratorVariations++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar generator = Randomizer.ArrayElement(applicableGenerators);\n\t\t\tvar result = generator.Generate(variation);\n\t\t\tif (result.IsSuccess) return result;\n\t\t\tif (failures.Count < 5)\n\t\t\t\tfailures.Add(result);\n\t\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Bogus;\nusing Json.Pointer;\nusing Json.Schema.DataGeneration.Generators;\nusing Json.Schema.DataGeneration.Requirements;\nusing Json.Schema.Keywords;\n" + }, + { + "title": "src/JsonSchema.DataGeneration/JsonSchemaExtensions.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/JsonSchemaExtensions.cs#L121-L194", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/JsonSchemaExtensions.cs", + "startLine": 121, + "endLine": 194, + "content": "return failures.Count > 0\n\t\t\t? GenerationResult.Fail(failures)\n\t\t\t: GenerationResult.Fail($\"Could not generate data that validates against the schema. Tried {conflictVariations + noGeneratorVariations} variation(s): {conflictVariations} conflicting variation(s), {noGeneratorVariations} variation(s) had no applicable generator.\");\n\t}\n\n\tprivate static readonly IRequirementsGatherer[] _requirementsGatherers =\n\t[\n\t\tnew AllOfRequirementsGatherer(),\n\t\t\t\tnew AnyOfRequirementsGatherer(),\n\t\t\t\tnew ConditionalRequirementsGatherer(),\n\t\t\t\tnew ConstRequirementsGatherer(),\n\t\t\t\tnew ContainsRequirementsGatherer(),\n\t\t\t\tnew EnumRequirementsGatherer(),\n\t\t\t\tnew FalseRequirementsGatherer(),\n\t\t\t\tnew ItemsRequirementsGatherer(),\n\t\t\t\tnew NotRequirementsGatherer(),\n\t\t\t\tnew NumberRequirementsGatherer(),\n\t\t\t\tnew OneOfRequirementsGatherer(),\n\t\t\t\tnew PropertiesRequirementsGatherer(),\n\t\t\t\tnew RefRequirementsGatherer(),\n\t\t\t\tnew StringRequirementsGatherer(),\n\t\t\t\tnew TypeRequirementsGatherer()\n\t];\n\n\tinternal static RequirementsContext GetRequirements(this JsonSchemaNode schema, RequirementsContext? context = null)\n\t{\n\t\tcontext ??= new RequirementsContext { RemainingRefDepth = RequirementsContext.RecursiveRefHardStop };\n\n\t\tvar enteredResource = context.EnterDynamicResource(schema.BaseUri);\n\t\tif (enteredResource)\n\t\t\tCaptureDynamicAnchors(context, schema, schema.BaseUri);\n\n\t\ttry\n\t\t{\n\t\t\tforeach (var gatherer in _requirementsGatherers)\n\t\t\t{\n\t\t\t\tgatherer.AddRequirements(context, schema);\n\t\t\t}\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tif (enteredResource)\n\t\t\t\tcontext.ExitDynamicResource();\n\t\t}\n\n\t\treturn context;\n\t}\n\n\tprivate static void CaptureDynamicAnchors(RequirementsContext context, JsonSchemaNode resourceRoot, Uri resourceUri)\n\t{\n\t\tvar toCheck = new Queue();\n\t\ttoCheck.Enqueue(resourceRoot);\n\n\t\tvar checkedNodes = new HashSet();\n\t\twhile (toCheck.Count != 0)\n\t\t{\n\t\t\tvar current = toCheck.Dequeue();\n\t\t\tif (!checkedNodes.Add(current)) continue;\n\t\t\tif (current.BaseUri != resourceUri) continue;\n\n\t\t\tvar dynamicAnchorKeyword = current.GetKeyword();\n\t\t\tif (dynamicAnchorKeyword?.Value is string anchor)\n\t\t\t\tcontext.CaptureDynamicAnchor(anchor, current);\n\n\t\t\tforeach (var keyword in current.Keywords)\n\t\t\t{\n\t\t\t\tforeach (var subschema in keyword.Subschemas)\n\t\t\t\t{\n\t\t\t\t\ttoCheck.Enqueue(subschema);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "return failures.Count > 0\n\t\t\t? GenerationResult.Fail(failures)\n\t\t\t: GenerationResult.Fail($\"Could not generate data that validates against the schema. Tried {conflictVariations + noGeneratorVariations} variation(s): {con" + }, + { + "title": "src/JsonSchema.DataGeneration/NumberRange.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/NumberRange.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/NumberRange.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\n\nnamespace Json.Schema.DataGeneration;\n\n/// \n/// Defines a number range.\n/// \npublic readonly struct NumberRange : IEquatable\n{\n\t/// \n\t/// Gets the minimum (lower bound).\n\t/// \n\tpublic Bound Minimum { get; }\n\t/// \n\t/// Gets the maximum (upper bound).\n\t/// \n\tpublic Bound Maximum { get; }\n\n\t/// \n\t/// Creates a new number range.\n\t/// \n\t/// The minimum\n\t/// The maximum\n\tpublic NumberRange(Bound minimum, Bound maximum)\n\t{\n\t\tif (minimum > maximum)\n\t\t{\n\t\t\tMinimum = maximum;\n\t\t\tMaximum = minimum;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tMinimum = minimum;\n\t\t\tMaximum = maximum;\n\t\t}\n\t}\n\n\t/// \n\t/// Calculates the intersection of two number ranges. May be multiple ranges.\n\t/// \n\t/// The resulting set of ranges that exist in both parameters.\n\tpublic static IEnumerable Intersection(NumberRange a, NumberRange b)\n\t{\n\t\t// a should have the lower bound. if not, then swap\n\t\tif (b.Minimum < a.Minimum)\n\t\t\treturn Intersection(b, a);\n\n\t\t// disjoint: a1 a2 b1 b2 -> none\n\t\tif (a.Maximum < b.Minimum)\n\t\t\treturn [];\n\n\t\t// tangent: a1 a2b1 b2\n\t\tif (a.Maximum.Value == b.Minimum.Value)\n\t\t{\n\t\t\t// if both are inclusive -> just the single value\n\t\t\tif (a.Maximum.Inclusive && b.Minimum.Inclusive)\n\t\t\t\treturn [new NumberRange(a.Maximum, a.Maximum)];\n\n\t\t\t// otherwise disjoint\n\t\t\treturn [];\n\t\t}\n\n\t\tvar largestMinimum = Bound.Maximum(a.Minimum, b.Minimum);\n\t\tvar smallestMaximum = Bound.Minimum(a.Maximum, b.Maximum);\n\n\t\treturn [new NumberRange(largestMinimum, smallestMaximum)];\n\t}\n\n\t/// \n\t/// Calculates the union of two number ranges. May be multiple ranges.\n\t/// \n\t/// The resulting set of ranges that exist in either parameters.\n\tpublic static IEnumerable Union(NumberRange a, NumberRange b)\n\t{\n\t\t// a should have the lower bound. if not, then swap\n\t\tif (b.Minimum < a.Minimum) return Union(b, a);\n\n\t\t// disjoint: a1 a2 b1 b2 -> a1..a2, b1..b2\n\t\tif (a.Maximum.Value != b.Minimum.Value && a.Maximum < b.Minimum) return [a, b];\n\n\t\t// tangent: a1 a2b1 b2\n\t\tif (a.Maximum.Value == b.Minimum.Value)\n\t\t{\n\t\t\t// if either is inclusive -> a1..b2\n\t\t\tif (a.Maximum.Inclusive || b.Minimum.Inclusive)\n\t\t\t\treturn [new NumberRange(a.Minimum, b.Maximum)];\n\n\t\t\t// otherwise disjoint\n\t\t\treturn [a, b];\n\t\t}\n\n\t\tvar minimum = Bound.Minimum(a.Minimum, b.Minimum);\n\t\tvar maximum = Bound.Maximum(a.Maximum, b.Maximum);\n\n\t\treturn [new NumberRange(minimum, maximum)];\n\t}\n\n\t/// \n\t/// Calculates the set of one range omitting another. May be multiple ranges.\n\t/// \n\t/// The source range\n\t/// The operating range.\n\t/// The resulting set of ranges that exist in the source range but not the operating range.\n\tpublic static IEnumerable Difference(NumberRange a, NumberRange b)\n\t{\n\t\tif (b.Minimum < a.Minimum)\n\t\t\treturn Difference(b, a);\n\n\t\t// disjoint: a1 a2 b1 b2 -> a1 a2\n\t\tif (a.Maximum < b.Minimum) return [a];\n\n\t\t// contained (different end): a1 b1 b2 a2 -> a1 !b1 | !b2 a2\n\t\t// contained (same end): a1 b1 b2a2 -> a1 !b1 | !b2 a2\n\t\tif (a.Minimum < b.Minimum && b.Maximum < a.Maximum)\n\t\t\treturn\n\t\t\t[\n\t\t\t\tnew NumberRange(a.Minimum, Bound.Complement(b.Minimum)),\n\t\t\t\tnew NumberRange(Bound.Complement(b.Maximum), a.Maximum)\n\t\t\t];", + "snippet": "using System;\nusing System.Collections.Generic;\n\nnamespace Json.Schema.DataGeneration;\n\n/// \n/// Defines a number range.\n/// \npublic readonly struct NumberRange : IEquatable\n{\n\t/// a1 !b1\n\t\t// intersected (same end): a1 b1 a2b2 -> a1 !b1\n\t\tif (a.Minimum < b.Minimum && a.Maximum <= b.Maximum)\n\t\t\treturn [new NumberRange(a.Minimum, Bound.Complement(b.Minimum))];\n\n\t\t// same start (a ends): a1b1 b2 a2 -> !b2 a2\n\t\tif (b.Maximum < a.Maximum)\n\t\t\treturn [new NumberRange(Bound.Complement(b.Maximum), a.Maximum)];\n\n\t\t// same start (b ends): a1b1 a2 b2 -> a2 !b2\n\t\tif (b.Maximum < a.Maximum)\n\t\t\treturn [new NumberRange(a.Maximum, Bound.Complement(b.Maximum))];\n\n\t\t// perfect overlap\n\t\treturn [];\n\t}\n\n\t/// \n\t/// Calculates whether a single value is contained in the range.\n\t/// \n\t/// True if the range contains the value; false otherwise.\n\tpublic bool Contains(decimal value)\n\t{\n\t\tvar meetsMinimum = Minimum.Inclusive ? Minimum.Value <= value : Minimum.Value < value;\n\t\tvar meetsMaximum = Maximum.Inclusive ? value <= Maximum.Value : value < Maximum.Value;\n\n\t\treturn meetsMinimum && meetsMaximum;\n\t}\n\n\t/// Returns the fully qualified type name of this instance.\n\t/// The fully qualified type name.\n\tpublic override string ToString()\n\t{\n\t\tvar minBound = Minimum.Inclusive ? '[' : '(';\n\t\tvar maxBound = Maximum.Inclusive ? ']' : ')';\n\n\t\treturn $\"{minBound}{Minimum.Value}..{Maximum.Value}{maxBound}\";\n\t}\n\n\t/// Indicates whether the current object is equal to another object of the same type.\n\t/// An object to compare with this object.\n\t/// true if the current object is equal to the other parameter; otherwise, false.\n\tpublic bool Equals(NumberRange other)\n\t{\n\t\treturn Minimum.Equals(other.Minimum) && Maximum.Equals(other.Maximum);\n\t}\n\n\t/// Indicates whether this instance and a specified object are equal.\n\t/// The object to compare with the current instance.\n\t/// true if obj and this instance are the same type and represent the same value; otherwise, false.\n\tpublic override bool Equals(object? obj)\n\t{\n\t\treturn obj is NumberRange other && Equals(other);\n\t}\n\n\t/// Returns the hash code for this instance.\n\t/// A 32-bit signed integer that is the hash code for this instance.\n\tpublic override int GetHashCode()\n\t{\n\t\tunchecked\n\t\t{\n\t\t\treturn (Minimum.GetHashCode() * 397) ^ Maximum.GetHashCode();\n\t\t}\n\t}\n\n\t/// \n\t/// Compares two ranges for equality.\n\t/// \n\t/// True if the ranges are the same; false otherwise.\n\tpublic static bool operator ==(NumberRange left, NumberRange right)\n\t{\n\t\treturn left.Equals(right);\n\t}\n\n\t/// \n\t/// Compares two ranges for non-equality.\n\t/// \n\t/// False if the ranges are the same; true otherwise.\n\tpublic static bool operator !=(NumberRange left, NumberRange right)\n\t{\n\t\treturn !left.Equals(right);\n\t}\n}", + "snippet": "// intersected (different end): a1 b1 a2 b2 -> a1 !b1\n\t\t// intersected (same end): a1 b1 a2b2 -> a1 !b1\n\t\tif (a.Minimum < b.Minimum && a.Maximum <= b.Maximum)\n\t\t\treturn [new NumberRange(a.Minimum, Bound.Complement" + }, + { + "title": "src/JsonSchema.DataGeneration/NumberRangeSet.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/NumberRangeSet.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/NumberRangeSet.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.DataGeneration;\n\n/// \n/// Manages a collection of number ranges as a single entity.\n/// \npublic class NumberRangeSet\n{\n\t// The full range causes problems with random generation. Dividing by 10 shouldn't be a big deal.\n\tinternal const decimal MinRangeValue = decimal.MinValue / 10;\n\tinternal const decimal MaxRangeValue = decimal.MaxValue / 10;\n\n\tprivate readonly NumberRange[] _ranges;\n\n\t/// \n\t/// Represent the empty set.\n\t/// \n\tpublic static NumberRangeSet None { get; }\n\t/// \n\t/// Represents the full range of representable values.\n\t/// \n\t/// \n\t/// The full range has been limited to [decimal.MinValue / 10 .. decimal.MaxValue / 10] because\n\t/// the _actual_ full range causes problems with the random value generation algorithms.\n\t/// \n\tpublic static NumberRangeSet Full { get; }\n\t/// \n\t/// Represents the range of 0 and all positive numbers.\n\t/// \n\tpublic static NumberRangeSet NonNegative { get; }\n\n\t/// \n\t/// Gets the ranges.\n\t/// \n\tpublic IReadOnlyList Ranges => _ranges;\n\n\tstatic NumberRangeSet()\n\t{\n\t\tNone = new NumberRangeSet([]);\n\t\tFull = new NumberRangeSet([new NumberRange(MinRangeValue, MaxRangeValue)]);\n\t\tNonNegative = new NumberRangeSet([new NumberRange(0, MaxRangeValue)]);\n\t}\n\n\t/// \n\t/// Creates a new set from a single range.\n\t/// \n\tpublic NumberRangeSet(NumberRange range)\n\t\t: this([range]) { }\n\n\t/// \n\t/// Copies a range set.\n\t/// \n\tpublic NumberRangeSet(NumberRangeSet other)\n\t\t: this(other._ranges) { }\n\n\t/// \n\t/// Creates a new set from a collection of ranges.\n\t/// \n\t/// \n\tpublic NumberRangeSet(IEnumerable other)\n\t{\n\t\t_ranges = other.ToArray();\n\t}\n\n\t/// \n\t/// Calculates the union of two sets.\n\t/// \n\t/// The resulting set of ranges that exist in either parameters.\n\tpublic NumberRangeSet Union(NumberRange range)\n\t{\n\t\tint index;\n\t\tvar newRanges = new List(_ranges);\n\t\tvar intersecting = GetIntersectingRanges(range);\n\t\tif (intersecting.Count == 0)\n\t\t{\n\t\t\tindex = newRanges.FindIndex(x => range.Minimum < x.Minimum);\n\t\t\tif (index == -1)\n\t\t\t\tnewRanges.Add(range);\n\t\t\telse\n\t\t\t\tnewRanges.Insert(index, range);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar first = intersecting.First();\n\t\t\tvar last = intersecting.Last();\n\t\t\tvar newMinimum = Bound.Minimum(first.Minimum, range.Minimum);\n\t\t\tvar newMaximum = Bound.Maximum(last.Maximum, range.Maximum);\n\t\t\tvar overarchingRange = new NumberRange(newMinimum, newMaximum);\n\t\t\tindex = newRanges.IndexOf(first);\n\t\t\tnewRanges.RemoveRange(index, intersecting.Count);\n\t\t\tnewRanges.Insert(index, overarchingRange);\n\t\t}\n\n\t\treturn new NumberRangeSet(newRanges);\n\t}\n\n\t/// \n\t/// Calculates the union of two sets.\n\t/// \n\t/// The resulting set of ranges that exist in either parameters.\n\tpublic static NumberRangeSet Union(NumberRangeSet left, NumberRangeSet right) => \n\t\tright._ranges.Aggregate(left, (current, range) => current.Union(range));\n\n\t/// \n\t/// Calculates the set of one set omitting another.\n\t/// \n\t/// The operating set.\n\t/// The resulting set of ranges that exist in this set but not the operating set.\n\tpublic NumberRangeSet Subtract(NumberRange range)\n\t{\n\t\tvar intersecting = GetIntersectingRanges(range);\n\t\tif (intersecting.Count == 0)\n\t\t\treturn new NumberRangeSet(_ranges);\n\n\t\tvar first = intersecting.First();\n\t\tvar last = intersecting.Last();\n\t\tvar newMinimum = Bound.Minimum(first.Minimum, range.Minimum);", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.DataGeneration;\n\n/// \n/// Manages a collection of number ranges as a single entity.\n/// \npublic class NumberRan" + }, + { + "title": "src/JsonSchema.DataGeneration/NumberRangeSet.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/NumberRangeSet.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/NumberRangeSet.cs", + "startLine": 121, + "endLine": 240, + "content": "var newMaximum = Bound.Maximum(last.Maximum, range.Maximum);\n\t\tvar overarchingRange = new NumberRange(newMinimum, newMaximum);\n\t\tvar difference = NumberRange.Difference(overarchingRange, range);\n\t\tvar newRanges = new List(_ranges);\n\t\tvar index = newRanges.IndexOf(first);\n\t\tnewRanges.RemoveRange(index, intersecting.Count);\n\t\tnewRanges.InsertRange(index, difference);\n\t\treturn new NumberRangeSet(newRanges);\n\t}\n\n\t/// \n\t/// Calculates the set of one set omitting another.\n\t/// \n\t/// The source set.\n\t/// The operating set.\n\t/// The resulting set of ranges that exist in the source set but not the operating set.\n\tpublic static NumberRangeSet Subtract(NumberRangeSet left, NumberRangeSet right) => \n\t\tright._ranges.Aggregate(left, (current, range) => current.Subtract(range));\n\n\t/// \n\t/// Calculates the intersection of two sets.\n\t/// \n\t/// The resulting set of ranges that exist in both parameters.\n\tprivate NumberRangeSet Intersect(NumberRange range)\n\t{\n\t\tvar intersecting = GetIntersectingRanges(range);\n\t\tif (intersecting.Count == 0)\n\t\t\treturn new NumberRangeSet(Array.Empty());\n\n\t\tvar first = intersecting.First();\n\t\tvar last = intersecting.Last();\n\t\tvar newRanges = new List(_ranges);\n\t\tvar newMinimum = Bound.Maximum(first.Minimum, range.Minimum);\n\t\tvar newMaximum = Bound.Minimum(last.Maximum, range.Maximum);\n\n\t\tif (first == last)\n\t\t\treturn new NumberRange(newMinimum, newMaximum);\n\n\t\tvar newFirst = new NumberRange(newMinimum, first.Maximum);\n\t\tvar index = newRanges.IndexOf(first);\n\t\tnewRanges[index] = newFirst;\n\t\tvar newLast = new NumberRange(last.Minimum, newMaximum);\n\t\tindex = newRanges.IndexOf(last);\n\t\tnewRanges[index] = newLast;\n\n\t\treturn new NumberRangeSet(newRanges);\n\t}\n\n\t/// \n\t/// Calculates the intersection of two sets.\n\t/// \n\t/// The resulting set of ranges that exist in both parameters.\n\tpublic static NumberRangeSet Intersect(NumberRangeSet left, NumberRangeSet right)\n\t{\n\t\tvar ranges = left._ranges.Join(right._ranges,\n\t\t\t\t_ => true,\n\t\t\t\t_ => true,\n\t\t\t\tNumberRange.Intersection)\n\t\t\t.SelectMany(x => x);\n\t\treturn new NumberRangeSet(ranges);\n\t\t//return right._ranges.Aggregate(left, (current, range) => current.Intersect(range));\n\t}\n\n\t/// \n\t/// Gets the complement, or inversion, of the set.\n\t/// \n\tpublic NumberRangeSet GetComplement() => Full - this;\n\n\t/// \n\t/// Applies a ceiling (upper bound).\n\t/// \n\tpublic NumberRangeSet Ceiling(Bound ceiling) => Intersect(new NumberRange(MinRangeValue, ceiling));\n\n\t/// \n\t/// Applies a floor (lower bound).\n\t/// \n\t/// \n\t/// \n\tpublic NumberRangeSet Floor(Bound floor) => Intersect(new NumberRange(floor, MaxRangeValue));\n\n\tprivate List GetIntersectingRanges(NumberRange range)\n\t{\n\t\treturn _ranges.Where(x => (x.Minimum <= range.Minimum && range.Minimum <= x.Maximum) ||\n\t\t\t\t\t\t\t\t (x.Minimum <= range.Maximum && range.Maximum <= x.Maximum) ||\n\t\t\t\t\t\t\t\t (range.Minimum <= x.Minimum && x.Maximum <= range.Maximum))\n\t\t\t.ToList();\n\t}\n\n\t/// \n\t/// Implicitly converts a single range to a set.\n\t/// \n\t/// \n\tpublic static implicit operator NumberRangeSet(NumberRange range) => new(range);\n\n\t/// \n\t/// Unions two sets.\n\t/// \n\tpublic static NumberRangeSet operator +(NumberRangeSet left, NumberRangeSet right) => Union(left, right);\n\n\t/// \n\t/// Omits one set from another.\n\t/// \n\tpublic static NumberRangeSet operator -(NumberRangeSet left, NumberRangeSet right) => Subtract(left, right);\n\n\t/// \n\t/// Intersects two sets.\n\t/// \n\tpublic static NumberRangeSet operator *(NumberRangeSet left, NumberRangeSet right) => Intersect(left, right);\n\n\t/// \n\t/// Calculates the complement (inversion) of a set.\n\t/// \n\t/// \n\t/// \n\tpublic static NumberRangeSet operator !(NumberRangeSet set) => set.GetComplement();\n\n\t/// Returns a string that represents the current object.\n\t/// A string that represents the current object.\n\tpublic override string ToString() => string.Join(\", \", _ranges);\n}", + "snippet": "var newMaximum = Bound.Maximum(last.Maximum, range.Maximum);\n\t\tvar overarchingRange = new NumberRange(newMinimum, newMaximum);\n\t\tvar difference = NumberRange.Difference(overarchingRange, range);\n\t\tvar newRanges = new Lis" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Debug/net10.0/JsonSchema.DataGeneration.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Debug/net10.0/JsonSchema.DataGeneration.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Debug/net10.0/JsonSchema.DataGeneration.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Data generation extension for JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.2.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.2.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Debug/net8.0/JsonSchema.DataGeneration.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Debug/net8.0/JsonSchema.DataGeneration.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Debug/net8.0/JsonSchema.DataGeneration.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Data generation extension for JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.2.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.2.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Debug/net9.0/JsonSchema.DataGeneration.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Debug/net9.0/JsonSchema.DataGeneration.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Debug/net9.0/JsonSchema.DataGeneration.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Data generation extension for JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.2.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.2.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Debug/netstandard2.0/JsonSchema.DataGeneration.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Debug/netstandard2.0/JsonSchema.DataGeneration.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Debug/netstandard2.0/JsonSchema.DataGeneration.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Data generation extension for JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.2.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.2.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Release/net10.0/JsonSchema.DataGeneration.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Release/net10.0/JsonSchema.DataGeneration.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Release/net10.0/JsonSchema.DataGeneration.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Data generation extension for JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.2.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.2.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Release/net8.0/JsonSchema.DataGeneration.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Release/net8.0/JsonSchema.DataGeneration.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Release/net8.0/JsonSchema.DataGeneration.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Data generation extension for JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.2.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.2.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Release/net9.0/JsonSchema.DataGeneration.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Release/net9.0/JsonSchema.DataGeneration.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Release/net9.0/JsonSchema.DataGeneration.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Data generation extension for JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.2.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.2.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.DataGeneration/obj/Release/netstandard2.0/JsonSchema.DataGeneration.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/obj/Release/netstandard2.0/JsonSchema.DataGeneration.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/obj/Release/netstandard2.0/JsonSchema.DataGeneration.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Data generation extension for JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.2.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.2.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.DataGeneration\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/AllOfRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/AllOfRequirementsGatherer.cs#L1-L19", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/AllOfRequirementsGatherer.cs", + "startLine": 1, + "endLine": 19, + "content": "using Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class AllOfRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar allOfKeyword = schema.GetKeyword();\n\t\tif (allOfKeyword == null) return;\n\n\t\tforeach (var subschema in allOfKeyword.Subschemas)\n\t\t{\n\t\t\t// ReSharper disable once IdentifierTypo\n\t\t\tvar subrequirement = subschema.GetRequirements(context.CreateBranchContext());\n\t\t\tcontext.And(subrequirement);\n\t\t}\n\t}\n}", + "snippet": "using Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class AllOfRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/AnyOfRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/AnyOfRequirementsGatherer.cs#L1-L16", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/AnyOfRequirementsGatherer.cs", + "startLine": 1, + "endLine": 16, + "content": "using System.Linq;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class AnyOfRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar keyword = schema.GetKeyword();\n\t\tif (keyword == null) return;\n\n\t\tcontext.Options ??= [];\n\t\tcontext.Options.AddRange(keyword.Subschemas.Select(x => x.GetRequirements(context.CreateBranchContext())));\n\t}\n}", + "snippet": "using System.Linq;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class AnyOfRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext cont" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/ConditionalRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/ConditionalRequirementsGatherer.cs#L1-L71", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/ConditionalRequirementsGatherer.cs", + "startLine": 1, + "endLine": 71, + "content": "using Json.Pointer;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class ConditionalRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tRequirementsContext GetBranchRequirements(KeywordData keyword, JsonPointer branchPath)\n\t\t{\n\t\t\tvar branchBuildContext = BuildContext.From(keyword) with\n\t\t\t{\n\t\t\t\tLocalSchema = keyword.RawValue,\n\t\t\t\tRelativePath = JsonPointer.Empty,\n\t\t\t\t#pragma warning disable CS0618 // Type or member is obsolete\n\t\t\t\tPathFromResourceRoot = branchPath\n\t\t\t\t#pragma warning restore CS0618 // Type or member is obsolete\n\t\t\t};\n\n\t\t\tvar branchNode = JsonSchema.BuildNode(branchBuildContext);\n\t\t\treturn branchNode.GetRequirements(context.CreateBranchContext());\n\t\t}\n\n\t\tvoid AddOptions(params RequirementsContext[] optionContexts)\n\t\t{\n\t\t\tcontext.Options ??= [];\n\t\t\tcontext.Options.AddRange(optionContexts);\n\t\t}\n\n\t\tvar ifKeyword = schema.GetKeyword();\n\t\tvar thenKeyword = schema.GetKeyword();\n\t\tvar elseKeyword = schema.GetKeyword();\n\n\t\tif (ifKeyword != null)\n\t\t{\n\t\t\t#pragma warning disable CS0618 // Type or member is obsolete\n\t\t\tvar sourceRoot = schema.PathFromResourceRoot;\n\t\t\t#pragma warning restore CS0618 // Type or member is obsolete\n\n\t\t\tvar ifRequirement = GetBranchRequirements(ifKeyword, sourceRoot.Combine(JsonPointer.Create(\"if\")));\n\t\t\tvar notIfRequirement = ifRequirement.BreakDeterministically();\n\n\t\t\tRequirementsContext? ifthen = null;\n\t\t\tRequirementsContext? thenOnly = null;\n\t\t\tif (thenKeyword != null)\n\t\t\t{\n\t\t\t\tthenOnly = GetBranchRequirements(thenKeyword, sourceRoot.Combine(JsonPointer.Create(\"then\")));\n\t\t\t\tifthen = new RequirementsContext(ifRequirement);\n\t\t\t\tifthen.And(new RequirementsContext(thenOnly));\n\t\t\t}\n\n\t\t\tRequirementsContext? ifelse = null;\n\t\t\tRequirementsContext? elseOnly = null;\n\t\t\tif (elseKeyword != null)\n\t\t\t{\n\t\t\t\telseOnly = GetBranchRequirements(elseKeyword, sourceRoot.Combine(JsonPointer.Create(\"else\")));\n\t\t\t\tifelse = new RequirementsContext(notIfRequirement);\n\t\t\t\tifelse.And(new RequirementsContext(elseOnly));\n\t\t\t}\n\n\t\t\tif (ifthen == null && ifelse == null) return;\n\t\t\tif (ifthen == null)\n\t\t\t\tAddOptions(ifRequirement, ifelse!);\n\t\t\telse if (ifelse == null)\n\t\t\t\tAddOptions(ifthen, notIfRequirement);\n\t\t\telse\n\t\t\t\tAddOptions(ifthen, ifelse);\n\t\t}\n\t}\n}", + "snippet": "using Json.Pointer;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class ConditionalRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsConte" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/ConstRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/ConstRequirementsGatherer.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/ConstRequirementsGatherer.cs", + "startLine": 1, + "endLine": 26, + "content": "using Json.Schema.Keywords;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class ConstRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar constKeyword = schema.GetKeyword()?.RawValue;\n\t\t#pragma warning disable CS0618 // Type or member is obsolete\n\t\tvar constSource = schema.PathFromResourceRoot.Combine(JsonPointer.Create(\"const\"));\n\t\t#pragma warning restore CS0618 // Type or member is obsolete\n\t\tif (constKeyword != null)\n\t\t{\n\t\t\tif (context.ConstIsSet)\n\t\t\t\tcontext.HasConflict = true;\n\t\t\telse\n\t\t\t{\n\t\t\t\tcontext.Const = constKeyword.Value;\n\t\t\t\tcontext.ConstIsSet = true;\n\t\t\t\tcontext.ConstSource = constSource;\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "using Json.Schema.Keywords;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class ConstRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext con" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/ContainsRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/ContainsRequirementsGatherer.cs#L1-L34", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/ContainsRequirementsGatherer.cs", + "startLine": 1, + "endLine": 34, + "content": "using Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class ContainsRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar contains = schema.GetKeyword() ??\n\t\t schema.GetKeyword();\n\t\tif (contains != null)\n\t\t{\n\t\t\tif (context.Contains != null)\n\t\t\t\tcontext.Contains.And(contains.Subschemas[0].GetRequirements(context.CreateBranchContext()));\n\t\t\telse\n\t\t\t\tcontext.Contains = contains.Subschemas[0].GetRequirements(context.CreateBranchContext());\n\t\t}\n\n\t\tvar range = NumberRangeSet.Full;\n\t\tvar minimum = schema.GetKeyword()?.RawValue.GetInt64();\n\t\tif (minimum != null)\n\t\t\trange = range.Floor(minimum.Value);\n\t\tvar maximum = schema.GetKeyword()?.RawValue.GetInt64();\n\t\tif (maximum != null)\n\t\t\trange = range.Ceiling(maximum.Value);\n\t\tif (range != NumberRangeSet.Full)\n\t\t{\n\t\t\tif (context.ContainsCounts != null)\n\t\t\t\tcontext.ContainsCounts *= range;\n\t\t\telse\n\t\t\t\tcontext.ContainsCounts = range;\n\t\t}\n\t}\n}", + "snippet": "using Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class ContainsRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaN" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/EnumRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/EnumRequirementsGatherer.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/EnumRequirementsGatherer.cs", + "startLine": 1, + "endLine": 26, + "content": "using System.Linq;\nusing Json.Schema.Keywords;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class EnumRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar enumKeyword = schema.GetKeyword();\n\t\t#pragma warning disable CS0618 // Type or member is obsolete\n\t\tvar enumSource = schema.PathFromResourceRoot.Combine(JsonPointer.Create(\"enum\"));\n\t\t#pragma warning restore CS0618 // Type or member is obsolete\n\t\tif (enumKeyword != null)\n\t\t{\n\t\t\tif (context.EnumOptions != null)\n\t\t\t\tcontext.HasConflict = true;\n\t\t\telse\n\t\t\t{\n\t\t\t\tcontext.EnumOptions = enumKeyword.RawValue.EnumerateArray().Select(x => (true, x)).ToList();\n\t\t\t\tcontext.EnumSource = enumSource;\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "using System.Linq;\nusing Json.Schema.Keywords;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class EnumRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(Requi" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/FalseRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/FalseRequirementsGatherer.cs#L1-L12", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/FalseRequirementsGatherer.cs", + "startLine": 1, + "endLine": 12, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class FalseRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tif (schema.Source.ValueKind is JsonValueKind.False)\n\t\t\tcontext.IsFalse = true;\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class FalseRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode sch" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/ItemsRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/ItemsRequirementsGatherer.cs#L1-L91", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/ItemsRequirementsGatherer.cs", + "startLine": 1, + "endLine": 91, + "content": "using System.Linq;\nusing System.Text.Json;\nusing Json.Schema.Keywords;\nusing Json.Schema.Keywords.Draft06;\nusing ItemsKeyword = Json.Schema.Keywords.ItemsKeyword;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class ItemsRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar supportsArrays = false;\n\n\t\tvar range = NumberRangeSet.Full;\n\t\tvar minimum = schema.GetKeyword()?.RawValue.GetInt64();\n\t\tif (minimum != null)\n\t\t{\n\t\t\trange = range.Floor(minimum.Value);\n\t\t\tsupportsArrays = true;\n\t\t}\n\t\tvar maximum = schema.GetKeyword()?.RawValue.GetInt64();\n\t\tif (maximum != null)\n\t\t{\n\t\t\trange = range.Ceiling(maximum.Value);\n\t\t\tsupportsArrays = true;\n\t\t}\n\t\tif (range != NumberRangeSet.Full)\n\t\t{\n\t\t\tif (context.ItemCounts != null)\n\t\t\t\tcontext.ItemCounts *= range;\n\t\t\telse\n\t\t\t\tcontext.ItemCounts = range;\n\t\t}\n\n\t\tvar items = schema.GetKeyword();\n\t\tif (items != null)\n\t\t{\n\t\t\tif (items.RawValue.ValueKind is JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False)\n\t\t\t{\n\t\t\t\tif (context.RemainingItems != null)\n\t\t\t\t\tcontext.RemainingItems.And(items.Subschemas[0].GetRequirements(context.CreateBranchContext()));\n\t\t\t\telse\n\t\t\t\t\tcontext.RemainingItems = items.Subschemas[0].GetRequirements(context.CreateBranchContext());\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar incomingSequentialItems = items.Subschemas.Select(x => x.GetRequirements(context.CreateBranchContext())).ToList();\n\t\t\t\tif (context.SequentialItems != null)\n\t\t\t\t\tcontext.And(new RequirementsContext { SequentialItems = incomingSequentialItems });\n\t\t\t\telse\n\t\t\t\t\tcontext.SequentialItems = incomingSequentialItems;\n\t\t\t}\n\t\t\tsupportsArrays = true;\n\t\t}\n\n\t\tvar prefixItems = schema.GetKeyword();\n\t\tif (prefixItems != null)\n\t\t{\n\t\t\tvar incomingSequentialItems = prefixItems.Subschemas.Select(x => x.GetRequirements(context.CreateBranchContext())).ToList();\n\t\t\tif (context.SequentialItems != null)\n\t\t\t\tcontext.And(new RequirementsContext { SequentialItems = incomingSequentialItems });\n\t\t\telse\n\t\t\t\tcontext.SequentialItems = incomingSequentialItems;\n\t\t\tsupportsArrays = true;\n\t\t}\n\n\t\tvar additionalItems = schema.GetKeyword();\n\t\tif (additionalItems != null)\n\t\t{\n\t\t\tif (context.RemainingItems != null)\n\t\t\t\tcontext.RemainingItems.And(additionalItems.Subschemas[0].GetRequirements(context.CreateBranchContext()));\n\t\t\telse\n\t\t\t\tcontext.RemainingItems = additionalItems.Subschemas[0].GetRequirements(context.CreateBranchContext());\n\t\t\tsupportsArrays = true;\n\t\t}\n\n\t\tadditionalItems = schema.GetKeyword();\n\t\tif (additionalItems != null)\n\t\t{\n\t\t\tif (context.RemainingItems != null)\n\t\t\t\tcontext.RemainingItems.And(additionalItems.Subschemas[0].GetRequirements(context.CreateBranchContext()));\n\t\t\telse\n\t\t\t\tcontext.RemainingItems = additionalItems.Subschemas[0].GetRequirements(context.CreateBranchContext());\n\t\t\tsupportsArrays = true;\n\t\t}\n\n\t\tif (supportsArrays)\n\t\t\tcontext.InferredType |= SchemaValueType.Array;\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json;\nusing Json.Schema.Keywords;\nusing Json.Schema.Keywords.Draft06;\nusing ItemsKeyword = Json.Schema.Keywords.ItemsKeyword;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninte" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/NotRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/NotRequirementsGatherer.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/NotRequirementsGatherer.cs", + "startLine": 1, + "endLine": 17, + "content": "using Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class NotRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar notKeyword = schema.GetKeyword();\n\t\tif (notKeyword == null) return;\n\n\t\tvar subRequirements = notKeyword.Subschemas[0].GetRequirements(context.CreateBranchContext());\n\n\t\tvar broken = subRequirements.Break();\n\t\tcontext.And(broken);\n\t}\n}", + "snippet": "using Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class NotRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode s" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/NumberRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/NumberRequirementsGatherer.cs#L1-L72", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/NumberRequirementsGatherer.cs", + "startLine": 1, + "endLine": 72, + "content": "using Json.Schema.Keywords;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class NumberRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar supportsNumbers = false;\n\t\tJsonPointer? rangeSource = null;\n\n\t\t#pragma warning disable CS0618 // Type or member is obsolete\n\t\tvar baseSource = schema.PathFromResourceRoot;\n\t\t#pragma warning restore CS0618 // Type or member is obsolete\n\n\t\tvar range = NumberRangeSet.Full;\n\t\tvar minimum = schema.GetKeyword()?.RawValue.GetDecimal();\n\t\tif (minimum != null)\n\t\t{\n\t\t\trange = range.Floor(minimum.Value);\n\t\t\trangeSource ??= baseSource.Combine(JsonPointer.Create(\"minimum\"));\n\t\t\tsupportsNumbers = true;\n\t\t}\n\t\tminimum = schema.GetKeyword()?.RawValue.GetDecimal();\n\t\tif (minimum != null)\n\t\t{\n\t\t\trange = range.Floor((minimum.Value, false));\n\t\t\trangeSource ??= baseSource.Combine(JsonPointer.Create(\"exclusiveMinimum\"));\n\t\t\tsupportsNumbers = true;\n\t\t}\n\t\tvar maximum = schema.GetKeyword()?.RawValue.GetDecimal();\n\t\tif (maximum != null)\n\t\t{\n\t\t\trange = range.Ceiling(maximum.Value);\n\t\t\trangeSource ??= baseSource.Combine(JsonPointer.Create(\"maximum\"));\n\t\t\tsupportsNumbers = true;\n\t\t}\n\t\tmaximum = schema.GetKeyword()?.RawValue.GetDecimal();\n\t\tif (maximum != null)\n\t\t{\n\t\t\trange = range.Ceiling((maximum.Value, false));\n\t\t\trangeSource ??= baseSource.Combine(JsonPointer.Create(\"exclusiveMaximum\"));\n\t\t\tsupportsNumbers = true;\n\t\t}\n\t\tif (range != NumberRangeSet.Full)\n\t\t{\n\t\t\tif (context.NumberRanges != null)\n\t\t\t\tcontext.NumberRanges *= range;\n\t\t\telse\n\t\t\t{\n\t\t\t\tcontext.NumberRanges = range;\n\t\t\t\tcontext.NumberRangesSource = rangeSource;\n\t\t\t}\n\t\t\tcontext.NumberRangesSource ??= rangeSource;\n\t\t\tsupportsNumbers = true;\n\t\t}\n\n\t\tvar multipleOf = schema.GetKeyword()?.RawValue.GetDecimal();\n\t\tif (multipleOf != null)\n\t\t{\n\t\t\tif (context.Multiples != null)\n\t\t\t\tcontext.Multiples?.Add(multipleOf.Value);\n\t\t\telse\n\t\t\t\tcontext.Multiples = [multipleOf.Value];\n\t\t\tsupportsNumbers = true;\n\t\t}\n\n\t\tif (supportsNumbers)\n\t\t\tcontext.InferredType |= SchemaValueType.Number;\n\t}\n}", + "snippet": "using Json.Schema.Keywords;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class NumberRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext co" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/OneOfRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/OneOfRequirementsGatherer.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/OneOfRequirementsGatherer.cs", + "startLine": 1, + "endLine": 33, + "content": "using System.Linq;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class OneOfRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar keyword = schema.GetKeyword();\n\t\tif (keyword == null) return;\n\n\t\tcontext.Options ??= [];\n\t\tvar allRequirements = keyword.Subschemas.Select(x => x.GetRequirements(context.CreateBranchContext())).ToList();\n\t\tvar inverted = allRequirements.Select(x => x.Break()).ToList();\n\n\t\tvar i = 0;\n\t\twhile (i < allRequirements.Count)\n\t\t{\n\t\t\tvar subRequirement = new RequirementsContext(allRequirements[i]);\n\t\t\t// ReSharper disable once AccessToModifiedClosure\n\t\t\tvar othersInverted = inverted.Where((_, j) => i != j);\n\n\t\t\tforeach (var inversion in othersInverted)\n\t\t\t{\n\t\t\t\tsubRequirement.And(inversion);\n\t\t\t}\n\n\t\t\tcontext.Options.Add(subRequirement);\n\t\t\ti++;\n\t\t}\n\t}\n}", + "snippet": "using System.Linq;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class OneOfRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext cont" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/PropertiesRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/PropertiesRequirementsGatherer.cs#L1-L97", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/PropertiesRequirementsGatherer.cs", + "startLine": 1, + "endLine": 97, + "content": "using System;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class PropertiesRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar supportsObjects = false;\n\n\t\tvar range = NumberRangeSet.Full;\n\t\tvar minimum = schema.GetKeyword()?.RawValue.GetInt64();\n\t\tif (minimum != null)\n\t\t{\n\t\t\trange = range.Floor(minimum.Value);\n\t\t\tsupportsObjects = true;\n\t\t}\n\t\tvar maximum = schema.GetKeyword()?.RawValue.GetInt64();\n\t\tif (maximum != null)\n\t\t{\n\t\t\trange = range.Ceiling(maximum.Value);\n\t\t\tsupportsObjects = true;\n\t\t}\n\t\tif (range != NumberRangeSet.Full)\n\t\t{\n\t\t\tif (context.PropertyCounts != null)\n\t\t\t\tcontext.PropertyCounts *= range;\n\t\t\telse\n\t\t\t\tcontext.PropertyCounts = range;\n\t\t\tsupportsObjects = true;\n\t\t}\n\n\t\tvar requiredProperties = (string[]?)schema.GetKeyword()?.Value;\n\t\tif (requiredProperties != null)\n\t\t{\n\t\t\tif (context.RequiredProperties != null)\n\t\t\t\tcontext.RequiredProperties.AddRange(requiredProperties);\n\t\t\telse\n\t\t\t\tcontext.RequiredProperties = [.. requiredProperties];\n\t\t\tsupportsObjects = true;\n\t\t}\n\n\t\tvar properties = schema.GetKeyword();\n\t\tif (properties != null)\n\t\t{\n\t\t\tcontext.Properties ??= [];\n\t\t\tforeach (var property in properties.Subschemas)\n\t\t\t{\n\t\t\t\tvar propertyName = property.RelativePath[0].ToString();\n\t\t\t\tvar propertyRequirements = property.GetRequirements(context.CreateBranchContext());\n\t\t\t\tvar isRequired = requiredProperties != null && Array.IndexOf(requiredProperties, propertyName) >= 0;\n\t\t\t\tif (!isRequired && propertyRequirements.ReachedRefDepthCutoff)\n\t\t\t\t\tpropertyRequirements.IsFalse = true;\n\n\t\t\t\tif (context.Properties.TryGetValue(propertyName, out var subschema))\n\t\t\t\t\tsubschema.And(propertyRequirements);\n\t\t\t\telse\n\t\t\t\t\tcontext.Properties.Add(propertyName, propertyRequirements);\n\t\t\t}\n\t\t\tsupportsObjects = true;\n\t\t}\n\n\t\tvar additionalProperties = schema.GetKeyword();\n\t\tif (additionalProperties != null)\n\t\t{\n\t\t\tif (context.RemainingProperties != null)\n\t\t\t\tcontext.RemainingProperties.And(additionalProperties.Subschemas[0].GetRequirements(context.CreateBranchContext()));\n\t\t\telse\n\t\t\t\tcontext.RemainingProperties = additionalProperties.Subschemas[0].GetRequirements(context.CreateBranchContext());\n\t\t\tsupportsObjects = true;\n\t\t}\n\n\t\tvar propertyNames = schema.GetKeyword();\n\t\tif (propertyNames != null)\n\t\t{\n\t\t\tif (context.PropertyNames != null)\n\t\t\t\tcontext.PropertyNames.And(propertyNames.Subschemas[0].GetRequirements(context.CreateBranchContext()));\n\t\t\telse\n\t\t\t\tcontext.PropertyNames = propertyNames.Subschemas[0].GetRequirements(context.CreateBranchContext());\n\t\t\tsupportsObjects = true;\n\t\t}\n\n\t\tadditionalProperties = schema.GetKeyword();\n\t\tif (additionalProperties != null)\n\t\t{\n\t\t\tif (context.RemainingProperties != null)\n\t\t\t\tcontext.RemainingProperties.And(additionalProperties.Subschemas[0].GetRequirements(context.CreateBranchContext()));\n\t\t\telse\n\t\t\t\tcontext.RemainingProperties = additionalProperties.Subschemas[0].GetRequirements(context.CreateBranchContext());\n\t\t\tsupportsObjects = true;\n\t\t}\n\n\t\tif (supportsObjects)\n\t\t\tcontext.InferredType |= SchemaValueType.Object;\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class PropertiesRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext cont" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/RefRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/RefRequirementsGatherer.cs#L1-L100", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/RefRequirementsGatherer.cs", + "startLine": 1, + "endLine": 100, + "content": "using System;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class RefRequirementsGatherer : IRequirementsGatherer\n{\n\tprivate const SchemaValueType _primitiveTypes = SchemaValueType.Null | SchemaValueType.String | SchemaValueType.Integer | SchemaValueType.Number | SchemaValueType.Boolean;\n\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar refKeyword = schema.GetKeyword();\n\t\tif (refKeyword != null)\n\t\t{\n\t\t\tif (refKeyword.Subschemas is null or { Length: 0 })\n\t\t\t\tthrow new RefResolutionException((Uri)refKeyword.Value!);\n\n\t\t\tcontext.And(GetTargetRequirements(context, refKeyword.Subschemas[0]));\n\t\t\treturn;\n\t\t}\n\n\t\tvar dynamicRefKeyword = schema.GetKeyword(\"$dynamicRef\");\n\t\tif (dynamicRefKeyword == null) return;\n\t\tif (!TryGetDynamicAnchor(dynamicRefKeyword, out var anchor) || !context.TryResolveDynamicAnchor(anchor, out var dynamicTarget))\n\t\t{\n\t\t\tcontext.And(new RequirementsContext { IsFalse = true });\n\t\t\treturn;\n\t\t}\n\n\t\tcontext.And(GetTargetRequirements(context, dynamicTarget));\n\t}\n\n\tprivate static RequirementsContext GetTargetRequirements(RequirementsContext context, JsonSchemaNode target)\n\t{\n\t\tif (context.RemainingRefDepth > 0)\n\t\t\treturn target.GetRequirements(context.CreateRefBranchContext());\n\n\t\treturn BuildCutoffFallbackRequirements(target);\n\t}\n\n\tprivate static bool TryGetDynamicAnchor(KeywordData dynamicRefKeyword, out string anchor)\n\t{\n\t\tanchor = string.Empty;\n\t\tif (dynamicRefKeyword.RawValue.ValueKind != System.Text.Json.JsonValueKind.String) return false;\n\n\t\tvar rawReference = dynamicRefKeyword.RawValue.GetString();\n\t\tif (string.IsNullOrWhiteSpace(rawReference)) return false;\n\n\t\tif (rawReference![0] == '#')\n\t\t{\n\t\t\tif (rawReference.Length < 2 || rawReference[1] == '/') return false;\n\n\t\t\tanchor = rawReference[1..];\n\t\t\treturn true;\n\t\t}\n\n\t\tif (!Uri.TryCreate(rawReference, UriKind.RelativeOrAbsolute, out var uri)) return false;\n\n\t\tvar fragment = uri.Fragment;\n\t\tif (fragment.Length < 2 || fragment[0] != '#' || fragment[1] == '/') return false;\n\n\t\tanchor = fragment[1..];\n\t\treturn true;\n\t}\n\n\tprivate static RequirementsContext BuildCutoffFallbackRequirements(JsonSchemaNode target)\n\t{\n\t\tvar fallback = new RequirementsContext\n\t\t{\n\t\t\tReachedRefDepthCutoff = true\n\t\t};\n\n\t\tvar typeKeyword = target.GetKeyword();\n\t\tif (typeKeyword == null)\n\t\t{\n\t\t\tfallback.IsFalse = true;\n\t\t\treturn fallback;\n\t\t}\n\n\t\tvar allowedTypes = (SchemaValueType)typeKeyword.Value!;\n\t\tvar primitiveTypes = allowedTypes & _primitiveTypes;\n\t\tif (primitiveTypes == 0)\n\t\t{\n\t\t\tfallback.IsFalse = true;\n\t\t\treturn fallback;\n\t\t}\n\n\t\tfallback.Type = primitiveTypes.HasFlag(SchemaValueType.Null)\n\t\t\t? SchemaValueType.Null\n\t\t\t: primitiveTypes.HasFlag(SchemaValueType.String)\n\t\t\t\t? SchemaValueType.String\n\t\t\t\t: primitiveTypes.HasFlag(SchemaValueType.Integer)\n\t\t\t\t\t? SchemaValueType.Integer\n\t\t\t\t\t: primitiveTypes.HasFlag(SchemaValueType.Number)\n\t\t\t\t\t\t? SchemaValueType.Number\n\t\t\t\t\t\t: SchemaValueType.Boolean;\n\n\t\treturn fallback;\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class RefRequirementsGatherer : IRequirementsGatherer\n{\n\tprivate const SchemaValueType _primitiveTypes = SchemaValue" + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/StringRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/StringRequirementsGatherer.cs#L1-L70", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/StringRequirementsGatherer.cs", + "startLine": 1, + "endLine": 70, + "content": "using System.Text.RegularExpressions;\nusing Json.Schema.Keywords;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class StringRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar supportsStrings = false;\n\n\t\tvar range = NumberRangeSet.NonNegative;\n\t\tJsonPointer? stringLengthsSource = null;\n\n\t\t#pragma warning disable CS0618 // Type or member is obsolete\n\t\tvar baseSource = schema.PathFromResourceRoot;\n\t\t#pragma warning restore CS0618 // Type or member is obsolete\n\n\t\tvar minLength = schema.GetKeyword()?.RawValue.GetDecimal();\n\t\tif (minLength != null)\n\t\t{\n\t\t\trange = range.Floor(minLength.Value);\n\t\t\tstringLengthsSource ??= baseSource.Combine(JsonPointer.Create(\"minLength\"));\n\t\t\tsupportsStrings = true;\n\t\t}\n\t\tvar maxLength = schema.GetKeyword()?.RawValue.GetDecimal();\n\t\tif (maxLength != null)\n\t\t{\n\t\t\trange = range.Ceiling(maxLength.Value);\n\t\t\tstringLengthsSource ??= baseSource.Combine(JsonPointer.Create(\"maxLength\"));\n\t\t\tsupportsStrings = true;\n\t\t}\n\t\tif (range != NumberRangeSet.NonNegative)\n\t\t{\n\t\t\tif (context.StringLengths != null)\n\t\t\t\tcontext.StringLengths *= range;\n\t\t\telse\n\t\t\t{\n\t\t\t\tcontext.StringLengths = range;\n\t\t\t\tcontext.StringLengthsSource = stringLengthsSource;\n\t\t\t}\n\t\t\tsupportsStrings = true;\n\t\t}\n\n\t\tvar pattern = (Regex?)schema.GetKeyword()?.Value;\n\t\tif (pattern != null)\n\t\t{\n\t\t\tcontext.Patterns ??= [];\n\t\t\tcontext.Patterns.Add(pattern.ToString());\n\t\t\tsupportsStrings = true;\n\t\t}\n\n\t\tif (context.Format == null)\n\t\t{\n\t\t\tcontext.Format = schema.GetKeyword()?.RawValue.GetString() ??\n\t\t\t schema.GetKeyword()?.RawValue.GetString();\n\t\t\tif (context.Format != null)\n\t\t\t{\n\t\t\t\t#pragma warning disable CS0618 // Type or member is obsolete\n\t\t\t\tcontext.FormatSource = schema.PathFromResourceRoot.Combine(JsonPointer.Create(\"format\"));\n\t\t\t\t#pragma warning restore CS0618 // Type or member is obsolete\n\t\t\t}\n\t\t\tsupportsStrings = context.Format != null;\n\t\t}\n\n\t\tif (supportsStrings)\n\t\t\tcontext.InferredType |= SchemaValueType.String;\n\t}\n}", + "snippet": "using System.Text.RegularExpressions;\nusing Json.Schema.Keywords;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class StringRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void " + }, + { + "title": "src/JsonSchema.DataGeneration/Requirements/TypeRequirementsGatherer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/Requirements/TypeRequirementsGatherer.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/Requirements/TypeRequirementsGatherer.cs", + "startLine": 1, + "endLine": 27, + "content": "using Json.Schema.Keywords;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class TypeRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext context, JsonSchemaNode schema)\n\t{\n\t\tvar typeKeyword = schema.GetKeyword();\n\t\tif (typeKeyword == null) return;\n\t\t#pragma warning disable CS0618 // Type or member is obsolete\n\t\tvar typeSource = schema.PathFromResourceRoot.Combine(JsonPointer.Create(\"type\"));\n\t\t#pragma warning restore CS0618 // Type or member is obsolete\n\n\t\tif (context.Type == null)\n\t\t{\n\t\t\tcontext.Type = (SchemaValueType)typeKeyword.Value!;\n\t\t\tcontext.TypeSource = typeSource;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcontext.Type &= (SchemaValueType)typeKeyword.Value!;\n\t\t\tcontext.TypeSource ??= typeSource;\n\t\t}\n\t}\n}", + "snippet": "using Json.Schema.Keywords;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration.Requirements;\n\ninternal class TypeRequirementsGatherer : IRequirementsGatherer\n{\n\tpublic void AddRequirements(RequirementsContext cont" + }, + { + "title": "src/JsonSchema.DataGeneration/RequirementsContext.cs (1/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/RequirementsContext.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/RequirementsContext.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration;\n\ninternal readonly record struct ErrorReason(string Message, JsonPointer? LeftSchemaLocation = null, JsonPointer? RightSchemaLocation = null);\n\ninternal class RequirementsContext\n{\n\tinternal class DynamicRefCaptureState\n\t{\n\t\tpublic Stack ResourceScope { get; } = new();\n\t\tpublic Dictionary CapturedAnchors { get; } = [];\n\t}\n\n\tpublic const int RecursiveRefHardStop = 5;\n\n\tprivate const SchemaValueType _allTypes =\n\t\tSchemaValueType.Array |\n\t\tSchemaValueType.Boolean |\n\t\tSchemaValueType.Integer |\n\t\tSchemaValueType.Null |\n\t\tSchemaValueType.Number |\n\t\tSchemaValueType.Object |\n\t\tSchemaValueType.String;\n\n\tpublic bool IsFalse { get; set; }\n\tpublic int RemainingRefDepth { get; set; } = RecursiveRefHardStop;\n\tpublic bool ReachedRefDepthCutoff { get; set; }\n\tpublic DynamicRefCaptureState? DynamicRefState { get; set; }\n\n\tpublic SchemaValueType? Type { get; set; }\n\tpublic SchemaValueType InferredType { get; set; }\n\n\tpublic NumberRangeSet? NumberRanges { get; set; }\n\tpublic JsonPointer? NumberRangesSource { get; set; }\n\tpublic List? Multiples { get; set; }\n\tpublic List? AntiMultiples { get; set; }\n\n\tpublic NumberRangeSet? StringLengths { get; set; }\n\tpublic JsonPointer? StringLengthsSource { get; set; }\n\tpublic List? Patterns { get; set; }\n\tpublic List? AntiPatterns { get; set; }\n\tpublic string? Format { get; set; }\n\tpublic JsonPointer? FormatSource { get; set; }\n\n\tpublic List? SequentialItems { get; set; }\n\tpublic RequirementsContext? RemainingItems { get; set; }\n\tpublic NumberRangeSet? ItemCounts { get; set; }\n\t// TODO: unevaluatedItems\n\n\tpublic RequirementsContext? Contains { get; set; }\n\tpublic NumberRangeSet? ContainsCounts { get; set; }\n\n\tpublic Dictionary? Properties { get; set; }\n\tpublic RequirementsContext? RemainingProperties { get; set; }\n\tpublic RequirementsContext? PropertyNames { get; set; }\n\tpublic NumberRangeSet? PropertyCounts { get; set; }\n\tpublic List? RequiredProperties { get; set; }\n\tpublic List? AvoidProperties { get; set; }\n\t// TODO: unevaluatedProperties\n\n\tpublic JsonElement? Const { get; set; }\n\tpublic bool ConstIsSet { get; set; }\n\tpublic JsonPointer? ConstSource { get; set; }\n\tpublic List<(bool, JsonElement)>? EnumOptions { get; set; }\n\tpublic JsonPointer? EnumSource { get; set; }\n\tpublic JsonPointer? TypeSource { get; set; }\n\n\tpublic List? Options { get; set; }\n\n\tpublic bool HasConflict { get; set; }\n\tpublic List? ErrorReasons { get; set; }\n\n\tpublic RequirementsContext() { }\n\n\tpublic RequirementsContext(RequirementsContext other, bool copyOptions = true)\n\t{\n\t\tRemainingRefDepth = other.RemainingRefDepth;\n\t\tReachedRefDepthCutoff = other.ReachedRefDepthCutoff;\n\t\tDynamicRefState = other.DynamicRefState;\n\t\tType = other.Type;\n\t\tInferredType = other.InferredType;\n\t\tIsFalse = other.IsFalse;\n\n\t\tif (other.NumberRanges != null)\n\t\t\tNumberRanges = new NumberRangeSet(other.NumberRanges);\n\t\tNumberRangesSource = other.NumberRangesSource;\n\t\tif (other.Multiples != null)\n\t\t\tMultiples = [.. other.Multiples];\n\t\tif (other.AntiMultiples != null)\n\t\t\tAntiMultiples = [.. other.AntiMultiples];\n\n\t\tif (other.StringLengths != null)\n\t\t\tStringLengths = new NumberRangeSet(other.StringLengths);\n\t\tStringLengthsSource = other.StringLengthsSource;\n\t\tif (other.Patterns != null)\n\t\t\tPatterns = [.. other.Patterns];\n\t\tif (other.AntiPatterns != null)\n\t\t\tAntiPatterns = [.. other.AntiPatterns];\n\t\tFormat = other.Format;\n\t\tFormatSource = other.FormatSource;\n\n\t\tif (other.ItemCounts != null)\n\t\t\tItemCounts = new NumberRangeSet(other.ItemCounts);\n\t\tif (other.SequentialItems != null)\n\t\t\tSequentialItems = other.SequentialItems.Select(x => new RequirementsContext(x)).ToList();\n\t\tif (other.RemainingItems != null)\n\t\t\tRemainingItems = new RequirementsContext(other.RemainingItems);\n\t\tif (other.Contains != null)\n\t\t\tContains = new RequirementsContext(other.Contains);\n\t\tif (other.ContainsCounts != null)\n\t\t\tContainsCounts = new NumberRangeSet(other.ContainsCounts);\n\n\t\tif (copyOptions && other.Options != null)\n\t\t\tOptions = other.Options.Select(x => new RequirementsContext(x)).ToList();", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Schema.DataGeneration;\n\ninternal readonly record struct ErrorReason(string M" + }, + { + "title": "src/JsonSchema.DataGeneration/RequirementsContext.cs (2/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/RequirementsContext.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/RequirementsContext.cs", + "startLine": 121, + "endLine": 240, + "content": "Const = other.Const;\n\t\tConstIsSet = other.ConstIsSet;\n\t\tConstSource = other.ConstSource;\n\t\tif (other.EnumOptions != null)\n\t\t\tEnumOptions = [.. other.EnumOptions];\n\t\tEnumSource = other.EnumSource;\n\t\tTypeSource = other.TypeSource;\n\t\tHasConflict = other.HasConflict;\n\t\tif (other.ErrorReasons != null)\n\t\t\tErrorReasons = [.. other.ErrorReasons];\n\n\t\tif (other.Properties != null)\n\t\t\tProperties = other.Properties.ToDictionary(x => x.Key, x => new RequirementsContext(x.Value));\n\t\tif (other.RemainingProperties != null)\n\t\t\tRemainingProperties = new RequirementsContext(other.RemainingProperties);\n\t\tif (other.PropertyNames != null)\n\t\t\tPropertyNames = new RequirementsContext(other.PropertyNames);\n\t\tif (other.PropertyCounts != null)\n\t\t\tPropertyCounts = other.PropertyCounts;\n\t\tif (other.RequiredProperties != null)\n\t\t\tRequiredProperties = [.. other.RequiredProperties];\n\t\tif (other.AvoidProperties != null)\n\t\t\tAvoidProperties = [.. other.AvoidProperties];\n\t}\n\n\tpublic RequirementsContext CreateBranchContext()\n\t{\n\t\treturn new RequirementsContext\n\t\t{\n\t\t\tRemainingRefDepth = RemainingRefDepth,\n\t\t\tDynamicRefState = DynamicRefState\n\t\t};\n\t}\n\n\tpublic RequirementsContext CreateRefBranchContext()\n\t{\n\t\treturn new RequirementsContext\n\t\t{\n\t\t\tRemainingRefDepth = Math.Max(0, RemainingRefDepth - 1),\n\t\t\tDynamicRefState = DynamicRefState\n\t\t};\n\t}\n\n\tpublic bool EnterDynamicResource(Uri resourceUri)\n\t{\n\t\tDynamicRefState ??= new DynamicRefCaptureState();\n\n\t\tif (DynamicRefState.ResourceScope.Count != 0 && DynamicRefState.ResourceScope.Peek() == resourceUri)\n\t\t\treturn false;\n\n\t\tDynamicRefState.ResourceScope.Push(resourceUri);\n\t\treturn true;\n\t}\n\n\tpublic void ExitDynamicResource()\n\t{\n\t\tif (DynamicRefState == null || DynamicRefState.ResourceScope.Count == 0) return;\n\n\t\tvar exitingResource = DynamicRefState.ResourceScope.Pop();\n\t\tvar keysToRemove = DynamicRefState.CapturedAnchors\n\t\t\t.Where(x => x.Value.Resource == exitingResource)\n\t\t\t.Select(x => x.Key)\n\t\t\t.ToArray();\n\n\t\tforeach (var key in keysToRemove)\n\t\t{\n\t\t\tDynamicRefState.CapturedAnchors.Remove(key);\n\t\t}\n\t}\n\n\tpublic bool CaptureDynamicAnchor(string anchor, JsonSchemaNode node)\n\t{\n\t\tDynamicRefState ??= new DynamicRefCaptureState();\n\t\tif (DynamicRefState.ResourceScope.Count == 0) return false;\n\t\tif (DynamicRefState.CapturedAnchors.ContainsKey(anchor)) return false;\n\n\t\tDynamicRefState.CapturedAnchors[anchor] = (DynamicRefState.ResourceScope.Peek(), node);\n\t\treturn true;\n\t}\n\n\tpublic bool TryResolveDynamicAnchor(string anchor, out JsonSchemaNode node)\n\t{\n\t\tnode = null!;\n\t\tif (DynamicRefState == null) return false;\n\n\t\tif (!DynamicRefState.CapturedAnchors.TryGetValue(anchor, out var capture)) return false;\n\n\t\tnode = capture.Node;\n\t\treturn true;\n\t}\n\n\tpublic IEnumerable GetAllVariations()\n\t{\n\t\tRequirementsContext CreateVariation(RequirementsContext option)\n\t\t{\n\t\t\tvar variation = new RequirementsContext(this, copyOptions: false);\n\t\t\tvariation.And(option);\n\t\t\treturn variation;\n\t\t}\n\n\t\tif (Options == null)\n\t\t\tyield return this;\n\t\telse\n\t\t{\n\t\t\tusing var enumerator = Options.GetEnumerator();\n\t\t\twhile (enumerator.MoveNext())\n\t\t\t{\n\t\t\t\tif (enumerator.Current!.Options != null)\n\t\t\t\t{\n\t\t\t\t\tforeach (var variation in enumerator.Current.GetAllVariations())\n\t\t\t\t\t{\n\t\t\t\t\t\tyield return CreateVariation(variation);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tyield return CreateVariation(enumerator.Current);\n\t\t\t}\n\t\t}\n\t}", + "snippet": "Const = other.Const;\n\t\tConstIsSet = other.ConstIsSet;\n\t\tConstSource = other.ConstSource;\n\t\tif (other.EnumOptions != null)\n\t\t\tEnumOptions = [.. other.EnumOptions];\n\t\tEnumSource = other.EnumSource;\n\t\tTypeSource = other.Typ" + }, + { + "title": "src/JsonSchema.DataGeneration/RequirementsContext.cs (3/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/RequirementsContext.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/RequirementsContext.cs", + "startLine": 241, + "endLine": 360, + "content": "// Create a requirements object that doesn't meet this context's requirement\n\t// Only need to break one requirement for this to work, not all\n\tpublic RequirementsContext Break() => BreakCore(deterministic: false);\n\n\tpublic RequirementsContext BreakDeterministically() => BreakCore(deterministic: true);\n\n\tprivate RequirementsContext BreakCore(bool deterministic)\n\t{\n\t\tbool BreakBoolean(RequirementsContext context)\n\t\t{\n\t\t\tif (IsTrue())\n\t\t\t{\n\t\t\t\tcontext.IsFalse = true;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (IsFalse)\n\t\t\t{\n\t\t\t\tcontext.IsFalse = false;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tbool BreakType(RequirementsContext context)\n\t\t{\n\t\t\tif (Type == null) return false;\n\t\t\tcontext.Type = ~_allTypes ^ ~Type;\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakNumberRange(RequirementsContext context)\n\t\t{\n\t\t\tif (NumberRanges == null || !NumberRanges.Ranges.Any()) return false;\n\t\t\tcontext.NumberRanges = NumberRanges?.GetComplement();\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakMultiples(RequirementsContext context)\n\t\t{\n\t\t\tif (Multiples == null && AntiMultiples == null) return false;\n\t\t\tcontext.Multiples = AntiMultiples;\n\t\t\tcontext.AntiMultiples = Multiples;\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakStringLength(RequirementsContext context)\n\t\t{\n\t\t\tif (StringLengths == null || !StringLengths.Ranges.Any()) return false;\n\t\t\tcontext.StringLengths = StringLengths?.GetComplement();\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakPatterns(RequirementsContext context)\n\t\t{\n\t\t\tif ((Patterns == null || Patterns.Count == 0) && (AntiPatterns == null || AntiPatterns.Count == 0))\n\t\t\t\treturn false;\n\n\t\t\tcontext.Patterns = AntiPatterns != null ? [.. AntiPatterns] : null;\n\t\t\tcontext.AntiPatterns = Patterns != null ? [.. Patterns] : null;\n\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakFormat(RequirementsContext context)\n\t\t{\n\t\t\tif (Format == null) return false;\n\n\t\t\tcontext.Format = null;\n\t\t\tcontext.AntiPatterns ??= [];\n\t\t\tif (Format == Formats.Date.Key)\n\t\t\t\tcontext.AntiPatterns.Add(\"^\\\\d{4}-\\\\d{2}-\\\\d{2}$\");\n\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakItems(RequirementsContext context)\n\t\t{\n\t\t\tif (RemainingItems == null) return false;\n\t\t\tcontext.RemainingItems = RemainingItems.Break();\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakItemCount(RequirementsContext context)\n\t\t{\n\t\t\tif (ItemCounts == null) return false;\n\t\t\tcontext.ItemCounts = ItemCounts?.GetComplement();\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakProperties(RequirementsContext context)\n\t\t{\n\t\t\tif (RemainingProperties != null)\n\t\t\t{\n\t\t\t\tcontext.RemainingProperties = RemainingProperties.Break();\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (Properties != null)\n\t\t\t{\n\t\t\t\tvar forbiddenProperties = Properties\n\t\t\t\t\t.Where(x => x.Value.IsFalse)\n\t\t\t\t\t.Select(x => x.Key)\n\t\t\t\t\t.ToArray();\n\t\t\t\tif (forbiddenProperties.Length > 0)\n\t\t\t\t{\n\t\t\t\t\tcontext.Properties = Properties.ToDictionary(\n\t\t\t\t\t\tx => x.Key,\n\t\t\t\t\t\tx => x.Value.IsFalse ? new RequirementsContext() : x.Value.Break());\n\t\t\t\t\tcontext.RequiredProperties ??= [];\n\t\t\t\t\tcontext.RequiredProperties.AddRange(forbiddenProperties);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tcontext.Properties = Properties.ToDictionary(x => x.Key, x => x.Value.Break());\n\t\t\t\tcontext.RequiredProperties ??= [];\n\t\t\t\tcontext.RequiredProperties.AddRange(context.Properties.Where(x => !x.Value.IsFalse).Select(x => x.Key));\n\t\t\t\treturn true;", + "snippet": "// Create a requirements object that doesn't meet this context's requirement\n\t// Only need to break one requirement for this to work, not all\n\tpublic RequirementsContext Break() => BreakCore(deterministic: false);\n\n\tpubl" + }, + { + "title": "src/JsonSchema.DataGeneration/RequirementsContext.cs (4/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/RequirementsContext.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/RequirementsContext.cs", + "startLine": 361, + "endLine": 480, + "content": "}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tbool BreakRequired(RequirementsContext context)\n\t\t{\n\t\t\tif (RequiredProperties == null && AvoidProperties == null) return false;\n\t\t\tcontext.RequiredProperties = AvoidProperties;\n\t\t\tcontext.AvoidProperties = RequiredProperties;\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakPropertyNames(RequirementsContext context)\n\t\t{\n\t\t\tif (PropertyNames == null) return false;\n\t\t\tcontext.PropertyNames = PropertyNames.Break();\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakPropertyCounts(RequirementsContext context)\n\t\t{\n\t\t\tif (PropertyCounts == null) return false;\n\t\t\tcontext.PropertyCounts = PropertyCounts?.GetComplement();\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakContains(RequirementsContext context)\n\t\t{\n\t\t\tif (Contains == null) return false;\n\t\t\tcontext.Contains = Contains.Break();\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakContainsCount(RequirementsContext context)\n\t\t{\n\t\t\tif (ContainsCounts == null) return false;\n\t\t\tcontext.ContainsCounts = ContainsCounts?.GetComplement();\n\t\t\treturn true;\n\t\t}\n\n\t\tbool BreakConst(RequirementsContext context)\n\t\t{\n\t\t\tif (!ConstIsSet) return false;\n\t\t\tcontext.Const = null;\n\t\t\tcontext.ConstIsSet = false;\n\t\t\tcontext.ConstSource = null;\n\t\t\tcontext.EnumOptions ??= [];\n\t\t\tcontext.EnumOptions.Add((false, Const!.Value));\n\t\t\tcontext.EnumSource ??= ConstSource;\n\t\t\treturn true;\n\t\t}\n\n\t\tvar allBreakers = new[]\n\t\t{\n\t\t\tBreakBoolean,\n\t\t\tBreakType,\n\t\t\tBreakNumberRange,\n\t\t\tBreakMultiples,\n\t\t\tBreakStringLength,\n\t\t\tBreakPatterns,\n\t\t\tBreakFormat,\n\t\t\tBreakItems,\n\t\t\tBreakItemCount,\n\t\t\tBreakProperties,\n\t\t\tBreakRequired,\n\t\t\tBreakPropertyNames,\n\t\t\tBreakPropertyCounts,\n\t\t\tBreakContains,\n\t\t\tBreakContainsCount,\n\t\t\tBreakConst\n\t\t};\n\t\tvar breakers = deterministic ? allBreakers : JsonSchemaExtensions.Randomizer.Shuffle(allBreakers);\n\n\t\tvar broken = new RequirementsContext(this);\n\t\tusing var enumerator = breakers.GetEnumerator();\n\t\twhile (enumerator.MoveNext() && !enumerator.Current!(broken)) { }\n\n\t\treturn broken;\n\t}\n\n\tpublic void And(RequirementsContext other)\n\t{\n\t\tvar thisOptions = Options?.Select(x => new RequirementsContext(x)).ToList();\n\t\tvar otherOptions = other.Options?.Select(x => new RequirementsContext(x)).ToList();\n\n\t\tOptions = null;\n\n\t\tvoid AddConflict(string reason, JsonPointer? leftSchemaLocation = null, JsonPointer? rightSchemaLocation = null)\n\t\t{\n\t\t\tHasConflict = true;\n\t\t\tErrorReasons ??= [];\n\t\t\tif (ErrorReasons.Count < 5)\n\t\t\t\tErrorReasons.Add(new ErrorReason(reason, leftSchemaLocation, rightSchemaLocation));\n\t\t}\n\n\t\tstatic string DescribeTypes(SchemaValueType? types)\n\t\t{\n\t\t\tif (types == null) return \"any\";\n\t\t\treturn types.Value.ToString();\n\t\t}\n\n\t\tstatic string DescribeConst(JsonElement? value)\n\t\t{\n\t\t\treturn value?.GetRawText() ?? \"null\";\n\t\t}\n\n\t\tstatic string DescribeRanges(NumberRangeSet rangeSet)\n\t\t{\n\t\t\tif (!rangeSet.Ranges.Any()) return \"(empty)\";\n\t\t\treturn string.Join(\", \", rangeSet.Ranges.Select(x => x.ToString()));\n\t\t}\n\n\t\tstatic string DescribeEnumOptions(List<(bool, JsonElement)> options)\n\t\t{\n\t\t\tvar values = options.Select(x => x.Item2.GetRawText()).Distinct().Take(5).ToArray();\n\t\t\tvar suffix = options.Count > 5 ? \", ...\" : string.Empty;\n\t\t\treturn $\"[{string.Join(\", \", values)}{suffix}]\";\n\t\t}", + "snippet": "}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tbool BreakRequired(RequirementsContext context)\n\t\t{\n\t\t\tif (RequiredProperties == null && AvoidProperties == null) return false;\n\t\t\tcontext.RequiredProperties = AvoidProperties;\n\t\t\tcontext.Avoid" + }, + { + "title": "src/JsonSchema.DataGeneration/RequirementsContext.cs (5/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/RequirementsContext.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/RequirementsContext.cs", + "startLine": 481, + "endLine": 600, + "content": "static List MergeSequentialItems(RequirementsContext leftContext, RequirementsContext rightContext)\n\t\t{\n\t\t\tvar leftSequentialItems = leftContext.SequentialItems!;\n\t\t\tvar rightSequentialItems = rightContext.SequentialItems!;\n\t\t\tvar maxLength = Math.Max(leftSequentialItems.Count, rightSequentialItems.Count);\n\t\t\tvar merged = new List(maxLength);\n\n\t\t\tRequirementsContext GetRequirementForIndex(RequirementsContext context, int index)\n\t\t\t{\n\t\t\t\tif (context.SequentialItems != null && index < context.SequentialItems.Count)\n\t\t\t\t\treturn new RequirementsContext(context.SequentialItems[index]);\n\n\t\t\t\tif (context.RemainingItems != null)\n\t\t\t\t\treturn new RequirementsContext(context.RemainingItems);\n\n\t\t\t\treturn new RequirementsContext();\n\t\t\t}\n\n\t\t\tfor (var i = 0; i < maxLength; i++)\n\t\t\t{\n\t\t\t\tvar left = GetRequirementForIndex(leftContext, i);\n\t\t\t\tleft.And(GetRequirementForIndex(rightContext, i));\n\t\t\t\tmerged.Add(left);\n\t\t\t}\n\n\t\t\treturn merged;\n\t\t}\n\n\t\tIsFalse |= other.IsFalse;\n\t\tif (other.ErrorReasons != null)\n\t\t{\n\t\t\tErrorReasons ??= [];\n\t\t\tforeach (var reason in other.ErrorReasons)\n\t\t\t{\n\t\t\t\tif (ErrorReasons.Count >= 5) break;\n\t\t\t\tif (!ErrorReasons.Contains(reason))\n\t\t\t\t\tErrorReasons.Add(reason);\n\t\t\t}\n\t\t}\n\n\t\tif (Type == null)\n\t\t{\n\t\t\tType = other.Type;\n\t\t\tTypeSource = other.TypeSource;\n\t\t}\n\t\telse if (other.Type != null)\n\t\t{\n\t\t\tvar thisType = Type;\n\t\t\tvar thisTypeSource = TypeSource;\n\t\t\tType &= other.Type;\n\t\t\tif (Type == 0)\n\t\t\t\tAddConflict($\"Conflicting type constraints have no overlap: {DescribeTypes(thisType)} vs {DescribeTypes(other.Type)}.\", thisTypeSource, other.TypeSource);\n\t\t}\n\n\t\tInferredType |= other.InferredType;\n\n\t\tif (NumberRanges == null || !NumberRanges.Ranges.Any())\n\t\t{\n\t\t\tNumberRanges = other.NumberRanges;\n\t\t\tNumberRangesSource = other.NumberRangesSource;\n\t\t}\n\t\telse if (other.NumberRanges != null)\n\t\t{\n\t\t\tvar thisRangesDescription = DescribeRanges(NumberRanges);\n\t\t\tvar otherRangesDescription = DescribeRanges(other.NumberRanges);\n\t\t\tNumberRanges *= other.NumberRanges;\n\t\t\tif (!NumberRanges.Ranges.Any())\n\t\t\t\tAddConflict($\"Conflicting numeric ranges have no overlap: {thisRangesDescription} vs {otherRangesDescription}.\", NumberRangesSource, other.NumberRangesSource);\n\t\t}\n\n\t\tif (Multiples == null)\n\t\t\tMultiples = other.Multiples;\n\t\telse if (other.Multiples != null)\n\t\t\tMultiples.AddRange(other.Multiples);\n\n\t\tif (AntiMultiples == null)\n\t\t\tAntiMultiples = other.AntiMultiples;\n\t\telse if (other.AntiMultiples != null)\n\t\t\tAntiMultiples.AddRange(other.AntiMultiples);\n\n\t\tif (StringLengths == null || !StringLengths.Ranges.Any())\n\t\t{\n\t\t\tStringLengths = other.StringLengths;\n\t\t\tStringLengthsSource = other.StringLengthsSource;\n\t\t}\n\t\telse if (other.StringLengths != null)\n\t\t{\n\t\t\tStringLengths *= other.StringLengths;\n\t\t\tif (!StringLengths.Ranges.Any())\n\t\t\t\tAddConflict(\"Conflicting string length constraints have no overlap.\", StringLengthsSource, other.StringLengthsSource);\n\t\t}\n\n\t\tif (Format == null)\n\t\t{\n\t\t\tFormat = other.Format;\n\t\t\tFormatSource = other.FormatSource;\n\t\t}\n\t\telse if (other.Format != null)\n\t\t{\n\t\t\tif (Format != other.Format)\n\t\t\t\tAddConflict($\"Conflicting format constraints: '{Format}' vs '{other.Format}'.\", FormatSource, other.FormatSource);\n\t\t}\n\n\t\tif (!ConstIsSet)\n\t\t{\n\t\t\tConst = other.Const;\n\t\t\tConstIsSet = other.ConstIsSet;\n\t\t\tConstSource = other.ConstSource;\n\t\t}\n\t\telse if (other.ConstIsSet)\n\t\t{\n\t\t\tif (!(Const?.IsEquivalentTo(other.Const!.Value) ?? false))\n\t\t\t\tAddConflict($\"Conflicting const values: {DescribeConst(Const)} vs {DescribeConst(other.Const)}.\", ConstSource, other.ConstSource);\n\t\t}\n\n\t\tif (EnumOptions == null)\n\t\t{\n\t\t\tEnumOptions = other.EnumOptions != null ? [.. other.EnumOptions] : null;\n\t\t\tEnumSource = other.EnumSource;\n\t\t}", + "snippet": "static List MergeSequentialItems(RequirementsContext leftContext, RequirementsContext rightContext)\n\t\t{\n\t\t\tvar leftSequentialItems = leftContext.SequentialItems!;\n\t\t\tvar rightSequentialItems = rightC" + }, + { + "title": "src/JsonSchema.DataGeneration/RequirementsContext.cs (6/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/RequirementsContext.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/RequirementsContext.cs", + "startLine": 601, + "endLine": 720, + "content": "else if (other.EnumOptions != null)\n\t\t{\n\t\t\tList DistinctElements(IEnumerable source)\n\t\t\t{\n\t\t\t\tvar result = new List();\n\t\t\t\tforeach (var item in source)\n\t\t\t\t{\n\t\t\t\t\tif (!result.Any(x => x.IsEquivalentTo(item)))\n\t\t\t\t\t\tresult.Add(item);\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tList IntersectElements(IEnumerable left, IEnumerable right)\n\t\t\t{\n\t\t\t\tvar rightDistinct = DistinctElements(right);\n\t\t\t\treturn DistinctElements(left).Where(x => rightDistinct.Any(y => y.IsEquivalentTo(x))).ToList();\n\t\t\t}\n\n\t\t\tList SubtractElements(IEnumerable left, IEnumerable remove)\n\t\t\t{\n\t\t\t\tvar removeDistinct = DistinctElements(remove);\n\t\t\t\treturn DistinctElements(left).Where(x => !removeDistinct.Any(y => y.IsEquivalentTo(x))).ToList();\n\t\t\t}\n\n\t\t\tvar thisAllowed = DistinctElements(EnumOptions.Where(x => x.Item1).Select(x => x.Item2));\n\t\t\tvar otherAllowed = DistinctElements(other.EnumOptions.Where(x => x.Item1).Select(x => x.Item2));\n\t\t\tvar thisDisallowed = DistinctElements(EnumOptions.Where(x => !x.Item1).Select(x => x.Item2));\n\t\t\tvar otherDisallowed = DistinctElements(other.EnumOptions.Where(x => !x.Item1).Select(x => x.Item2));\n\n\t\t\tvar disallowed = DistinctElements(thisDisallowed.Concat(otherDisallowed));\n\n\t\t\tvar hasThisAllowed = thisAllowed.Count != 0;\n\t\t\tvar hasOtherAllowed = otherAllowed.Count != 0;\n\t\t\tList allowed;\n\t\t\tif (hasThisAllowed && hasOtherAllowed)\n\t\t\t\tallowed = IntersectElements(thisAllowed, otherAllowed);\n\t\t\telse if (hasThisAllowed)\n\t\t\t\tallowed = thisAllowed;\n\t\t\telse if (hasOtherAllowed)\n\t\t\t\tallowed = otherAllowed;\n\t\t\telse\n\t\t\t\tallowed = [];\n\n\t\t\tif (allowed.Count != 0)\n\t\t\t\tallowed = SubtractElements(allowed, disallowed);\n\n\t\t\tvar thisEnumDescription = DescribeEnumOptions(EnumOptions);\n\t\t\tvar otherEnumDescription = DescribeEnumOptions(other.EnumOptions);\n\t\t\tif (hasThisAllowed || hasOtherAllowed)\n\t\t\t\tEnumOptions = allowed.Select(x => (true, x)).ToList();\n\t\t\telse\n\t\t\t\tEnumOptions = disallowed.Select(x => (false, x)).ToList();\n\n\t\t\tif ((hasThisAllowed || hasOtherAllowed) && EnumOptions.Count == 0)\n\t\t\t\tAddConflict($\"Conflicting enum options have no overlap: {thisEnumDescription} vs {otherEnumDescription}.\", EnumSource, other.EnumSource);\n\t\t}\n\n\t\tif (ConstIsSet && EnumOptions != null)\n\t\t{\n\t\t\tvar allowed = EnumOptions.Where(x => x.Item1).Select(x => x.Item2).ToList();\n\t\t\tvar disallowed = EnumOptions.Where(x => !x.Item1).Select(x => x.Item2).ToList();\n\t\t\tif (allowed.Count != 0 && allowed.All(x => !x.IsEquivalentTo(Const!.Value)))\n\t\t\t\tAddConflict($\"Const value {DescribeConst(Const)} is not present in enum options.\", ConstSource, EnumSource);\n\t\t\tif (disallowed.Any(x => x.IsEquivalentTo(Const!.Value)))\n\t\t\t\tAddConflict($\"Const value {DescribeConst(Const)} is explicitly disallowed by enum options.\", ConstSource, EnumSource);\n\t\t}\n\n\t\tif (Patterns == null)\n\t\t\tPatterns = other.Patterns != null ? [.. other.Patterns] : null;\n\t\telse if (other.Patterns != null)\n\t\t\tPatterns.AddRange(other.Patterns);\n\n\t\tif (AntiPatterns == null)\n\t\t\tAntiPatterns = other.AntiPatterns != null ? [.. other.AntiPatterns] : null;\n\t\telse if (other.AntiPatterns != null)\n\t\t\tAntiPatterns.AddRange(other.AntiPatterns);\n\n\t\tif (ItemCounts == null || !ItemCounts.Ranges.Any())\n\t\t\tItemCounts = other.ItemCounts;\n\t\telse if (other.ItemCounts != null)\n\t\t\tItemCounts *= other.ItemCounts;\n\n\t\tif (SequentialItems == null)\n\t\t\tSequentialItems = other.SequentialItems?.Select(x => new RequirementsContext(x)).ToList();\n\t\telse if (other.SequentialItems != null)\n\t\t\tSequentialItems = MergeSequentialItems(this, other);\n\n\t\tif (RemainingItems == null)\n\t\t\tRemainingItems = other.RemainingItems != null ? new RequirementsContext(other.RemainingItems) : null;\n\t\telse if (other.RemainingItems != null)\n\t\t\tRemainingItems.And(other.RemainingItems);\n\n\t\tif (PropertyCounts == null || !PropertyCounts.Ranges.Any())\n\t\t\tPropertyCounts = other.PropertyCounts;\n\t\telse if (other.PropertyCounts != null)\n\t\t\tPropertyCounts *= other.PropertyCounts;\n\n\t\tif (Properties == null)\n\t\t\tProperties = other.Properties?.ToDictionary(x => x.Key, x => new RequirementsContext(x.Value));\n\t\telse if (other.Properties != null)\n\t\t{\n\t\t\tvar allKeys = Properties.Keys.Union(other.Properties.Keys);\n\t\t\tforeach (var key in allKeys)\n\t\t\t{\n\t\t\t\tProperties.TryGetValue(key, out var thisProperty);\n\t\t\t\tother.Properties.TryGetValue(key, out var otherProperty);\n\n\t\t\t\tif (thisProperty == null)\n\t\t\t\t\tProperties[key] = new RequirementsContext(otherProperty!);\n\t\t\t\telse if (otherProperty != null)\n\t\t\t\t\tthisProperty.And(otherProperty);\n\t\t\t}\n\t\t}\n\n\t\tif (RemainingProperties == null)\n\t\t\tRemainingProperties = other.RemainingProperties != null ? new RequirementsContext(other.RemainingProperties) : null;\n\t\telse if (other.RemainingProperties != null)\n\t\t\tRemainingProperties.And(other.RemainingProperties);", + "snippet": "else if (other.EnumOptions != null)\n\t\t{\n\t\t\tList DistinctElements(IEnumerable source)\n\t\t\t{\n\t\t\t\tvar result = new List();\n\t\t\t\tforeach (var item in source)\n\t\t\t\t{\n\t\t\t\t\tif (!result.Any(x " + }, + { + "title": "src/JsonSchema.DataGeneration/RequirementsContext.cs (7/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.DataGeneration/RequirementsContext.cs#L721-L806", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.DataGeneration/RequirementsContext.cs", + "startLine": 721, + "endLine": 806, + "content": "if (PropertyNames == null)\n\t\t\tPropertyNames = other.PropertyNames != null ? new RequirementsContext(other.PropertyNames) : null;\n\t\telse if (other.PropertyNames != null)\n\t\t\tPropertyNames.And(other.PropertyNames);\n\n\t\tif (RequiredProperties == null)\n\t\t\tRequiredProperties = other.RequiredProperties;\n\t\telse if (other.RequiredProperties != null)\n\t\t\tRequiredProperties.AddRange(other.RequiredProperties);\n\n\t\tif (AvoidProperties == null)\n\t\t\tAvoidProperties = other.AvoidProperties;\n\t\telse if (other.AvoidProperties != null)\n\t\t\tAvoidProperties.AddRange(other.AvoidProperties);\n\n\t\tif (RequiredProperties != null && AvoidProperties != null)\n\t\t{\n\t\t\tvar overlappingProperties = RequiredProperties.Intersect(AvoidProperties).Distinct().ToArray();\n\t\t\tif (overlappingProperties.Length != 0)\n\t\t\t\tAddConflict($\"Properties cannot be both required and avoided: {string.Join(\", \", overlappingProperties)}.\");\n\t\t}\n\n\t\tif (Contains == null)\n\t\t\tContains = other.Contains != null ? new RequirementsContext(other.Contains) : null;\n\t\telse if (other.Contains != null)\n\t\t\t// is this right?\n\t\t\tContains.And(other.Contains);\n\n\t\tif (ContainsCounts == null || !ContainsCounts.Ranges.Any())\n\t\t\tContainsCounts = other.ContainsCounts;\n\t\telse if (other.ContainsCounts != null)\n\t\t\tContainsCounts *= other.ContainsCounts;\n\n\t\tif (thisOptions == null)\n\t\t{\n\t\t\tOptions = otherOptions;\n\t\t\treturn;\n\t\t}\n\n\t\tif (otherOptions == null)\n\t\t{\n\t\t\tOptions = thisOptions;\n\t\t\treturn;\n\t\t}\n\n\t\tOptions = [];\n\t\tforeach (var thisOption in thisOptions)\n\t\t{\n\t\t\tforeach (var otherOption in otherOptions)\n\t\t\t{\n\t\t\t\tvar combined = new RequirementsContext(thisOption);\n\t\t\t\tcombined.And(new RequirementsContext(otherOption));\n\t\t\t\tOptions.Add(combined);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate bool IsTrue()\n\t{\n\t\treturn !IsFalse &&\n\t\t Type == null &&\n\t\t NumberRanges == null &&\n\t\t Multiples == null &&\n\t\t AntiMultiples == null &&\n\t\t StringLengths == null &&\n\t\t Patterns == null &&\n\t\t AntiPatterns == null &&\n\t\t Format == null &&\n\t\t SequentialItems == null &&\n\t\t RemainingItems == null &&\n\t\t ItemCounts == null &&\n\t\t Contains == null &&\n\t\t ContainsCounts == null &&\n\t\t Properties == null &&\n\t\t RemainingProperties == null &&\n\t\t PropertyNames == null &&\n\t\t PropertyCounts == null &&\n\t\t RequiredProperties == null &&\n\t\t AvoidProperties == null &&\n\t\t Const == null &&\n\t\t !ConstIsSet &&\n\t\t EnumOptions == null &&\n\t\t Options == null;\n\t}\n}", + "snippet": "if (PropertyNames == null)\n\t\t\tPropertyNames = other.PropertyNames != null ? new RequirementsContext(other.PropertyNames) : null;\n\t\telse if (other.PropertyNames != null)\n\t\t\tPropertyNames.And(other.PropertyNames);\n\n\t\tif (R" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/AllowedValueAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/AllowedValueAttributeTests.cs#L1-L36", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/AllowedValueAttributeTests.cs", + "startLine": 1, + "endLine": 36, + "content": "#if NET8_0_OR_GREATER\n\nusing System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class AllowedValueAttributeTests\n{\n\tprivate class Target\n\t{\n\t\t[AllowedValues(1, 10, \"string\")]\n\t\t[Description(\"a descriptor\")]\n\t\tpublic object Simple { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateEnum()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Simple\", new JsonSchemaBuilder()\n\t\t\t\t\t.Enum(1, 10, \"string\")\n\t\t\t\t\t.Description(\"a descriptor\")\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n}\n\n#endif", + "snippet": "#if NET8_0_OR_GREATER\n\nusing System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic " + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/Base64StringAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/Base64StringAttributeTests.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/Base64StringAttributeTests.cs", + "startLine": 1, + "endLine": 33, + "content": "#if NET8_0_OR_GREATER\n\nusing System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class Base64StringAttributeTests\n{\n\tprivate class Target\n\t{\n\t\t[Base64String]\n\t\tpublic object Simple { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateEmailFormat()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Simple\", new JsonSchemaBuilder()\n\t\t\t\t\t.Format(\"base64\")\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n}\n\n#endif", + "snippet": "#if NET8_0_OR_GREATER\n\nusing System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic c" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/DeniedValueAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/DeniedValueAttributeTests.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/DeniedValueAttributeTests.cs", + "startLine": 1, + "endLine": 38, + "content": "#if NET8_0_OR_GREATER\n\nusing System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class DeniedValueAttributeTests\n{\n\tprivate class Target\n\t{\n\t\t[DeniedValues(1, 10, \"string\")]\n\t\t[Description(\"a descriptor\")]\n\t\tpublic object Simple { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateNotEnum()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Simple\", new JsonSchemaBuilder()\n\t\t\t\t\t.Not(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Enum(1, 10, \"string\")\n\t\t\t\t\t)\n\t\t\t\t\t.Description(\"a descriptor\")\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n}\n\n#endif", + "snippet": "#if NET8_0_OR_GREATER\n\nusing System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic " + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/EmailAddressAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/EmailAddressAttributeTests.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/EmailAddressAttributeTests.cs", + "startLine": 1, + "endLine": 29, + "content": "using System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class EmailAddressAttributeTests\n{\n\tprivate class Target\n\t{\n\t\t[EmailAddress]\n\t\tpublic object Simple { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateEmailFormat()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Simple\", new JsonSchemaBuilder()\n\t\t\t\t\t.Format(Formats.Email)\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n}", + "snippet": "using System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class EmailAddressAttrib" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/EnumDataTypeAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/EnumDataTypeAttributeTests.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/EnumDataTypeAttributeTests.cs", + "startLine": 1, + "endLine": 30, + "content": "using System;\nusing System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class EnumDataTypeAttributeTests\n{\n\tprivate class Target\n\t{\n\t\t[EnumDataType(typeof(DayOfWeek))]\n\t\tpublic object Simple { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateEnum()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Simple\", new JsonSchemaBuilder()\n\t\t\t\t\t.Enum(Enum.GetNames(typeof(DayOfWeek)))\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n}", + "snippet": "using System;\nusing System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class Enum" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/LengthAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/LengthAttributeTests.cs#L1-L35", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/LengthAttributeTests.cs", + "startLine": 1, + "endLine": 35, + "content": "#if NET8_0_OR_GREATER\n\nusing System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class LengthAttributeTests\n{\n\tprivate class Target\n\t{\n\t\t[Length(1, 10)]\n\t\tpublic object Simple { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateStringRange()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Simple\", new JsonSchemaBuilder()\n\t\t\t\t\t.MinLength(1)\n\t\t\t\t\t.MaxLength(10)\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n}\n\n#endif", + "snippet": "#if NET8_0_OR_GREATER\n\nusing System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic " + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/MaxLengthAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/MaxLengthAttributeTests.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/MaxLengthAttributeTests.cs", + "startLine": 1, + "endLine": 29, + "content": "using NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\nusing DAMaxLength = System.ComponentModel.DataAnnotations.MaxLengthAttribute;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class MaxLengthAttributeTests\n{\n\tprivate class Target\n\t{\n\t\t[DAMaxLength(5)]\n\t\tpublic object Simple { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateMaxLength()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Simple\", new JsonSchemaBuilder()\n\t\t\t\t\t.MaxLength(5)\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n}", + "snippet": "using NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\nusing DAMaxLength = System.ComponentModel.DataAnnotations.MaxLengthAttribute;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/MinLengthAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/MinLengthAttributeTests.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/MinLengthAttributeTests.cs", + "startLine": 1, + "endLine": 29, + "content": "using NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\nusing DAMinLength = System.ComponentModel.DataAnnotations.MinLengthAttribute;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class MinLengthAttributeTests\n{\n\tprivate class Target\n\t{\n\t\t[DAMinLength(5)]\n\t\tpublic object Simple { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateMinLength()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Simple\", new JsonSchemaBuilder()\n\t\t\t\t\t.MinLength(5)\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n}", + "snippet": "using NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\nusing DAMinLength = System.ComponentModel.DataAnnotations.MinLengthAttribute;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net10.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net10.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net10.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net8.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net8.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net8.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net9.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net9.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Debug/net9.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net10.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net10.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net10.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net8.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net8.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net8.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net9.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net9.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/obj/Release/net9.0/JsonSchema.Generation.DataAnnotations.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Generation.DataAnnotations.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/RangeAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/RangeAttributeTests.cs#L1-L52", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/RangeAttributeTests.cs", + "startLine": 1, + "endLine": 52, + "content": "using System;\nusing NUnit.Framework;\n\nusing DARange = System.ComponentModel.DataAnnotations.RangeAttribute;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class RangeAttributeTests\n{\n\tprivate class SupportedTarget\n\t{\n\t\t[DARange(1, 10)]\n\t\tpublic object Simple { get; set; }\n\t}\n\n\t[Test]\n\tpublic void SupportedRangeUsages()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Simple\", new JsonSchemaBuilder()\n\t\t\t\t\t.Minimum(1)\n\t\t\t\t\t.Maximum(10)\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\tprivate class UnsupportedTarget\n\t{\n\t\t[DARange(typeof(DateTime), \"2020/3/1\", \"2020/6/1\")]\n\t\tpublic object WithType { get; set; }\n\t}\n\n\t[Test]\n\tpublic void UnsupportedRangeUsages()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"WithType\", true)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n}", + "snippet": "using System;\nusing NUnit.Framework;\n\nusing DARange = System.ComponentModel.DataAnnotations.RangeAttribute;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotation" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/RegularExpressionAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/RegularExpressionAttributeTests.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/RegularExpressionAttributeTests.cs", + "startLine": 1, + "endLine": 29, + "content": "using System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class RegularExpressionAttributeTests\n{\n\tprivate class Target\n\t{\n\t\t[RegularExpression(@\"^[a-zA-Z''-'\\s]{1,40}$\")]\n\t\tpublic object Simple { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateMinLength()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Simple\", new JsonSchemaBuilder()\n\t\t\t\t\t.Pattern(@\"^[a-zA-Z''-'\\s]{1,40}$\")\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n}", + "snippet": "using System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class RegularExpressionA" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/SourceGeneration/DataAnnotationsSourceGeneratorTests.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/SourceGeneration/DataAnnotationsSourceGeneratorTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/SourceGeneration/DataAnnotationsSourceGeneratorTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\nusing static Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration.DataAnnotationsTestModels;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration;\n\npublic class DataAnnotationsSourceGeneratorTests\n{\n\t[Test]\n\tpublic void PersonWithMaxLength_GeneratesMaxLengthConstraint()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration.DataAnnotationsTestModels.PersonWithMaxLength\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": {\n\t\t \"type\": \"string\",\n\t\t \"maxLength\": 50\n\t\t },\n\t\t \"Age\": { \"type\": \"integer\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.DataAnnotationsTestModels_PersonWithMaxLength;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithMinLength_GeneratesMinLengthConstraint()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration.DataAnnotationsTestModels.PersonWithMinLength\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": {\n\t\t \"type\": \"string\",\n\t\t \"minLength\": 2\n\t\t },\n\t\t \"Age\": { \"type\": \"integer\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.DataAnnotationsTestModels_PersonWithMinLength;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithStringLength_GeneratesBothLengthConstraints()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration.DataAnnotationsTestModels.PersonWithStringLength\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": {\n\t\t \"type\": \"string\",\n\t\t \"minLength\": 2,\n\t\t \"maxLength\": 50\n\t\t },\n\t\t \"Age\": { \"type\": \"integer\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.DataAnnotationsTestModels_PersonWithStringLength;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithRange_GeneratesMinAndMaxConstraints()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration.DataAnnotationsTestModels.PersonWithRange\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t \"Age\": {\n\t\t \"type\": \"integer\",\n\t\t \"minimum\": 0,\n\t\t \"maximum\": 120\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.DataAnnotationsTestModels_PersonWithRange;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithRegex_GeneratesPatternConstraint()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration.DataAnnotationsTestModels.PersonWithRegex\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"SSN\": {\n\t\t \"type\": \"string\",\n\t\t \"pattern\": \"^\\\\d{3}-\\\\d{2}-\\\\d{4}$\"\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.DataAnnotationsTestModels_PersonWithRegex;", + "snippet": "using NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\nusing static Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration.DataAnnotationsTestModels;\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/SourceGeneration/DataAnnotationsSourceGeneratorTests.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/SourceGeneration/DataAnnotationsSourceGeneratorTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/SourceGeneration/DataAnnotationsSourceGeneratorTests.cs", + "startLine": 121, + "endLine": 240, + "content": "AssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithEmail_GeneratesEmailFormat()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration.DataAnnotationsTestModels.PersonWithEmail\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Email\": {\n\t\t \"type\": \"string\",\n\t\t \"format\": \"email\"\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.DataAnnotationsTestModels_PersonWithEmail;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithUrl_GeneratesUriFormat()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration.DataAnnotationsTestModels.PersonWithUrl\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Website\": {\n\t\t \"type\": \"string\",\n\t\t \"format\": \"uri\"\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.DataAnnotationsTestModels_PersonWithUrl;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n#if NET8_0_OR_GREATER\n\t[Test]\n\tpublic void PersonWithLength_GeneratesBothLengthConstraints()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration.DataAnnotationsTestModels.PersonWithLength\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": {\n\t\t \"type\": \"string\",\n\t\t \"minLength\": 2,\n\t\t \"maxLength\": 50\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.DataAnnotationsTestModels_PersonWithLength;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithBase64_GeneratesBase64Format()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration.DataAnnotationsTestModels.PersonWithBase64\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Image\": {\n\t\t \"type\": \"string\",\n\t\t \"format\": \"base64\"\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.DataAnnotationsTestModels_PersonWithBase64;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n#endif\n\n\t[Test]\n\tpublic void PersonWithMultipleConstraints_GeneratesAllConstraints()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration.DataAnnotationsTestModels.PersonWithMultipleConstraints\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": {\n\t\t \"type\": \"string\",\n\t\t \"minLength\": 2,\n\t\t \"maxLength\": 50,\n\t\t \"pattern\": \"^[A-Za-z\\\\s]+$\"\n\t\t },\n\t\t \"Age\": {\n\t\t \"type\": \"integer\",\n\t\t \"minimum\": 18,\n\t\t \"maximum\": 120\n\t\t },\n\t\t \"Email\": {\n\t\t \"type\": \"string\",\n\t\t \"format\": \"email\"\n\t\t }\n\t\t }", + "snippet": "AssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithEmail_GeneratesEmailFormat()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Jso" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/SourceGeneration/DataAnnotationsSourceGeneratorTests.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/SourceGeneration/DataAnnotationsSourceGeneratorTests.cs#L241-L249", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/SourceGeneration/DataAnnotationsSourceGeneratorTests.cs", + "startLine": 241, + "endLine": 249, + "content": "}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.DataAnnotationsTestModels_PersonWithMultipleConstraints;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": "}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.DataAnnotationsTestModels_PersonWithMultipleConstraints;\n\t\t\n\t\tA" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/SourceGeneration/DataAnnotationsTestModels.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/SourceGeneration/DataAnnotationsTestModels.cs#L1-L96", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/SourceGeneration/DataAnnotationsTestModels.cs", + "startLine": 1, + "endLine": 96, + "content": "using System.ComponentModel.DataAnnotations;\nusing Json.Schema.Generation.Serialization;\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests.SourceGeneration;\n\npublic static class DataAnnotationsTestModels\n{\n\t[GenerateJsonSchema]\n\tpublic class PersonWithMaxLength\n\t{\n\t\t[System.ComponentModel.DataAnnotations.MaxLength(50)]\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\t\n\t\tpublic int Age { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithMinLength\n\t{\n\t\t[System.ComponentModel.DataAnnotations.MinLength(2)]\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\t\n\t\tpublic int Age { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithStringLength\n\t{\n\t\t[StringLength(50, MinimumLength = 2)]\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\t\n\t\tpublic int Age { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithRange\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\t\n\t\t[Range(0, 120)]\n\t\tpublic int Age { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithRegex\n\t{\n\t\t[RegularExpression(@\"^\\d{3}-\\d{2}-\\d{4}$\")]\n\t\tpublic string SSN { get; set; } = string.Empty;\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithEmail\n\t{\n\t\t[EmailAddress]\n\t\tpublic string Email { get; set; } = string.Empty;\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithUrl\n\t{\n\t\t[Url]\n\t\tpublic string Website { get; set; } = string.Empty;\n\t}\n\n#if NET8_0_OR_GREATER\n\t[GenerateJsonSchema]\n\tpublic class PersonWithLength\n\t{\n\t\t[Length(2, 50)]\n\t\tpublic string Name { get; set; } = string.Empty;\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithBase64\n\t{\n\t\t[Base64String]\n\t\tpublic string Image { get; set; } = string.Empty;\n\t}\n#endif\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithMultipleConstraints\n\t{\n\t\t[StringLength(50, MinimumLength = 2)]\n\t\t[RegularExpression(@\"^[A-Za-z\\s]+$\")]\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\t\n\t\t[Range(18, 120)]\n\t\tpublic int Age { get; set; }\n\t\t\n\t\t[EmailAddress]\n\t\tpublic string Email { get; set; } = string.Empty;\n\t}\n}", + "snippet": "using System.ComponentModel.DataAnnotations;\nusing Json.Schema.Generation.Serialization;\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nnamespace Json.Schema.Generation.DataAnn" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/StringLengthAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/StringLengthAttributeTests.cs#L1-L51", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/StringLengthAttributeTests.cs", + "startLine": 1, + "endLine": 51, + "content": "using System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class StringLengthAttributeTests\n{\n\tprivate class TargetNoMinimum\n\t{\n\t\t[StringLength(10)]\n\t\tpublic object Simple { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateStringRange()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Simple\", new JsonSchemaBuilder()\n\t\t\t\t\t.MaxLength(10)\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\tprivate class TargetWithMinimum\n\t{\n\t\t[StringLength(20, MinimumLength = 2)]\n\t\tpublic object WithMin { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateStringRangeMinimum()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"WithMin\", new JsonSchemaBuilder()\n\t\t\t\t\t.MinLength(2)\n\t\t\t\t\t.MaxLength(20)\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n}", + "snippet": "using System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class StringLengthAttrib" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/TestEnvironment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/TestEnvironment.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/TestEnvironment.cs", + "startLine": 1, + "endLine": 29, + "content": "using System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\n[SetUpFixture]\ninternal static class TestEnvironment\n{\n\tpublic static readonly JsonSerializerOptions SerializerOptions =\n\t\tnew()\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tWriteIndented = true,\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t\t};\n\n\t[OneTimeSetUp]\n\tpublic static void Setup()\n\t{\n\t\tDataAnnotationsSupport.AddDataAnnotations();\n\t\tSchemaGeneratorConfiguration.Default.DefaultDialect = MetaSchemas.Draft202012Id;\n\t}\n}\n\n[JsonSerializable(typeof(JsonSchema))]\npublic partial class TestSerializerContext : JsonSerializerContext;", + "snippet": "using System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\n[SetUpFixture]\ninternal static class TestEnv" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations.Tests/UrlAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations.Tests/UrlAttributeTests.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations.Tests/UrlAttributeTests.cs", + "startLine": 1, + "endLine": 29, + "content": "using System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class UrlAttributeTests\n{\n\tprivate class Target\n\t{\n\t\t[Url]\n\t\tpublic object Simple { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateEmailFormat()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Simple\", new JsonSchemaBuilder()\n\t\t\t\t\t.Format(Formats.Uri)\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n}", + "snippet": "using System.ComponentModel.DataAnnotations;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.DataAnnotations.Tests;\n\npublic class UrlAttributeTests\n" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/AllowedValuesAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/AllowedValuesAttributeHandler.cs#L1-L41", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/AllowedValuesAttributeHandler.cs", + "startLine": 1, + "endLine": 41, + "content": "#if NET8_0_OR_GREATER\n\nusing System;\nusing System.ComponentModel.DataAnnotations;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds an `enum` keyword for the indicated values.\n/// \n/// \n/// For NativeAOT scenarios, only primitive JSON types are supported.\n/// \npublic class AllowedValuesAttributeHandler : IAttributeHandler\n{\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\t/// The attribute.\n\t/// \n\t/// A common pattern is to implement on the\n\t/// attribute itself. In this case, the parameter\n\t/// will be the same instance as the handler and can likely be ignored.\n\t/// \n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tvar allowedValues = (AllowedValuesAttribute)attribute;\n\n\t\tcontext.Intents.Add(new EnumIntent(allowedValues.Values.Select(x => JsonSerializer.SerializeToNode(x, DataAnnotationsSerializerContext.Default.Options)!)));\n\t}\n}\n\n#endif", + "snippet": "#if NET8_0_OR_GREATER\n\nusing System;\nusing System.ComponentModel.DataAnnotations;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Sc" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/Base64StringAttributeAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/Base64StringAttributeAttributeHandler.cs#L1-L35", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/Base64StringAttributeAttributeHandler.cs", + "startLine": 1, + "endLine": 35, + "content": "#if NET8_0_OR_GREATER\n\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `format` keyword with `base64`.\n/// \n/// \n/// By default, `format` is an annotation only. No validation will occur unless configured to do so.\n/// \n/// The `base64` format is defined by the OpenAPI 3.1 specification.\n/// \npublic class Base64StringAttributeAttributeHandler : FormatAttributeHandler\n{\n\t/// \n\t/// Creates a new .\n\t/// \n\tpublic Base64StringAttributeAttributeHandler() : base(\"base64\")\n\t{\n\t}\n\n\t/// \n\t/// Applies constraints for source generation.\n\t/// \n\t/// The schema builder.\n\t/// The builder for chaining.\n\tpublic static JsonSchemaBuilder Apply(JsonSchemaBuilder builder)\n\t{\n\t\treturn builder.Format(new Format(\"base64\"));\n\t}\n}\n\n#endif", + "snippet": "#if NET8_0_OR_GREATER\n\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `format` keyword with `base64`.\n/// \n/// \n/// By default" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/DataAnnotationsSerializerContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/DataAnnotationsSerializerContext.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/DataAnnotationsSerializerContext.cs", + "startLine": 1, + "endLine": 18, + "content": "using System.Text.Json.Serialization;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n[JsonSerializable(typeof(byte))]\n[JsonSerializable(typeof(sbyte))]\n[JsonSerializable(typeof(short))]\n[JsonSerializable(typeof(ushort))]\n[JsonSerializable(typeof(int))]\n[JsonSerializable(typeof(uint))]\n[JsonSerializable(typeof(long))]\n[JsonSerializable(typeof(ulong))]\n[JsonSerializable(typeof(float))]\n[JsonSerializable(typeof(double))]\n[JsonSerializable(typeof(decimal))]\n[JsonSerializable(typeof(string))]\n[JsonSerializable(typeof(bool))]\ninternal partial class DataAnnotationsSerializerContext : JsonSerializerContext;", + "snippet": "using System.Text.Json.Serialization;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n[JsonSerializable(typeof(byte))]\n[JsonSerializable(typeof(sbyte))]\n[JsonSerializable(typeof(short))]\n[JsonSerializable(typeof(usho" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/DataAnnotationsSupport.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/DataAnnotationsSupport.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/DataAnnotationsSupport.cs", + "startLine": 1, + "endLine": 38, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\n#pragma warning disable IL2026\n#pragma warning disable IL2111\n#pragma warning disable IL2075\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Exposes support for the System.ComponentModel.DataAnnotations namespace.\n/// \npublic static class DataAnnotationsSupport\n{\n\tprivate static readonly List _externalHandlers =\n\t\ttypeof(DataAnnotationsSupport)\n\t\t\t.Assembly\n\t\t\t.DefinedTypes\n\t\t\t.Where(t => typeof(IAttributeHandler).IsAssignableFrom(t) &&\n\t\t\t !typeof(Attribute).IsAssignableFrom(t) &&\n\t\t\t !t.IsAbstract && !t.IsInterface)\n\t\t\t.Select(Activator.CreateInstance)\n\t\t\t.Cast()\n\t\t\t.ToList();\n\n\t/// \n\t/// Adds support for the System.ComponentModel.DataAnnotations namespace attributes.\n\t/// \n\t[RequiresDynamicCode(\"This method uses reflection to query types and is not suited for AOT scenarios.\")]\n\tpublic static void AddDataAnnotations()\n\t{\n\t\tforeach (var handler in _externalHandlers)\n\t\t{\n\t\t\tAttributeHandler.AddHandler(handler);\n\t\t}\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\n#pragma warning disable IL2026\n#pragma warning disable IL2111\n#pragma warning disable IL2075\n\nnamespace Json.Schem" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/DeniedValuesAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/DeniedValuesAttributeHandler.cs#L1-L45", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/DeniedValuesAttributeHandler.cs", + "startLine": 1, + "endLine": 45, + "content": "#if NET8_0_OR_GREATER\n\nusing System;\nusing System.ComponentModel.DataAnnotations;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `not: {enum}` construct for the indicated values.\n/// \n/// \n/// For NativeAOT scenarios, only primitive JSON types are supported.\n/// \npublic class DeniedValuesAttributeHandler : IAttributeHandler\n{\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\t/// The attribute.\n\t/// \n\t/// A common pattern is to implement on the\n\t/// attribute itself. In this case, the parameter\n\t/// will be the same instance as the handler and can likely be ignored.\n\t/// \n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\")]\n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tvar allowedValues = (DeniedValuesAttribute)attribute;\n\n\t\tcontext.Intents.Add(new NotIntent(\n\t\t\tnew[]\n\t\t\t{\n\t\t\t\tnew EnumIntent(allowedValues.Values.Select(x => JsonSerializer.SerializeToNode(x, DataAnnotationsSerializerContext.Default.Options)!))\n\t\t\t}));\n\t}\n}\n\n#endif", + "snippet": "#if NET8_0_OR_GREATER\n\nusing System;\nusing System.ComponentModel.DataAnnotations;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Sc" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/EmailAddressAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/EmailAddressAttributeHandler.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/EmailAddressAttributeHandler.cs", + "startLine": 1, + "endLine": 29, + "content": "using System.ComponentModel.DataAnnotations;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `format` keyword with `email`.\n/// \n/// \n/// By default, `format` is an annotation only. No validation will occur unless configured to do so.\n/// \npublic class EmailAddressAttributeHandler : FormatAttributeHandler\n{\n\t/// \n\t/// Creates a new .\n\t/// \n\tpublic EmailAddressAttributeHandler() : base(Formats.Email)\n\t{\n\t}\n\n\t/// \n\t/// Applies constraints for source generation.\n\t/// \n\t/// The schema builder.\n\t/// The builder for chaining.\n\tpublic static JsonSchemaBuilder Apply(JsonSchemaBuilder builder)\n\t{\n\t\treturn builder.Format(Formats.Email);\n\t}\n}", + "snippet": "using System.ComponentModel.DataAnnotations;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `format` keyword with `email`.\n/// \n/// \n/// By default, `format` is an annotat" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/EnumDataTypeAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/EnumDataTypeAttributeHandler.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/EnumDataTypeAttributeHandler.cs", + "startLine": 1, + "endLine": 32, + "content": "using System;\nusing System.ComponentModel.DataAnnotations;\nusing System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds an `enum` keyword for the indicated enumeration type.\n/// \npublic class EnumDataTypeAttributeHandler : IAttributeHandler\n{\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\t/// The attribute.\n\t/// \n\t/// A common pattern is to implement on the\n\t/// attribute itself. In this case, the parameter\n\t/// will be the same instance as the handler and can likely be ignored.\n\t/// \n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tvar enumDataType = (EnumDataTypeAttribute)attribute;\n\n\t\tvar values = Enum.GetNames(enumDataType.EnumType).ToList();\n\n\t\tcontext.Intents.Add(new EnumIntent(values));\n\t}\n}", + "snippet": "using System;\nusing System.ComponentModel.DataAnnotations;\nusing System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds an `enum` keyword for the ind" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/FormatAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/FormatAttributeHandler.cs#L1-L49", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/FormatAttributeHandler.cs", + "startLine": 1, + "endLine": 49, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Base class for attributes that just need to add a `format` keyword.\n/// \n/// The attribute type.\npublic abstract class FormatAttributeHandler : IAttributeHandler\n\twhere T : Attribute\n{\n\tprivate readonly Format _format;\n\n\t/// \n\t/// Creates a new handler that uses a custom format.\n\t/// \n\t/// The format.\n\tpublic FormatAttributeHandler(string format)\n\t{\n\t\t_format = new Format(format);\n\t}\n\n\t/// \n\t/// Creates a new handler that uses a predefined format.\n\t/// \n\t/// The format.\n\tpublic FormatAttributeHandler(Format format)\n\t{\n\t\t_format = format;\n\t}\n\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\t/// The attribute.\n\t/// \n\t/// A common pattern is to implement on the\n\t/// attribute itself. In this case, the parameter\n\t/// will be the same instance as the handler and can likely be ignored.\n\t/// \n\tpublic virtual void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tcontext.Intents.Add(new FormatIntent(_format));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Base class for attributes that just need to add a `format` keyword.\n/// \n/// \n/// Adds `minLength` and `maxLength` keywords.\n/// \n/// \n/// `minLength` will be not be added if the value is less than or equal to zero.\n/// \npublic class LengthAttributeHandler : IAttributeHandler\n{\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\t/// The attribute.\n\t/// \n\t/// A common pattern is to implement on the\n\t/// attribute itself. In this case, the parameter\n\t/// will be the same instance as the handler and can likely be ignored.\n\t/// \n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tvar length = (LengthAttribute)attribute;\n\n\t\tif (length.MinimumLength > 0)\n\t\t\tcontext.Intents.Add(new MinLengthIntent((uint)length.MinimumLength));\n\t\tcontext.Intents.Add(new MaxLengthIntent((uint)length.MaximumLength));\n\t}\n\n\t/// \n\t/// Applies constraints for source generation.\n\t/// \n\t/// The schema builder.\n\t/// The minimum length.\n\t/// The maximum length.\n\t/// The builder for chaining.\n\tpublic static JsonSchemaBuilder Apply(JsonSchemaBuilder builder, int minimumLength, int maximumLength)\n\t{\n\t\tif (minimumLength > 0)\n\t\t\tbuilder = builder.MinLength((uint)minimumLength);\n\t\treturn builder.MaxLength((uint)maximumLength);\n\t}\n}\n\n#endif", + "snippet": "#if NET8_0_OR_GREATER\n\nusing System;\nusing System.ComponentModel.DataAnnotations;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds `minLength` and `maxLengt" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/MaxLengthAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/MaxLengthAttributeHandler.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/MaxLengthAttributeHandler.cs", + "startLine": 1, + "endLine": 39, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `maxLength` keyword.\n/// \npublic class MaxLengthAttributeHandler : IAttributeHandler\n{\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\t/// The attribute.\n\t/// \n\t/// A common pattern is to implement on the\n\t/// attribute itself. In this case, the parameter\n\t/// will be the same instance as the handler and can likely be ignored.\n\t/// \n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tvar maxLength = (System.ComponentModel.DataAnnotations.MaxLengthAttribute)attribute;\n\n\t\tcontext.Intents.Add(new MaxLengthIntent((uint)maxLength.Length));\n\t}\n\n\t/// \n\t/// Applies constraints for source generation.\n\t/// \n\t/// The schema builder.\n\t/// The maximum length.\n\t/// The builder for chaining.\n\tpublic static JsonSchemaBuilder Apply(JsonSchemaBuilder builder, int length)\n\t{\n\t\treturn builder.MaxLength((uint)length);\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `maxLength` keyword.\n/// \npublic class MaxLengthAttributeHandler : IAttributeHand" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/MinLengthAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/MinLengthAttributeHandler.cs#L1-L45", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/MinLengthAttributeHandler.cs", + "startLine": 1, + "endLine": 45, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `minLength` keyword.\n/// \n/// \n/// Will be not be added if the value is less than or equal to zero.\n/// \npublic class MinLengthAttributeHandler : IAttributeHandler\n{\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\t/// The attribute.\n\t/// \n\t/// A common pattern is to implement on the\n\t/// attribute itself. In this case, the parameter\n\t/// will be the same instance as the handler and can likely be ignored.\n\t/// \n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tvar minLength = (System.ComponentModel.DataAnnotations.MinLengthAttribute)attribute;\n\n\t\tif (minLength.Length > 0)\n\t\t\tcontext.Intents.Add(new MinLengthIntent((uint)minLength.Length));\n\t}\n\n\t/// \n\t/// Applies constraints for source generation.\n\t/// \n\t/// The schema builder.\n\t/// The minimum length.\n\t/// The builder for chaining.\n\tpublic static JsonSchemaBuilder Apply(JsonSchemaBuilder builder, int length)\n\t{\n\t\tif (length > 0)\n\t\t\treturn builder.MinLength((uint)length);\n\t\treturn builder;\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `minLength` keyword.\n/// \n/// \n/// Will be not be added if the value is " + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/net10.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Debug/net10.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/net10.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs", + "startLine": 1, + "endLine": 29, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net.Generation to support the System.ComponentModel.DataAnnota\" +\n \"tions namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.1.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/net8.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Debug/net8.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/net8.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net.Generation to support the System.ComponentModel.DataAnnota\" +\n \"tions namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.1.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/net9.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Debug/net9.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/net9.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net.Generation to support the System.ComponentModel.DataAnnota\" +\n \"tions namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.1.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/netstandard2.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Debug/netstandard2.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Debug/netstandard2.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net.Generation to support the System.ComponentModel.DataAnnota\" +\n \"tions namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.1.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Release/net10.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Release/net10.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Release/net10.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs", + "startLine": 1, + "endLine": 29, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net.Generation to support the System.ComponentModel.DataAnnota\" +\n \"tions namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.1.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Release/net8.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Release/net8.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Release/net8.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net.Generation to support the System.ComponentModel.DataAnnota\" +\n \"tions namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.1.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Release/net9.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Release/net9.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Release/net9.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net.Generation to support the System.ComponentModel.DataAnnota\" +\n \"tions namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.1.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/obj/Release/netstandard2.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/obj/Release/netstandard2.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/obj/Release/netstandard2.0/JsonSchema.Generation.DataAnnotations.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net.Generation to support the System.ComponentModel.DataAnnota\" +\n \"tions namespace\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"3.1.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"3.1.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation.DataAnnotations\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"3.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/RangeAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/RangeAttributeHandler.cs#L1-L49", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/RangeAttributeHandler.cs", + "startLine": 1, + "endLine": 49, + "content": "using System;\nusing System.ComponentModel.DataAnnotations;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds `minimum` and `maximum` keywords.\n/// \n/// \n/// Only numeric types are supported.\n/// \npublic class RangeAttributeHandler : IAttributeHandler\n{\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\t/// The attribute.\n\t/// \n\t/// A common pattern is to implement on the\n\t/// attribute itself. In this case, the parameter\n\t/// will be the same instance as the handler and can likely be ignored.\n\t/// \n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tvar range = (RangeAttribute)attribute;\n\t\tif (!range.OperandType.IsNumber() && !range.OperandType.IsNullableNumber()) return;\n\n\t\tcontext.Intents.Add(new MinimumIntent(Convert.ToDecimal(range.Minimum)));\n\t\tcontext.Intents.Add(new MaximumIntent(Convert.ToDecimal(range.Maximum)));\n\t}\n\n\t/// \n\t/// Applies constraints for source generation.\n\t/// \n\t/// The schema builder.\n\t/// The minimum value.\n\t/// The maximum value.\n\t/// The builder for chaining.\n\tpublic static JsonSchemaBuilder Apply(JsonSchemaBuilder builder, object minimum, object maximum)\n\t{\n\t\treturn builder\n\t\t\t.Minimum(Convert.ToDecimal(minimum))\n\t\t\t.Maximum(Convert.ToDecimal(maximum));\n\t}\n}", + "snippet": "using System;\nusing System.ComponentModel.DataAnnotations;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds `minimum` and `maximum` keyword" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/RegularExpressionAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/RegularExpressionAttributeHandler.cs#L1-L40", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/RegularExpressionAttributeHandler.cs", + "startLine": 1, + "endLine": 40, + "content": "using System;\nusing System.ComponentModel.DataAnnotations;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `pattern` keyword.\n/// \npublic class RegularExpressionAttributeHandler : IAttributeHandler\n{\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\t/// The attribute.\n\t/// \n\t/// A common pattern is to implement on the\n\t/// attribute itself. In this case, the parameter\n\t/// will be the same instance as the handler and can likely be ignored.\n\t/// \n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tvar regex = (RegularExpressionAttribute)attribute;\n\n\t\tcontext.Intents.Add(new PatternIntent(regex.Pattern));\n\t}\n\n\t/// \n\t/// Applies constraints for source generation.\n\t/// \n\t/// The schema builder.\n\t/// The regular expression pattern.\n\t/// The builder for chaining.\n\tpublic static JsonSchemaBuilder Apply(JsonSchemaBuilder builder, string pattern)\n\t{\n\t\treturn builder.Pattern(pattern);\n\t}\n}", + "snippet": "using System;\nusing System.ComponentModel.DataAnnotations;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `pattern` keyword.\n/// \npublic class" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/StringLengthAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/StringLengthAttributeHandler.cs#L1-L49", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/StringLengthAttributeHandler.cs", + "startLine": 1, + "endLine": 49, + "content": "using System;\nusing System.ComponentModel.DataAnnotations;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `maxLength` and an optional `minLength` keyword.\n/// \n/// \n/// `minLength` will be not be added if the value is less than or equal to zero.\n/// \npublic class StringLengthAttributeHandler : IAttributeHandler\n{\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\t/// The attribute.\n\t/// \n\t/// A common pattern is to implement on the\n\t/// attribute itself. In this case, the parameter\n\t/// will be the same instance as the handler and can likely be ignored.\n\t/// \n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tvar length = (StringLengthAttribute)attribute;\n\n\t\tif (length.MinimumLength > 0)\n\t\t\tcontext.Intents.Add(new MinLengthIntent((uint)length.MinimumLength));\n\t\tcontext.Intents.Add(new MaxLengthIntent((uint)length.MaximumLength));\n\t}\n\n\t/// \n\t/// Applies constraints for source generation.\n\t/// \n\t/// The schema builder.\n\t/// The maximum length.\n\t/// The minimum length.\n\t/// The builder for chaining.\n\tpublic static JsonSchemaBuilder Apply(JsonSchemaBuilder builder, int maximumLength, int minimumLength)\n\t{\n\t\tif (minimumLength > 0)\n\t\t\tbuilder = builder.MinLength((uint)minimumLength);\n\t\treturn builder.MaxLength((uint)maximumLength);\n\t}\n}", + "snippet": "using System;\nusing System.ComponentModel.DataAnnotations;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `maxLength` and an optional `minLength` keywor" + }, + { + "title": "src/JsonSchema.Generation.DataAnnotations/UrlAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.DataAnnotations/UrlAttributeHandler.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.DataAnnotations/UrlAttributeHandler.cs", + "startLine": 1, + "endLine": 29, + "content": "using System.ComponentModel.DataAnnotations;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `format` keyword with `uri`.\n/// \n/// \n/// By default, `format` is an annotation only. No validation will occur unless configured to do so.\n/// \npublic class UrlAttributeHandler : FormatAttributeHandler\n{\n\t/// \n\t/// Creates a new .\n\t/// \n\tpublic UrlAttributeHandler() : base(Formats.Uri)\n\t{\n\t}\n\n\t/// \n\t/// Applies constraints for source generation.\n\t/// \n\t/// The schema builder.\n\t/// The builder for chaining.\n\tpublic static JsonSchemaBuilder Apply(JsonSchemaBuilder builder)\n\t{\n\t\treturn builder.Format(Formats.Uri);\n\t}\n}", + "snippet": "using System.ComponentModel.DataAnnotations;\n\nnamespace Json.Schema.Generation.DataAnnotations;\n\n/// \n/// Adds a `format` keyword with `uri`.\n/// \n/// \n/// By default, `format` is an annotatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/AdditionalItemsTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/AdditionalItemsTests.cs#L1-L107", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/AdditionalItemsTests.cs", + "startLine": 1, + "endLine": 107, + "content": "using System.Collections.Generic;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class AdditionalItemsTests\n{\n\t[AdditionalItems(true)]\n\tprivate class AdditionalItemsTrue : List;\n\n\t[Test]\n\tpublic void TrueIsAdded()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tDialect = Dialect.Draft202012\n\t\t};\n\t\tvar expected = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.AdditionalItems(true);\n\n\t\tvar actual = new JsonSchemaBuilder(buildOptions).FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[AdditionalItems(false)]\n\tprivate class AdditionalItemsFalse : List;\n\n\t[Test]\n\tpublic void FalseIsAdded()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tDialect = Dialect.Draft202012\n\t\t};\n\t\tvar expected = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.AdditionalItems(false);\n\n\t\tvar actual = new JsonSchemaBuilder(buildOptions).FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[AdditionalItems(typeof(string))]\n\tprivate class AdditionalItemsString : List;\n\n\t[Test]\n\tpublic void TypeIsAdded()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tDialect = Dialect.Draft202012\n\t\t};\n\t\tvar expected = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.AdditionalItems(new JsonSchemaBuilder().Type(SchemaValueType.String));\n\n\t\tvar actual = new JsonSchemaBuilder(buildOptions).FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class IntList : List\n\t{\n\t\tpublic string Bar { get; set; }\n\t}\n\n\tprivate class AdditionalItemsOnProp\n\t{\n\t\t[AdditionalItems(false)]\n\t\tpublic IntList Foo { get; set; }\n\t}\n\n\t[Test]\n\tpublic void FalseIsAddedToProp()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tDialect = Dialect.Draft202012\n\t\t};\n\t\tvar expected = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Foo\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t\t\t.AdditionalItems(false)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder(buildOptions).FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic " + }, + { + "title": "src/JsonSchema.Generation.Tests/AdditionalPropertiesTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/AdditionalPropertiesTests.cs#L1-L99", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/AdditionalPropertiesTests.cs", + "startLine": 1, + "endLine": 99, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class AdditionalPropertiesTests\n{\n\t[AdditionalProperties(true)]\n\tprivate class AdditionalPropertiesTrue;\n\n\t[Test]\n\tpublic void TrueIsAdded()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.AdditionalProperties(true);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[AdditionalProperties(false)]\n\tprivate class AdditionalPropertiesFalse\n\t{\n\t\tpublic int Foo { get; set; }\n\t}\n\n\t[Test]\n\tpublic void FalseIsAdded()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Foo\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)))\n\t\t\t.AdditionalProperties(false);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[AdditionalProperties(typeof(string))]\n\tprivate class AdditionalPropertiesString\n\t{\n\t\tpublic int Foo { get; set; }\n\t}\n\n\t[Test]\n\tpublic void TypeIsAdded()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Foo\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)))\n\t\t\t.AdditionalProperties(new JsonSchemaBuilder().Type(SchemaValueType.String));\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class PropClass\n\t{\n\t\tpublic string Bar { get; set; }\n\t}\n\n\tprivate class AdditionalPropertiesOnProp\n\t{\n\t\t[AdditionalProperties(false)]\n\t\tpublic PropClass Foo { get; set; }\n\t}\n\n\t[Test]\n\tpublic void FalseIsAddedToProp()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Foo\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"Bar\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t\t\t)\n\t\t\t\t\t.AdditionalProperties(false)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class AdditionalPropertiesTests\n{\n" + }, + { + "title": "src/JsonSchema.Generation.Tests/ArrayGenerationTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ArrayGenerationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ArrayGenerationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n// ReSharper disable UnusedMember.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class ArrayGenerationTests\n{\n\t[Test]\n\tpublic void ListOfInt()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType>();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class MinItemsList\n\t{\n\t\t[MinItems(5)]\n\t\tpublic List List { get; set; }\n\t}\n\n\t[Test]\n\tpublic void ListOfIntWithMinItems()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"List\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t)\n\t\t\t\t\t.MinItems(5)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class MinValueList\n\t{\n\t\t[Minimum(5, GenericParameter = 0)]\n\t\tpublic List List { get; set; }\n\t}\n\n\t[Test]\n\tpublic void ListOfIntWithMinValue()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"List\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t\t.Minimum(5)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class MinValueListWithBasicList\n\t{\n\t\t[Minimum(5, GenericParameter = 0)]\n\t\tpublic List List { get; set; }\n\t\tpublic List BasicList { get; set; }\n\t}\n\n\t[Test]\n\tpublic void ListOfIntWithMinValueWithBasicList()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"List\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t\t.Minimum(5)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\t(\"BasicList\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Title(\"A test enum\")]\n\tpublic enum EnumTest\n\t{\n\t\tOne = 1,\n\t\tTwo = 2\n\t}", + "snippet": "using System.Collections.Generic;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n// ReSharper disable UnusedMember.Local\n\nnamespac" + }, + { + "title": "src/JsonSchema.Generation.Tests/ArrayGenerationTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ArrayGenerationTests.cs#L121-L168", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ArrayGenerationTests.cs", + "startLine": 121, + "endLine": 168, + "content": "[Test]\n\tpublic void ListOfAttributedEnum()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Enum(\"One\", \"Two\")\n\t\t\t\t.Title(\"A test enum\")\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType>();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class MultipleTestEnums\n\t{\n\t\tpublic List List { get; set; }\n\t\tpublic EnumTest Single { get; set; }\n\t}\n\n\t[Test]\n\tpublic void AttributedEnumIsRefactored()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Defs(\n\t\t\t\t(\"enumTestInArrayGenerationTests\", new JsonSchemaBuilder()\n\t\t\t\t\t.Enum(\"One\", \"Two\")\n\t\t\t\t\t.Title(\"A test enum\")\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"List\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items(new JsonSchemaBuilder().Ref(\"#/$defs/enumTestInArrayGenerationTests\"))\n\t\t\t\t),\n\t\t\t\t(\"Single\", new JsonSchemaBuilder().Ref(\"#/$defs/enumTestInArrayGenerationTests\"))\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": "[Test]\n\tpublic void ListOfAttributedEnum()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Enum(\"One\", \"Two\")\n\t\t\t\t." + }, + { + "title": "src/JsonSchema.Generation.Tests/AssertionExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/AssertionExtensions.cs#L1-L36", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/AssertionExtensions.cs", + "startLine": 1, + "endLine": 36, + "content": "using TestHelpers;\n\n// ReSharper disable LocalizableElement\n\nnamespace Json.Schema.Generation.Tests;\n\npublic static class AssertionExtensions\n{\n\tpublic static void AssertEqual(JsonSchema expected, JsonSchema actual)\n\t{\n\t\tTestConsole.WriteLine(\"Expected\");\n\t\tTestConsole.WriteLine(expected.Root.Source);\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(\"Actual\");\n\t\tTestConsole.WriteLine(actual.Root.Source);\n\t\tJsonAssert.AreEquivalent(expected.Root.Source, actual.Root.Source);\n\t}\n\n\t//public static void AssertEqual(PropertiesKeyword expected, PropertiesKeyword actual)\n\t//{\n\t//\tTestConsole.WriteLine(\"Expected\");\n\t//\tvar expectedAsNode = JsonSerializer.SerializeToNode(expected, TestSerializerContext.Default.PropertiesKeyword);\n\t//\tTestConsole.WriteLine(expectedAsNode);\n\t//\tTestConsole.WriteLine();\n\t//\tTestConsole.WriteLine(\"Actual\");\n\t//\tvar actualAsNode = JsonSerializer.SerializeToNode(actual, TestSerializerContext.Default.PropertiesKeyword);\n\t//\tTestConsole.WriteLine(actualAsNode);\n\t//\tJsonAssert.AreEquivalent(expectedAsNode, actualAsNode);\n\t//}\n\n\tpublic static void VerifyGeneration(JsonSchema expected, SchemaGeneratorConfiguration? config = null)\n\t{\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType(config);\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": "using TestHelpers;\n\n// ReSharper disable LocalizableElement\n\nnamespace Json.Schema.Generation.Tests;\n\npublic static class AssertionExtensions\n{\n\tpublic static void AssertEqual(JsonSchema expected, JsonSchema actual)\n\t{\n\t" + }, + { + "title": "src/JsonSchema.Generation.Tests/AttributeHandlerTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/AttributeHandlerTests.cs#L1-L80", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/AttributeHandlerTests.cs", + "startLine": 1, + "endLine": 80, + "content": "using System;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class AttributeHandlerTests\n{\n\t[AttributeUsage(AttributeTargets.Property)]\n\tprivate class AttributeWithDirectHandler : Attribute, IAttributeHandler\n\t{\n\t\tpublic const uint MaxLength = 100;\n\n\t\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t\t{\n\t\t\tcontext.Intents.Add(new Intents.MaxLengthIntent(MaxLength));\n\t\t}\n\t}\n\n\t[AttributeUsage(AttributeTargets.Property)]\n\tprivate class AttributeWithIndirectHandler : Attribute\n\t{\n\t\tpublic readonly uint MaxLength = 200;\n\t}\n\n\tprivate class CustomAttributeHandler : IAttributeHandler\n\t{\n\t\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t\t{\n\t\t\tvar maxLength = attribute as AttributeWithIndirectHandler;\n\t\t\tcontext.Intents.Add(new Intents.MaxLengthIntent(maxLength!.MaxLength));\n\t\t}\n\t}\n\n\tprivate class TypeWithCustomattribute\n\t{\n\t\t[AttributeWithDirectHandler]\n\t\tpublic string MyProperty { get; set; }\n\t}\n\n\tprivate class TypeWithCustomAttribute2\n\t{\n\t\t[AttributeWithIndirectHandler]\n\t\tpublic string MyProperty { get; set; }\n\t}\n\n\t[Test]\n\tpublic void DirectAttributeHandler()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"MyProperty\", new JsonSchemaBuilder().Type(SchemaValueType.String).MaxLength(AttributeWithDirectHandler.MaxLength))\n\t\t\t);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void IndirectAttributeHandler()\n\t{\n\t\tAttributeHandler.RemoveHandler();\n\t\tAttributeHandler.AddHandler();\n\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"MyProperty\", new JsonSchemaBuilder().Type(SchemaValueType.String).MaxLength(200))\n\t\t\t);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": "using System;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class AttributeHandle" + }, + { + "title": "src/JsonSchema.Generation.Tests/BoundaryTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/BoundaryTests.cs#L1-L52", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/BoundaryTests.cs", + "startLine": 1, + "endLine": 52, + "content": "using System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class BoundaryTests\n{\n\t// ReSharper disable once ClassNeverInstantiated.Local\n\tprivate class BoundaryTestSubject\n\t{\n\t\t[ExclusiveMaximum(double.MaxValue)]\n\t\t[ExclusiveMinimum(double.MinValue)]\n\t\t[Maximum(double.MaxValue)]\n\t\t[Minimum(double.MinValue)]\n\t\t// ReSharper disable once UnusedMember.Local\n\t\tpublic int Value { get; set; }\n\t}\n\n\t[Test]\n\tpublic void MaximumRangeIsClamped()\n\t{\n\t\tvar builder = new JsonSchemaBuilder();\n\t\tbuilder.FromType();\n\n\t\tvar schema = builder.Build();\n\t\tTestConsole.WriteLine(schema.Root.Source);\n\n\t\tvar maxValue = decimal.MaxValue.ToString(System.Globalization.CultureInfo.InvariantCulture);\n\t\tvar minValue = decimal.MinValue.ToString(System.Globalization.CultureInfo.InvariantCulture);\n\n\t\tvar expected = JsonDocument.Parse(\n\t\t\t$$\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"Value\": {\n\t\t\t \"type\": \"integer\",\n\t\t\t \"minimum\": {{minValue}},\n\t\t\t \"maximum\": {{maxValue}},\n\t\t\t \"exclusiveMinimum\": {{minValue}},\n\t\t\t \"exclusiveMaximum\": {{maxValue}}\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\n\t\tAssert.That(expected.IsEquivalentTo(schema.Root.Source));\n\t}\n}", + "snippet": "using System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class BoundaryTests\n{\n\t// ReSharper disable once ClassNeverInstantiated.Local\n\tprivate c" + }, + { + "title": "src/JsonSchema.Generation.Tests/ClientTests.cs (1/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ClientTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ClientTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing System.Text.Json.Serialization.Metadata;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\nusing NUnit.Framework;\nusing TestHelpers;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\n// ReSharper disable InconsistentNaming\n// ReSharper disable UnusedMember.Local\n// ReSharper disable UnusedMember.Global\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class ClientTests\n{\n\tpublic class TestMenu\n\t{\n\t\tpublic string Name { get; set; }\n\n\t\tpublic List Children { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue85_RecursiveGeneration_PropertyAsListOfSelf()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(nameof(TestMenu.Name), new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t),\n\t\t\t\t(nameof(TestMenu.Children), new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items(new JsonSchemaBuilder().Ref(\"#\"))\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\tpublic class TreeNode\n\t{\n\t\tpublic string Value { get; set; }\n\n\t\t[JsonPropertyName(\"left\")]\n\t\tpublic TreeNodeMetaData Left { get; set; }\n\t\t\n\t\t[JsonPropertyName(\"right\")]\n\t\tpublic TreeNodeMetaData Right { get; set; }\n\t}\n\n\tpublic class TreeNodeMetaData\n\t{\n\t\tpublic TreeNode Node { get; set; }\n\t\tpublic int Position { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue87_RecursiveGeneration_SelfReferenceInDefs()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Defs(\n\t\t\t\t(\"treeNodeMetaDataInClientTests\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(nameof(TreeNodeMetaData.Node), new JsonSchemaBuilder().Ref(\"#\")),\n\t\t\t\t\t\t(nameof(TreeNodeMetaData.Position), new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Properties(\n\t\t\t\t(nameof(TreeNode.Value), new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t),\n\t\t\t\t(\"left\", new JsonSchemaBuilder()\n\t\t\t\t\t.Ref($\"#/$defs/treeNodeMetaDataInClientTests\")\n\t\t\t\t),\n\t\t\t\t(\"right\", new JsonSchemaBuilder()\n\t\t\t\t\t.Ref($\"#/$defs/treeNodeMetaDataInClientTests\")\n\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\tprivate class SimpleValueWidgetSettings\n\t{\n\t\t[Required] public string name { get; set; }\n\n\t\t[Required] public string valueLink { get; set; }\n\n\t\t[Required] public string qualityValueLink { get; set; }\n\n\t\t[Required] public string unitLink { get; set; }\n\n\t\t[Required] public string displayMultiplier { get; set; }\n\n\t\t[Required] public string displayUnits { get; set; }\n\n\t\t[Required] public string fontColor { get; set; }\n\n\t\t[Required] public string stringFormat { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue97_PersistentDataBetweenGenerationCalls()\n\t{\n\t\tvar simpleValueSettingsSchema1 = new JsonSchemaBuilder().FromType().AdditionalProperties(false).Build();\n\t\tvar simpleValueSettingsSchema2 = new JsonSchemaBuilder().FromType().AdditionalProperties(false).Build();", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing System.Text.Json.Serialization.Metad" + }, + { + "title": "src/JsonSchema.Generation.Tests/ClientTests.cs (2/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ClientTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ClientTests.cs", + "startLine": 121, + "endLine": 240, + "content": "TestConsole.WriteLine(JsonSerializer.Serialize(simpleValueSettingsSchema1, TestSerializerContext.Default.JsonSchema));\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(simpleValueSettingsSchema2, TestSerializerContext.Default.JsonSchema));\n\t\tAssertEqual(simpleValueSettingsSchema1, simpleValueSettingsSchema2);\n\t}\n\n\t[AttributeUsage(AttributeTargets.Property)]\n\tprivate class UnfortunateAttribute : Attribute\n\t{\n\t}\n\n\tprivate class ObjectA\n\t{\n\t\tpublic Guid Property1 { get; set; }\n\t\t[Unfortunate]\n\t\tpublic Guid Property2 { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue272_UnhandledAttributeShouldBeIgnoredWhenOptimizing()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Property1\", new JsonSchemaBuilder().Ref(\"#/$defs/guid\")),\n\t\t\t\t(\"Property2\", new JsonSchemaBuilder().Ref(\"#/$defs/guid\"))\n\t\t\t)\n\t\t\t.Defs(\n\t\t\t\t(\"guid\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.Format(Formats.Uuid)\n\t\t\t\t)\n\t\t\t);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class JsonObjectProp\n\t{\n\t\tpublic JsonObject ObjectProp { get; set; }\n\t\tpublic JsonArray ArrayProp { get; set; }\n\t\tpublic JsonValue ValueProp { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GenerateForPlanImpl()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"ObjectProp\", new JsonSchemaBuilder().Type(SchemaValueType.Object)),\n\t\t\t\t(\"ArrayProp\", new JsonSchemaBuilder().Type(SchemaValueType.Array)),\n\t\t\t\t(\"ValueProp\", true)\n\t\t\t);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tpublic class Person\n\t{\n\t\t[MyAttribute1]\n\t\tpublic string FirstName { get; set; }\n\t\t[MyAttribute2]\n\t\tpublic string LastName { get; set; }\n\t}\n\n\t[AttributeUsage(AttributeTargets.Property)]\n\tpublic class MyAttribute1 : Attribute;\n\n\t[AttributeUsage(AttributeTargets.Property)]\n\tpublic class MyAttribute2 : Attribute;\n\n\tpublic class PersonRefiner : ISchemaRefiner\n\t{\n\t\tpublic Dictionary> FoundAttributes { get; } = [];\n\n\t\tpublic void Run(SchemaGenerationContextBase context)\n\t\t{\n\t\t\tvar properties = context.Intents.OfType().Single();\n\t\t\tvar firstNameContext = (MemberGenerationContext)properties.Properties[\"FirstName\"];\n\t\t\tvar lastNameContext = (MemberGenerationContext)properties.Properties[\"LastName\"];\n\n\t\t\tFoundAttributes[nameof(Person.FirstName)] = firstNameContext.Attributes.Select(x => x.GetType()).ToList();\n\t\t\tFoundAttributes[nameof(Person.LastName)] = lastNameContext.Attributes.Select(x => x.GetType()).ToList();\n\t\t}\n\n\t\tpublic bool ShouldRun(SchemaGenerationContextBase context)\n\t\t{\n\t\t\treturn context.Type == typeof(Person);\n\t\t}\n\t}\n\n\t[Test]\n\t[Ignore(\"Works as expected. See issue.\")]\n\tpublic void Issue277_AttributeMixup()\n\t{\n\t\tJsonSchemaBuilder jsonSchemaBuilder = new();\n\t\tSchemaGeneratorConfiguration generatorConfiguration = new();\n\t\tvar personRefiner = new PersonRefiner();\n\t\tgeneratorConfiguration.Refiners.Add(personRefiner);\n\t\tjsonSchemaBuilder.FromType(typeof(Person), generatorConfiguration).Build();\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(personRefiner.FoundAttributes[nameof(Person.FirstName)], Has.Count.EqualTo(1));\n\t\t\tAssert.That(personRefiner.FoundAttributes[nameof(Person.FirstName)][0], Is.EqualTo(typeof(MyAttribute1)));\n\t\t\tAssert.That(personRefiner.FoundAttributes[nameof(Person.LastName)], Has.Count.EqualTo(1));\n\t\t\tAssert.That(personRefiner.FoundAttributes[nameof(Person.LastName)][0], Is.EqualTo(typeof(MyAttribute2)));\n\t\t});\n\t}\n\n\tprivate class TypeWithSomeNullableOthersNot\n\t{\n\t\t[Nullable(true)]", + "snippet": "TestConsole.WriteLine(JsonSerializer.Serialize(simpleValueSettingsSchema1, TestSerializerContext.Default.JsonSchema));\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(simpleValueSettingsSchema2, TestSerializerContext.De" + }, + { + "title": "src/JsonSchema.Generation.Tests/ClientTests.cs (3/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ClientTests.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ClientTests.cs", + "startLine": 241, + "endLine": 360, + "content": "public string Nullable { get; set; }\n\t\tpublic string NotNullable { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue325_NullableBleedingAcrossMembers()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Nullable\", new JsonSchemaBuilder().Type(SchemaValueType.String | SchemaValueType.Null)),\n\t\t\t\t(\"NotNullable\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tpublic class MyType450\n\t{\n\t\t[Nullable(true)]\n\t\tpublic IEnumerable Items { get; set; }\n\t}\n\n\tpublic class MyItem450\n\t{\n\t\t[Nullable(true)]\n\t\tpublic IEnumerable Items { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue450_StackOverflowFromNestedCollections()\n\t{\n\t\tvar schema = new JsonSchemaBuilder()\n\t\t\t.FromType()\n\t\t\t.Build();\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(schema, TestSerializerContext.Default.JsonSchema));\n\t}\n\n\tprivate class Issue512_Type\n\t{\n\t\tpublic IList Foo { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue512_IListOfJsonNodeThrows()\n\t{\n\t\tvar schema = new JsonSchemaBuilder()\n\t\t\t.FromType()\n\t\t\t.Build();\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(schema, TestSerializerContext.Default.JsonSchema));\n\t}\n\n\tprivate class Type544_ObsoleteProperties\n\t{\n\t\t[Obsolete]\n\t\tpublic int AAA { get; set; }\n\n\t\tpublic int BBB { get; set; }\n\n\t\t[Obsolete(\"CCC is deprecated.\")]\n\t\tpublic int CCC { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue544_DeprecatedSpillingOverToOtherPropertiesOfSameType()\n\t{\n\t\tvar builder = new JsonSchemaBuilder();\n\t\tbuilder.FromType();\n\n\t\tvar schema = builder.Build();\n\t\tTestConsole.WriteLine(schema.Root.Source);\n\n\t\tvar expected = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"AAA\": {\"type\": \"integer\", \"deprecated\": true},\n\t\t\t \"BBB\": {\"type\": \"integer\"},\n\t\t\t \"CCC\": {\"type\": \"integer\", \"deprecated\": true}\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\tAssert.That(expected.IsEquivalentTo(schema.Root.Source));\n\t}\n\n\tprivate class Type551_MinItemsOnString\n\t{\n\t\t[MinItems(1)]\n\t\t[MaxItems(10)]\n\t\tpublic string Value { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue551_MinMaxItemsOnStringProperty()\n\t{\n\t\tvar builder = new JsonSchemaBuilder();\n\t\tbuilder.FromType();\n\n\t\tvar schema = builder.Build();\n\t\tTestConsole.WriteLine(schema.Root.Source);\n\n\t\tvar expected = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"Value\": {\"type\": \"string\"}\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\tAssert.That(expected.IsEquivalentTo(schema.Root.Source));\n\t}", + "snippet": "public string Nullable { get; set; }\n\t\tpublic string NotNullable { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue325_NullableBleedingAcrossMembers()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.D" + }, + { + "title": "src/JsonSchema.Generation.Tests/ClientTests.cs (4/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ClientTests.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ClientTests.cs", + "startLine": 361, + "endLine": 480, + "content": "private class Issue696_NullableDecimalWithMultipleOf\n\t{\n\t\t[Nullable(true)]\n\t\t[MultipleOf(0.1)]\n\t\tpublic decimal? Apr { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue696_MultipleOfMissingForNullableDecimal()\n\t{\n\t\tvar expected = JsonNode.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"Apr\": {\n\t\t\t \"type\": [\"null\", \"number\"],\n\t\t\t \"multipleOf\": 0.1\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\");\n\n\t\tJsonSchema schema = new JsonSchemaBuilder().FromType();\n\t\tvar schemaJson = JsonSerializer.SerializeToNode(schema, TestSerializerContext.Default.JsonSchema);\n\t\tTestConsole.WriteLine(schemaJson);\n\n\t\tAssert.That(schemaJson.IsEquivalentTo(expected), Is.True);\n\t}\n\n\tpublic class Issue767_PropertyLevelComments\n\t{\n\t\tpublic class NestedType\n\t\t{\n\t\t\t/// \n\t\t\t/// Names property on NestedType\n\t\t\t/// \n\t\t\tpublic List Names { get; set; } = [];\n\n\t\t\t/// \n\t\t\t/// Descriptions property on NestedType\n\t\t\t/// \n\t\t\tpublic List Descriptions { get; set; } = [];\n\n\t\t\tpublic class NestedNestedType\n\t\t\t{\n\t\t\t\t/// \n\t\t\t\t/// NestedNames property on NestedNestedType (double-nested)\n\t\t\t\t/// \n\t\t\t\tpublic List NestedNames { get; set; } = [];\n\t\t\t}\n\n\t\t\t/// \n\t\t\t/// NestedNested property on NestedType\n\t\t\t/// \n\t\t\tpublic NestedNestedType NestedNested = new();\n\t\t}\n\n\t\t/// \n\t\t/// Nested property on Issue767_PropertyLevelComments\n\t\t/// \n\t\tpublic NestedType? Nested = new();\n\t}\n\n\t[Test]\n\tpublic void Issue767_PropertyDescriptionFromXmlComments()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Nested\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Object | SchemaValueType.Null)\n\t\t\t\t\t.Description(\"Nested property on Issue767_PropertyLevelComments\")\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"Names\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Ref(\"#/$defs/listOfString\")\n\t\t\t\t\t\t\t.Description(\"Names property on NestedType\")\n\t\t\t\t\t\t),\n\t\t\t\t\t\t(\"Descriptions\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Ref(\"#/$defs/listOfString\")\n\t\t\t\t\t\t\t.Description(\"Descriptions property on NestedType\")\n\t\t\t\t\t\t),\n\t\t\t\t\t\t(\"NestedNested\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t\t\t\t.Description(\"NestedNested property on NestedType\")\n\t\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t\t(\"NestedNames\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t\t\t.Ref(\"#/$defs/listOfString\")\n\t\t\t\t\t\t\t.Description(\"NestedNames property on NestedNestedType (double-nested)\")\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Defs(\n\t\t\t\t(\"listOfString\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar options = new SchemaGeneratorConfiguration();\n\t\toptions.RegisterXmlCommentFile(\"JsonSchema.Net.Generation.Tests.xml\");\n\t\tJsonSchema schema = new JsonSchemaBuilder().FromType(options);\n\n\t\tAssertEqual(expected, schema);\n\t}\n\n\tprivate const string ExternalSchemaUri = \"https://test.json-everything.net/has-external-schema\";\n\tprivate const string GeneratedSchemaUri = \"https://test.json-everything.net/uses-external-schema\";\n\n\t[Id(ExternalSchemaUri)]\n\tinternal class HasExternalSchemaUsingIdAttribute\n\t{\n\t\tpublic int Value { get; set; }\n\t}", + "snippet": "private class Issue696_NullableDecimalWithMultipleOf\n\t{\n\t\t[Nullable(true)]\n\t\t[MultipleOf(0.1)]\n\t\tpublic decimal? Apr { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue696_MultipleOfMissingForNullableDecimal()\n\t{\n\t\tvar expected" + }, + { + "title": "src/JsonSchema.Generation.Tests/ClientTests.cs (5/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ClientTests.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ClientTests.cs", + "startLine": 481, + "endLine": 600, + "content": "[Id(GeneratedSchemaUri)]\n\tinternal class ShouldRefToExternalSchemaUsingIdAttributeWithRequiredKeyword\n\t{\n\t\t// it is this required keyword that prevents the $ref\n\t\tpublic required HasExternalSchemaUsingIdAttribute ShouldRef { get; set; }\n\t}\n\n\t[Id(GeneratedSchemaUri)]\n\tinternal class ShouldRefToExternalSchemaUsingIdAttributeWithRequiredAttribute\n\t{\n\t\t[Required]\n\t\tpublic HasExternalSchemaUsingIdAttribute ShouldRef { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue815_UsingCSharpRequiredKeyword()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder(new BuildOptions { SchemaRegistry = new() })\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Id(GeneratedSchemaUri)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"ShouldRef\", new JsonSchemaBuilder().Ref(ExternalSchemaUri))\n\t\t\t)\n\t\t\t.Required(\"ShouldRef\");\n\n\t\tJsonSchema actual = new JsonSchemaBuilder(new BuildOptions { SchemaRegistry = new() }).FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void Issue815_UsingRequiredAttribute()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Id(GeneratedSchemaUri)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"ShouldRef\", new JsonSchemaBuilder().Ref(ExternalSchemaUri))\n\t\t\t)\n\t\t\t.Required(\"ShouldRef\");\n\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema actual = new JsonSchemaBuilder(buildOptions).FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tinternal class Pizza\n\t{\n\t\t/// \n\t\t/// The size of the pizza.\n\t\t/// \n\t\tpublic PizzaSize Size { get; init; }\n\t}\n\n\t/// \n\t/// All possible sizes for a pizza.\n\t/// \n\tinternal enum PizzaSize\n\t{\n\t\tSmall,\n\t\tMedium,\n\t\tLarge,\n\t}\n\n\t[Test]\n\tpublic void Issue886_CommentedType()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Size\", new JsonSchemaBuilder()\n\t\t\t\t\t.Ref(\"#/$defs/pizzaSizeInClientTests\")\n\t\t\t\t\t.Description(\"The size of the pizza.\")\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Defs(\n\t\t\t\t(\"pizzaSizeInClientTests\", new JsonSchemaBuilder()\n\t\t\t\t\t.Description(\"All possible sizes for a pizza.\")\n\t\t\t\t\t.Enum([\"Small\", \"Medium\", \"Large\"])\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar config = new SchemaGeneratorConfiguration();\n\t\tconfig.RegisterXmlCommentFile(\"JsonSchema.Net.Generation.Tests.xml\");\n\n\t\tJsonSchema schema = new JsonSchemaBuilder().FromType(config);\n\n\t\tAssertEqual(expected, schema);\n\t}\n\n\t[Test]\n\tpublic void Issue906_DataTableSchema()\n\t{\n\t\t_ = new JsonSchemaBuilder().FromType().Build();\n\t}\n\n\tpublic class Issue915_SomeType\n\t{\n\t\tpublic string Foo { get; set; }\n\t}\n\n\tpublic class Issue915_RootType\n\t{\n\t\tpublic Issue915_SomeType Bar { get; set; }\n\t\tpublic Issue915_SomeType Baz { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue915_ExternalRef()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Bar\", new JsonSchemaBuilder()\n\t\t\t\t\t.Ref(\"https://some.domain.com/someType\")\n\t\t\t\t),\n\t\t\t\t(\"Baz\", new JsonSchemaBuilder()", + "snippet": "[Id(GeneratedSchemaUri)]\n\tinternal class ShouldRefToExternalSchemaUsingIdAttributeWithRequiredKeyword\n\t{\n\t\t// it is this required keyword that prevents the $ref\n\t\tpublic required HasExternalSchemaUsingIdAttribute ShouldR" + }, + { + "title": "src/JsonSchema.Generation.Tests/ClientTests.cs (6/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ClientTests.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ClientTests.cs", + "startLine": 601, + "endLine": 720, + "content": ".Ref(\"https://some.domain.com/someType\")\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar genConfig = new SchemaGeneratorConfiguration(); \n\t\tgenConfig.ExternalReferences.Add(typeof(Issue915_SomeType), new Uri(\"https://some.domain.com/someType\"));\n\n\t\tvar schema = new JsonSchemaBuilder().FromType(genConfig);\n\n\t\tAssertEqual(expected, schema);\n\t}\n\n\tclass Issue891_ClassWithMultipleIndexers\n\t{\n\t\tpublic string Foo { get; set; }\n\n\t\tpublic int this[string idx] => 0;\n\n\t\tpublic int this[int idx] => 0;\n\t}\n\n\t[Test]\n\tpublic void Issue891_MultipleIndexers()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Foo\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t);\n\n\n\t\tvar schema = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, schema);\n\t}\n\n#if NET9_0_OR_GREATER\n\t[JsonConverter(typeof(JsonStringEnumConverter))]\n\tpublic enum Issue890_Status\n\t{\n\t\t[JsonStringEnumMemberName(\"active\")]\n\t\tActive,\n\t\t[JsonStringEnumMemberName(\"inactive\")]\n\t\tInactive\n\t}\n\n\tpublic class Issue890_EnumMemberName\n\t{\n\t\tpublic Issue890_Status EnumProp { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue890_SupportEnumMemberName()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"EnumProp\", new JsonSchemaBuilder().Enum(\"active\", \"inactive\"))\n\t\t\t);\n\n\t\tvar schema = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, schema);\n\t}\n#endif\n\n\t[Test]\n\tpublic void Issue977_MultipleUsesOfNullableEnum()\n\t{\n\t\tvar config = new SchemaGeneratorConfiguration\n\t\t{\n\t\t\tPropertyNameResolver = PropertyNameResolvers.CamelCase\n\t\t};\n\n\t\t// report is this throws\n\t\tvar schema = new JsonSchemaBuilder()\n\t\t\t.FromType(config)\n\t\t\t.Build();\n\n\t\tConsole.WriteLine(JsonSerializer.Serialize(schema, TestEnvironment.SerializerOptions));\n\t}\n\n\tpublic record Issue977_RootType\n\t{\n\t\t// Branch A: direct reference\n\t\tpublic Issue977_ConfigTypeA? ConfigA { get; init; }\n\n\t\t// Branch B: indirect reference via collection\n\t\tpublic Issue977_ConfigTypeB? ConfigB { get; init; }\n\t}\n\n\tpublic record Issue977_ConfigTypeA\n\t{\n\t\t// Nullable enum\n\t\tpublic Issue977_SampleEnum? Mode { get; init; }\n\t}\n\n\tpublic record Issue977_ConfigTypeB\n\t{\n\t\t// Same type as ConfigTypeA, but inside an array\n\t\tpublic Issue977_ConfigTypeA[] Items { get; init; } = [];\n\t}\n\n\tpublic enum Issue977_SampleEnum\n\t{\n\t\tFirst = 0,\n\t\tSecond = 1\n\t}\n\n\tpublic class Issue1018_PersonWithJsonRequired\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\t[JsonRequired]\n\t\tpublic int Age { get; set; }\n\t}\n\n\t[Test]\n\tpublic void Issue1018_JsonRequired()", + "snippet": ".Ref(\"https://some.domain.com/someType\")\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar genConfig = new SchemaGeneratorConfiguration(); \n\t\tgenConfig.ExternalReferences.Add(typeof(Issue915_SomeType), new Uri(\"https://some.domain.com/someType\"));\n\n\t\t" + }, + { + "title": "src/JsonSchema.Generation.Tests/ClientTests.cs (7/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ClientTests.cs#L721-L735", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ClientTests.cs", + "startLine": 721, + "endLine": 735, + "content": "{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Name\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"Age\", new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t)\n\t\t\t.Required(\"Age\");\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": "{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Name\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"Age\", new" + }, + { + "title": "src/JsonSchema.Generation.Tests/CommentsTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/CommentsTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/CommentsTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class CommentsTests\n{\n\t/// \n\t/// Type commented model description\n\t/// \n\tprivate class TypeCommentedModel\n\t{\n\t\tpublic int Foo { get; set; }\n\t\tpublic TypeCommentedInnerModel Inner { get; set; }\n\t}\n\n\t/// \n\t/// Type commented inner model description\n\t/// \n\tprivate class TypeCommentedInnerModel\n\t{\n\t\tpublic int Bar { get; set; }\n\t}\n\n\t[Test]\n\tpublic void TypeCommentsAreAdded()\n\t{\n\t\tvar config = new SchemaGeneratorConfiguration();\n\t\tconfig.RegisterXmlCommentFile(\"JsonSchema.Net.Generation.Tests.xml\");\n\n\t\tvar builder = new JsonSchemaBuilder();\n\t\tbuilder.FromType(config);\n\n\t\tvar schema = builder.Build();\n\t\tTestConsole.WriteLine(schema.Root.Source);\n\n\t\tvar expected = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"type\": \"object\",\n\t\t\t \"description\": \"Type commented model description\",\n\t\t\t \"properties\": {\n\t\t\t \"Foo\": {\"type\": \"integer\"},\n\t\t\t \"Inner\": {\n\t\t\t \"type\": \"object\",\n\t\t\t \"description\": \"Type commented inner model description\",\n\t\t\t \"properties\": {\n\t\t\t \"Bar\": {\"type\": \"integer\"}\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\n\t\tAssert.That(expected.IsEquivalentTo(schema.Root.Source));\n\t}\n\n\tprivate class MemberCommentedModel\n\t{\n\t\t/// \n\t\t/// Bar is for counting\n\t\t/// \n\t\tpublic int Bar { get; set; }\n\t}\n\n\t[Test]\n\tpublic void MemberCommentsAreAdded()\n\t{\n\t\tvar config = new SchemaGeneratorConfiguration();\n\t\tconfig.RegisterXmlCommentFile(\"JsonSchema.Net.Generation.Tests.xml\");\n\n\t\tvar builder = new JsonSchemaBuilder();\n\t\tbuilder.FromType(config);\n\n\t\tvar schema = builder.Build();\n\t\tTestConsole.WriteLine(schema.Root.Source);\n\n\t\tvar expected = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"Bar\": {\n\t\t\t \"type\": \"integer\",\n\t\t\t \"description\": \"Bar is for counting\"\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\n\t\tAssert.That(expected.IsEquivalentTo(schema.Root.Source));\n\t}\n\n\t/// \n\t/// Type commented model description\n\t/// \n\tprivate class TypeAndMemberCommentedModel\n\t{\n\t\t/// \n\t\t/// This overrides the type description\n\t\t/// \n\t\tpublic TypeCommentedInnerModel Inner { get; set; }\n\t}\n\n\t[Test]\n\tpublic void MemberCommentOverridesTypeComment()\n\t{\n\t\tvar config = new SchemaGeneratorConfiguration();\n\t\tconfig.RegisterXmlCommentFile(\"JsonSchema.Net.Generation.Tests.xml\");\n\n\t\tvar builder = new JsonSchemaBuilder();\n\t\tbuilder.FromType(config);\n\n\t\tvar schema = builder.Build();\n\t\tTestConsole.WriteLine(schema.Root.Source);\n\n\t\tvar expected = JsonDocument.Parse(", + "snippet": "using System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class CommentsTests\n{\n\t//" + }, + { + "title": "src/JsonSchema.Generation.Tests/CommentsTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/CommentsTests.cs#L121-L196", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/CommentsTests.cs", + "startLine": 121, + "endLine": 196, + "content": "\"\"\"\n\t\t\t{\n\t\t\t \"description\": \"Type commented model description\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"Inner\": {\n\t\t\t \"$ref\": \"#/$defs/typeCommentedInnerModelInCommentsTests\",\n\t\t\t \"description\": \"This overrides the type description\"\n\t\t\t }\n\t\t\t },\n\t\t\t \"$defs\": {\n\t\t\t \"typeCommentedInnerModelInCommentsTests\": {\n\t\t\t \"description\": \"Type commented inner model description\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"Bar\": {\n\t\t\t \"type\": \"integer\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\n\t\tAssert.That(expected.IsEquivalentTo(schema.Root.Source));\n\t}\n\n\t/// \n\t/// Type commented model description\n\t/// \n\tprivate class TypeAndSingleMemberCommentedModel\n\t{\n\t\t/// \n\t\t/// This overrides the type description\n\t\t/// \n\t\tpublic TypeCommentedInnerModel Inner { get; set; }\n\t\tpublic TypeCommentedInnerModel Inner2 { get; set; }\n\t\tpublic TypeCommentedInnerModel Inner3 { get; set; }\n\t}\n\n\t[Test]\n\tpublic void DefinitionContainsTypeCommentAndRefContainsMemberComment()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Description(\"Type commented model description\")\n\t\t\t.Properties(\n\t\t\t\t(\"Inner\", new JsonSchemaBuilder()\n\t\t\t\t\t.Ref(\"#/$defs/typeCommentedInnerModelInCommentsTests\")\n\t\t\t\t\t.Description(\"This overrides the type description\")\n\t\t\t\t),\n\t\t\t\t(\"Inner2\", new JsonSchemaBuilder()\n\t\t\t\t\t.Ref(\"#/$defs/typeCommentedInnerModelInCommentsTests\")\n\t\t\t\t),\n\t\t\t\t(\"Inner3\", new JsonSchemaBuilder()\n\t\t\t\t\t.Ref(\"#/$defs/typeCommentedInnerModelInCommentsTests\")\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Defs(\n\t\t\t\t(\"typeCommentedInnerModelInCommentsTests\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t\t.Description(\"Type commented inner model description\")\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"Bar\", new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar config = new SchemaGeneratorConfiguration();\n\t\tconfig.RegisterXmlCommentFile(\"JsonSchema.Net.Generation.Tests.xml\");\n\n\t\tJsonSchema schema = new JsonSchemaBuilder().FromType(config);\n\n\t\tAssertEqual(expected, schema);\n\t}\n}", + "snippet": "\"\"\"\n\t\t\t{\n\t\t\t \"description\": \"Type commented model description\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"Inner\": {\n\t\t\t \"$ref\": \"#/$defs/typeCommentedInnerModelInCommentsTests\",\n\t\t\t \"description\": \"T" + }, + { + "title": "src/JsonSchema.Generation.Tests/ConditionalTests.cs (1/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ConditionalTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ConditionalTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable UnusedMember.Global\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class ConditionalTests\n{\n\t[If(nameof(Toggle), true, 0)]\n\tpublic class SingleCondition\n\t{\n\t\t[Required]\n\t\tpublic bool Toggle { get; set; }\n\n\t\t[Required(ConditionGroup = 0)]\n\t\tpublic string Required { get; set; }\n\t}\n\n\t[Test]\n\tpublic void SingleConditionGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Type(SchemaValueType.Boolean)),\n\t\t\t\t(\"Required\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Required(\"Toggle\")\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Const(true))\n\t\t\t\t)\n\t\t\t\t.Required(\"Toggle\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder().Required(\"Required\"));\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\t[Test]\n\tpublic void GenerationHonorsNamingMethod()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"toggle\", new JsonSchemaBuilder().Type(SchemaValueType.Boolean)),\n\t\t\t\t(\"required\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Required(\"toggle\")\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"toggle\", new JsonSchemaBuilder().Const(true))\n\t\t\t\t)\n\t\t\t\t.Required(\"toggle\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder().Required(\"required\"));\n\n\t\tVerifyGeneration(expected, new SchemaGeneratorConfiguration\n\t\t{\n\t\t\tPropertyNameResolver = PropertyNameResolvers.CamelCase\n\t\t});\n\t}\n\n\n\t[Test]\n\tpublic void SingleConditionStrictGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Type(SchemaValueType.Boolean))\n\t\t\t)\n\t\t\t.Required(\"Toggle\")\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Const(true))\n\t\t\t\t)\n\t\t\t\t.Required(\"Toggle\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"Required\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t\t)\n\t\t\t\t.Required(\"Required\")\n\t\t\t)\n\t\t\t.UnevaluatedProperties(false);\n\n\t\tVerifyGeneration(expected, new SchemaGeneratorConfiguration { StrictConditionals = true });\n\t}\n\n\n\t[If(nameof(Toggle), true, \"ifToggle\")]\n\t[If(nameof(OtherToggle), 42, \"ifOtherToggle\")]\n\tpublic class MultipleConditionGroups\n\t{\n\t\t[Required]\n\t\tpublic bool Toggle { get; set; }\n\t\t[Required]\n\t\tpublic int OtherToggle { get; set; }\n\n\t\t// if (toggle == true || otherToggle == 42)\n\t\t[Required(ConditionGroup = \"ifToggle\")]\n\t\t[Required(ConditionGroup = \"ifOtherToggle\")]\n\t\tpublic string Required { get; set; }\n\n\t\t// if (otherToggle == 42)\n\t\t[Required(ConditionGroup = \"ifOtherToggle\")]\n\t\tpublic string OtherRequired { get; set; }\n\t}\n\n\t[Test]\n\tpublic void MultipleConditionGroupsGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)", + "snippet": "using System;\nusing System.Collections.Generic;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable UnusedMember.Global\n// ReSharper disable ClassNeverInstantiated." + }, + { + "title": "src/JsonSchema.Generation.Tests/ConditionalTests.cs (2/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ConditionalTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ConditionalTests.cs", + "startLine": 121, + "endLine": 240, + "content": ".Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Type(SchemaValueType.Boolean)),\n\t\t\t\t(\"OtherToggle\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"Required\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"OtherRequired\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Required(\"Toggle\", \"OtherToggle\")\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Const(true))\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.Required(\"Toggle\")\n\t\t\t\t\t)\n\t\t\t\t\t.Then(new JsonSchemaBuilder().Required(\"Required\")),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"OtherToggle\", new JsonSchemaBuilder().Const(42))\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.Required(\"OtherToggle\")\n\t\t\t\t\t)\n\t\t\t\t\t.Then(new JsonSchemaBuilder().Required(\"Required\", \"OtherRequired\"))\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\t[If(nameof(Toggle), true, 0)]\n\t[If(nameof(OtherToggle), 42, 0)]\n\tpublic class MultipleConditionsInTheSameGroup\n\t{\n\t\t[Required]\n\t\tpublic bool Toggle { get; set; }\n\t\t[Required]\n\t\tpublic int OtherToggle { get; set; }\n\n\t\t// if (toggle == true && otherToggle == 42)\n\t\t[Required(ConditionGroup = 0)]\n\t\tpublic string Required { get; set; }\n\t}\n\n\t[Test]\n\tpublic void MultipleConditionsInTheSameGroupGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Type(SchemaValueType.Boolean)),\n\t\t\t\t(\"OtherToggle\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"Required\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Required(\"Toggle\", \"OtherToggle\")\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Const(true)),\n\t\t\t\t\t(\"OtherToggle\", new JsonSchemaBuilder().Const(42))\n\t\t\t\t)\n\t\t\t\t.Required(\"Toggle\", \"OtherToggle\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder().Required(\"Required\"));\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\t[If(nameof(Toggle), true, 0)]\n\tpublic class SingleConditionMultipleProperties\n\t{\n\t\t[Required]\n\t\tpublic bool Toggle { get; set; }\n\n\t\t// if (toggle == true)\n\t\t[Required(ConditionGroup = 0)]\n\t\tpublic string Required { get; set; }\n\n\t\t// if (toggle == true)\n\t\t[Required(ConditionGroup = 0)]\n\t\tpublic string OtherRequired { get; set; }\n\t}\n\n\t[Test]\n\tpublic void SingleConditionMultiplePropertiesGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Type(SchemaValueType.Boolean)),\n\t\t\t\t(\"Required\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"OtherRequired\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Required(\"Toggle\")\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Const(true))\n\t\t\t\t)\n\t\t\t\t.Required(\"Toggle\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder().Required(\"Required\", \"OtherRequired\"));\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\t[IfEnum(nameof(Day))] // generates group for each value\n\tpublic class EnumSwitch\n\t{\n\t\t[Required]\n\t\tpublic DayOfWeek Day { get; set; }\n\n\t\t// if (day == Monday)\n\t\t[Required(ConditionGroup = DayOfWeek.Monday)]\n\t\tpublic string Required { get; set; }\n\n\t\t// if (toggle == Tuesday)\n\t\t[Required(ConditionGroup = DayOfWeek.Tuesday)]\n\t\tpublic string OtherRequired { get; set; }\n\t}", + "snippet": ".Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Type(SchemaValueType.Boolean)),\n\t\t\t\t(\"OtherToggle\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"Required\", new JsonSc" + }, + { + "title": "src/JsonSchema.Generation.Tests/ConditionalTests.cs (3/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ConditionalTests.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ConditionalTests.cs", + "startLine": 241, + "endLine": 360, + "content": "[Test]\n\tpublic void EnumSwitchGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Day\", new JsonSchemaBuilder()\n\t\t\t\t\t.Enum(\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\")\n\t\t\t\t),\n\t\t\t\t(\"Required\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"OtherRequired\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Required(\"Day\")\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"Day\", new JsonSchemaBuilder().Const(\"Monday\"))\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.Required(\"Day\")\n\t\t\t\t\t)\n\t\t\t\t\t.Then(new JsonSchemaBuilder().Required(\"Required\")),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"Day\", new JsonSchemaBuilder().Const(\"Tuesday\"))\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.Required(\"Day\")\n\t\t\t\t\t)\n\t\t\t\t\t.Then(new JsonSchemaBuilder().Required(\"OtherRequired\"))\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\t[If(nameof(Value), \"unused\", 0)]\n\tpublic class UnusedConditionGroup\n\t{\n\t\tpublic string Value { get; set; }\n\t}\n\n\t[Test]\n\tpublic void UnusedGroupIsIgnored()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Value\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\tpublic class UnknownConditionGroup\n\t{\n\t\t[Required(ConditionGroup = \"unknown\")]\n\t\tpublic string Value { get; set; }\n\t}\n\n\t[Test]\n\tpublic void UnknownGroupIsIgnored()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Value\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\t[If(nameof(AgeCategory), \"child\", \"isChild\")]\n\t[If(nameof(AgeCategory), \"adult\", \"isAdult\")]\n\t[If(nameof(AgeCategory), \"senior\", \"isSenior\")]\n\tpublic class SplitAgeRanges\n\t{\n\t\t[Required]\n\t\tpublic string Name { get; set; }\n\n\t\t[Required]\n\t\tpublic string AgeCategory { get; set; }\n\n\t\t[Required]\n\t\t[Minimum(0, ConditionGroup = \"isChild\")]\n\t\t[Maximum(17, ConditionGroup = \"isChild\")]\n\t\t[Minimum(18, ConditionGroup = \"isAdult\")]\n\t\t[Maximum(64, ConditionGroup = \"isAdult\")]\n\t\t[Minimum(65, ConditionGroup = \"isSenior\")]\n\t\tpublic int Age { get; set; }\n\n\t\t[Required]\n\t\t[Const(false, ConditionGroup = \"isChild\")]\n\t\t[Const(true, ConditionGroup = \"isAdult\")]\n\t\t[Const(true, ConditionGroup = \"isSenior\")]\n\t\tpublic bool CanVote { get; set; }\n\t}\n\n\t[Test]\n\tpublic void SplitAgeRangesGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Name\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"AgeCategory\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"Age\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"CanVote\", new JsonSchemaBuilder().Type(SchemaValueType.Boolean))\n\t\t\t)\n\t\t\t.Required(\"Name\", \"AgeCategory\", \"Age\", \"CanVote\")\n\t\t\t.AllOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"AgeCategory\", new JsonSchemaBuilder().Const(\"child\"))\n\t\t\t\t\t\t)", + "snippet": "[Test]\n\tpublic void EnumSwitchGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Day\", new JsonSchemaBuilder()\n\t\t\t" + }, + { + "title": "src/JsonSchema.Generation.Tests/ConditionalTests.cs (4/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ConditionalTests.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ConditionalTests.cs", + "startLine": 361, + "endLine": 480, + "content": ".Required(\"AgeCategory\")\n\t\t\t\t\t)\n\t\t\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t\t\t\t.Minimum(0)\n\t\t\t\t\t\t\t\t.Maximum(17)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t(\"CanVote\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t\t\t\t\t\t.Const(false)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"AgeCategory\", new JsonSchemaBuilder().Const(\"adult\"))\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.Required(\"AgeCategory\")\n\t\t\t\t\t)\n\t\t\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t\t\t\t.Minimum(18)\n\t\t\t\t\t\t\t\t.Maximum(64)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t(\"CanVote\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t\t\t\t\t\t.Const(true)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"AgeCategory\", new JsonSchemaBuilder().Const(\"senior\"))\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.Required(\"AgeCategory\")\n\t\t\t\t\t)\n\t\t\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t\t\t\t.Minimum(65)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t(\"CanVote\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t\t\t\t\t\t.Const(true)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\t[IfMin(nameof(Value), 10, \"group\")]\n\t[IfMax(nameof(Value), 20, \"group\", IsExclusive = true)]\n\tpublic class NumberRangeConditions\n\t{\n\t\t[Required]\n\t\tpublic int Value { get; set; }\n\n\t\t[Required(ConditionGroup = \"group\")]\n\t\tpublic string Required { get; set; }\n\t}\n\n\t[Test]\n\tpublic void NumberRangeConditionsGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Value\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"Required\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Required(\"Value\")\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"Value\", new JsonSchemaBuilder()\n\t\t\t\t\t\t.Minimum(10)\n\t\t\t\t\t\t.ExclusiveMaximum(20)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.Required(\"Value\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t.Required(\"Required\")\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\t[IfMin(nameof(Value), 10, \"group\")]\n\t[IfMax(nameof(Value), 20, \"group\")]\n\tpublic class StringLengthRangeConditions\n\t{\n\t\t[Required]\n\t\tpublic string Value { get; set; }\n\n\t\t[Required(ConditionGroup = \"group\")]\n\t\tpublic string Required { get; set; }\n\t}\n\n\t[Test]\n\tpublic void StringLengthRangeConditionsGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Value\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"Required\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Required(\"Value\")\n\t\t\t.If(new JsonSchemaBuilder()", + "snippet": ".Required(\"AgeCategory\")\n\t\t\t\t\t)\n\t\t\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Properties(\n\t\t\t\t\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t\t\t\t.Minimum(0)\n\t\t\t\t\t\t\t\t.Maximum(17)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t" + }, + { + "title": "src/JsonSchema.Generation.Tests/ConditionalTests.cs (5/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ConditionalTests.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ConditionalTests.cs", + "startLine": 481, + "endLine": 600, + "content": ".Properties(\n\t\t\t\t\t(\"Value\", new JsonSchemaBuilder()\n\t\t\t\t\t\t.MinLength(10)\n\t\t\t\t\t\t.MaxLength(20)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.Required(\"Value\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t.Required(\"Required\")\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\t[IfMin(nameof(Value), 10, \"group\")]\n\t[IfMax(nameof(Value), 20, \"group\")]\n\tpublic class ArrayLengthRangeConditions\n\t{\n\t\t[Required]\n\t\tpublic int[] Value { get; set; }\n\n\t\t[Required(ConditionGroup = \"group\")]\n\t\tpublic string Required { get; set; }\n\t}\n\n\t[Test]\n\tpublic void ArrayLengthRangeConditionsGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Value\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t\t),\n\t\t\t\t(\"Required\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Required(\"Value\")\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"Value\", new JsonSchemaBuilder()\n\t\t\t\t\t\t.MinItems(10)\n\t\t\t\t\t\t.MaxItems(20)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.Required(\"Value\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t.Required(\"Required\")\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\t[IfMin(nameof(Value), 10, \"group\")]\n\t[IfMax(nameof(Value), 20, \"group\")]\n\tpublic class DictionaryLengthRangeConditions\n\t{\n\t\t[Required]\n\t\tpublic Dictionary Value { get; set; }\n\n\t\t[Required(ConditionGroup = \"group\")]\n\t\tpublic string Required { get; set; }\n\t}\n\n\t[Test]\n\tpublic void DictionaryLengthRangeConditionsGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Value\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t\t.AdditionalProperties(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t\t),\n\t\t\t\t(\"Required\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Required(\"Value\")\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"Value\", new JsonSchemaBuilder()\n\t\t\t\t\t\t.MinProperties(10)\n\t\t\t\t\t\t.MaxProperties(20)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.Required(\"Value\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t.Required(\"Required\")\n\t\t\t);\n\n\t\tVerifyGeneration(expected);\n\t}\n\n\n\tpublic static class SecretLevels\n\t{\n\t\tpublic const string VerySecret = \"verySecret\";\n\t\tpublic const string Secret = \"secret\";\n\t\tpublic const string NotSecret = \"notSecret\";\n\t}\n\n\t[If(nameof(SecretLevel), SecretLevels.NotSecret, nameof(Age))]\n\t[If(nameof(SecretLevel), SecretLevels.Secret, nameof(Age))]\n\tpublic class Author\n\t{\n\t\t[Required]\n\t\tpublic string Name { get; set; }\n\n\t\t[Required(ConditionGroup = nameof(Age))]\n\t\t[Nullable(true)]\n\t\tpublic string? Age { get; set; }\n\n\t\t[Required]\n\t\tpublic string SecretLevel { get; set; }\n\t}", + "snippet": ".Properties(\n\t\t\t\t\t(\"Value\", new JsonSchemaBuilder()\n\t\t\t\t\t\t.MinLength(10)\n\t\t\t\t\t\t.MaxLength(20)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.Required(\"Value\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t.Required(\"Required\")\n\t\t\t);\n\n\t\tVerifyGeneration<" + }, + { + "title": "src/JsonSchema.Generation.Tests/ConditionalTests.cs (6/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ConditionalTests.cs#L601-L631", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ConditionalTests.cs", + "startLine": 601, + "endLine": 631, + "content": "[Test]\n\tpublic void MultipleIfsSamePropertyAndSameConditionGroup()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"name\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"age\", new JsonSchemaBuilder().Type(SchemaValueType.String | SchemaValueType.Null)),\n\t\t\t\t(\"secretLevel\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Required(\"name\", \"secretLevel\")\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"secretLevel\", new JsonSchemaBuilder()\n\t\t\t\t\t\t.Enum(\"notSecret\", \"secret\")\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.Required(\"secretLevel\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t.Required(\"age\")\n\t\t\t);\n\n\t\tvar config = new SchemaGeneratorConfiguration\n\t\t{\n\t\t\tPropertyNameResolver = PropertyNameResolvers.CamelCase\n\t\t};\n\n\t\tVerifyGeneration(expected, config);\n\t}\n}", + "snippet": "[Test]\n\tpublic void MultipleIfsSamePropertyAndSameConditionGroup()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"name\", new JsonSchemaBuilder().Type(SchemaValue" + }, + { + "title": "src/JsonSchema.Generation.Tests/ExternalReferenceTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ExternalReferenceTests.cs#L1-L103", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ExternalReferenceTests.cs", + "startLine": 1, + "endLine": 103, + "content": "using NUnit.Framework;\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class ExternalReferenceTests\n{\n\tprivate const string ExternalSchemaUri = \"https://test.json-everything.net/has-external-schema\";\n\tprivate const string GeneratedSchemaUri = \"https://test.json-everything.net/uses-external-schema\";\n\n\tinternal class HasExternalSchema\n\t{\n\t\tpublic int Value { get; set; }\n\t}\n\n\tinternal class ShouldRefToExternalSchema\n\t{\n\t\tpublic HasExternalSchema ShouldRef { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GeneratesRefForExternalReference()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"ShouldRef\", new JsonSchemaBuilder().Ref(ExternalSchemaUri))\n\t\t\t);\n\n\t\tvar config = new SchemaGeneratorConfiguration\n\t\t{\n\t\t\tExternalReferences =\n\t\t\t{\n\t\t\t\t[typeof(HasExternalSchema)] = new(ExternalSchemaUri)\n\t\t\t}\n\t\t};\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType(config);\n\n\t\tAssertionExtensions.AssertEqual(expected, actual);\n\t}\n\n\tinternal class RefWithAttributes\n\t{\n\t\t[Required]\n\t\t[Title(\"this one has attributes\")]\n\t\tpublic HasExternalSchema ShouldRef { get; set; }\n\t}\n\n\n\t[Test]\n\tpublic void GeneratesRefForExternalReferenceWithAttributes()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"ShouldRef\", new JsonSchemaBuilder()\n\t\t\t\t\t.Ref(ExternalSchemaUri)\n\t\t\t\t\t.Title(\"this one has attributes\")\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Required(\"ShouldRef\");\n\n\t\tvar config = new SchemaGeneratorConfiguration\n\t\t{\n\t\t\tExternalReferences =\n\t\t\t{\n\t\t\t\t[typeof(HasExternalSchema)] = new(ExternalSchemaUri)\n\t\t\t}\n\t\t};\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType(config);\n\n\t\tAssertionExtensions.AssertEqual(expected, actual);\n\t}\n\n\t[Id(ExternalSchemaUri)]\n\tinternal class HasExternalSchemaUsingIdAttribute\n\t{\n\t\tpublic int Value { get; set; }\n\t}\n\n\t[Id(GeneratedSchemaUri)]\n\tinternal class ShouldRefToExternalSchemaUsingIdAttribute\n\t{\n\t\tpublic HasExternalSchemaUsingIdAttribute ShouldRef { get; set; }\n\t}\n\n\t[Test]\n\tpublic void GeneratesRefForExternalReferenceUsingIdAttribute()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder(new BuildOptions { SchemaRegistry = new() })\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Id(GeneratedSchemaUri)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"ShouldRef\", new JsonSchemaBuilder().Ref(ExternalSchemaUri))\n\t\t\t);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder(new BuildOptions{SchemaRegistry = new()}).FromType();\n\n\t\tAssertionExtensions.AssertEqual(expected, actual);\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class ExternalReferenceTests\n{\n\tprivate const string ExternalSchemaUri = \"https://test.json-everything.net/has-external-schema\";\n\tprivate const stri" + }, + { + "title": "src/JsonSchema.Generation.Tests/GeneratorTests.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/GeneratorTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/GeneratorTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing Json.Pointer;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class GeneratorTests\n{\n\t[Test]\n\tpublic void ArraySchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType>().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void BooleanSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void DateTimeSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.DateTime)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void EnumDictionarySchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.PropertyNames(new JsonSchemaBuilder().Enum(Enum.GetNames(typeof(DayOfWeek))))\n\t\t\t.AdditionalProperties(new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType>().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void EnumSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Enum(Enum.GetNames(typeof(DayOfWeek)))\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void GuidSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Uuid)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void IntegerSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void JsonPointerSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.JsonPointer)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);", + "snippet": "using System;\nusing System.Collections.Generic;\nusing Json.Pointer;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json" + }, + { + "title": "src/JsonSchema.Generation.Tests/GeneratorTests.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/GeneratorTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/GeneratorTests.cs", + "startLine": 121, + "endLine": 240, + "content": "}\n\n\t[Test]\n\tpublic void NumberSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void StringSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void UriSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Uri)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void NullableBooleanSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void NullableDateTimeSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.DateTime)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void NullableEnumSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Enum(Enum.GetNames(typeof(DayOfWeek)))\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void NullableGuidSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Format(Formats.Uuid)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void NullableIntegerSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\n\t[Test]\n\tpublic void NullableNumberSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType().Build();", + "snippet": "}\n\n\t[Test]\n\tpublic void NumberSchema()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType MemberCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(typeof(ReferenceMember), String);\n\t\t\tyield return new TestCaseData(typeof(ReferenceMemberWithNull), String | Null);\n\t\t\tyield return new TestCaseData(typeof(ReferenceMemberWithNotNull), String);\n\t\t\tyield return new TestCaseData(typeof(ReferenceMemberNullable), String | Null);\n\t\t\tyield return new TestCaseData(typeof(ReferenceMemberNullableWithNull), String | Null);\n\t\t\tyield return new TestCaseData(typeof(ReferenceMemberNullableWithNotNull), String);\n\n\t\t\tyield return new TestCaseData(typeof(ValueTypeMember), Integer);\n\t\t\tyield return new TestCaseData(typeof(ValueTypeMemberWithNull), Integer | Null);\n\t\t\tyield return new TestCaseData(typeof(ValueTypeMemberWithNotNull), Integer);\n\t\t\tyield return new TestCaseData(typeof(ValueTypeMemberNullable), Integer | Null);\n\t\t\tyield return new TestCaseData(typeof(ValueTypeMemberNullableWithNull), Integer | Null);\n\t\t\tyield return new TestCaseData(typeof(ValueTypeMemberNullableWithNotNull), Integer);\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(MemberCases))]\n\tpublic void MemberNullability(Type type, SchemaValueType valueType)\n\t{\n\t\tvar builder = new JsonSchemaBuilder();\n\t\tbuilder.FromType(type);\n\n\t\tvar schema = builder.Build();\n\t\tTestConsole.WriteLine(schema.Root.Source);", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReS" + }, + { + "title": "src/JsonSchema.Generation.Tests/NullabilityTests.cs (2/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/NullabilityTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/NullabilityTests.cs", + "startLine": 121, + "endLine": 240, + "content": "var typeValue = valueType switch\n\t\t{\n\t\t\tSchemaValueType.String => \"\\\"string\\\"\",\n\t\t\tSchemaValueType.Integer => \"\\\"integer\\\"\",\n\t\t\tSchemaValueType.String | SchemaValueType.Null => \"[\\\"null\\\", \\\"string\\\"]\",\n\t\t\tSchemaValueType.Integer | SchemaValueType.Null => \"[\\\"null\\\", \\\"integer\\\"]\",\n\t\t\t_ => throw new ArgumentOutOfRangeException(nameof(valueType))\n\t\t};\n\n\t\tvar expected = JsonDocument.Parse(\n\t\t\t$$\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"Property\": {\"type\": {{typeValue}}}\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\n\t\tAssert.That(expected.IsEquivalentTo(schema.Root.Source));\n\t}\n\n\tpublic class EnumMember\n\t{\n\t\tpublic DayOfWeek Property { get; set; }\n\t}\n\n\tpublic class EnumMemberNullable\n\t{\n\t\tpublic DayOfWeek? Property { get; set; }\n\t}\n\n\tpublic class EnumMemberWithNull\n\t{\n\t\t[Nullable(true)]\n\t\tpublic DayOfWeek Property { get; set; }\n\t}\n\n\tpublic class EnumMemberNullableWithNull\n\t{\n\t\t[Nullable(true)]\n\t\tpublic DayOfWeek? Property { get; set; }\n\t}\n\n\tpublic class EnumMemberWithNotNull\n\t{\n\t\t[Nullable(false)]\n\t\tpublic DayOfWeek Property { get; set; }\n\t}\n\n\tpublic class EnumMemberNullableWithNotNull\n\t{\n\t\t[Nullable(false)]\n\t\tpublic DayOfWeek? Property { get; set; }\n\t}\n\n\tpublic static IEnumerable EnumMemberCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(typeof(EnumMember), false);\n\t\t\tyield return new TestCaseData(typeof(EnumMemberWithNull), true);\n\t\t\tyield return new TestCaseData(typeof(EnumMemberWithNotNull), false);\n\t\t\tyield return new TestCaseData(typeof(EnumMemberNullable), true);\n\t\t\tyield return new TestCaseData(typeof(EnumMemberNullableWithNull), true);\n\t\t\tyield return new TestCaseData(typeof(EnumMemberNullableWithNotNull), false);\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(EnumMemberCases))]\n\tpublic void EnumMemberNullability(Type type, bool containsNull)\n\t{\n\t\tvar builder = new JsonSchemaBuilder();\n\t\tbuilder.FromType(type);\n\n\t\tvar schema = builder.Build();\n\t\tTestConsole.WriteLine(schema.Root.Source);\n\n\t\tvar enumValues = string.Join(\", \", Enum.GetNames(typeof(DayOfWeek)).Select(v => $\"\\\"{v}\\\"\"));\n\t\tif (containsNull)\n\t\t\tenumValues += \", null\";\n\n\t\tvar expected = JsonDocument.Parse(\n\t\t\t$$\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"Property\": {\"enum\": [{{enumValues}}]}\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\n\t\tAssert.That(expected.IsEquivalentTo(schema.Root.Source));\n\t}\n\n\tpublic static IEnumerable TypeCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(typeof(string), String);\n\t\t\tyield return new TestCaseData(typeof(int?), Integer);\n\t\t\tyield return new TestCaseData(typeof(int), Integer);\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(TypeCases))]\n\tpublic void TypeNullability(Type type, SchemaValueType valueType)\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(valueType)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder()\n\t\t\t.FromType(type)\n\t\t\t.Build();\n\n\t\tAssertEqual(expected, actual);", + "snippet": "var typeValue = valueType switch\n\t\t{\n\t\t\tSchemaValueType.String => \"\\\"string\\\"\",\n\t\t\tSchemaValueType.Integer => \"\\\"integer\\\"\",\n\t\t\tSchemaValueType.String | SchemaValueType.Null => \"[\\\"null\\\", \\\"string\\\"]\",\n\t\t\tSchemaValueTyp" + }, + { + "title": "src/JsonSchema.Generation.Tests/NullabilityTests.cs (3/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/NullabilityTests.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/NullabilityTests.cs", + "startLine": 241, + "endLine": 360, + "content": "}\n\n\tpublic static IEnumerable EnumTypeCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(typeof(DayOfWeek), false);\n\t\t\tyield return new TestCaseData(typeof(DayOfWeek?), false);\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(EnumTypeCases))]\n\tpublic void EnumTypeNullability(Type type, bool containsNull)\n\t{\n\t\tvar values = Enum.GetNames(typeof(DayOfWeek)).ToList();\n\t\tif (containsNull)\n\t\t\tvalues.Add(null!);\n\n\t\tvar expected = new JsonSchemaBuilder()\n\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Enum(values)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder()\n\t\t\t.FromType(type)\n\t\t\t.Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class DifferingNullabilityValueType\n\t{\n\t\tpublic int NonNullable { get; set; }\n\t\tpublic int? Nullable { get; set; }\n\t}\n\n\t[Test]\n\tpublic void NullableIntAndNonNullableInt()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"NonNullable\", new JsonSchemaBuilder().Type(Integer)),\n\t\t\t\t(\"Nullable\", new JsonSchemaBuilder().Type(Integer | Null))\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder()\n\t\t\t.FromType()\n\t\t\t.Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class DifferingNullabilityValueTypeUsingAttribute\n\t{\n\t\tpublic int NonNullable { get; set; }\n\t\t[Nullable(true)]\n\t\tpublic int Nullable { get; set; }\n\t}\n\n\t[Test]\n\tpublic void NullableIntAndNonNullableIntUsingAttribute()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"NonNullable\", new JsonSchemaBuilder().Type(Integer)),\n\t\t\t\t(\"Nullable\", new JsonSchemaBuilder().Type(Integer | Null))\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder()\n\t\t\t.FromType()\n\t\t\t.Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class DifferingNullabilityReferenceType\n\t{\n\t\tpublic string NonNullable { get; set; }\n\t\t[Nullable(true)]\n\t\tpublic string Nullable { get; set; }\n\t\tpublic string? AlsoNullable { get; set; }\n\t\t[Nullable(false)]\n\t\tpublic string? OverriddenNotNullable { get; set; }\n\t}\n\n\t[Test]\n\tpublic void NullableStringAndNonNullableString()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"NonNullable\", new JsonSchemaBuilder().Type(String)),\n\t\t\t\t(\"Nullable\", new JsonSchemaBuilder().Type(String | Null)),\n\t\t\t\t(\"AlsoNullable\", new JsonSchemaBuilder().Type(String | Null)),\n\t\t\t\t(\"OverriddenNotNullable\", new JsonSchemaBuilder().Type(String))\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder()\n\t\t\t.FromType()\n\t\t\t.Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class NullableDateTime\n\t{\n\t\tpublic DateTime? Property { get; set; }\n\t}\n\n\t[Test]\n\tpublic void NullableStruct()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)", + "snippet": "}\n\n\tpublic static IEnumerable EnumTypeCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(typeof(DayOfWeek), false);\n\t\t\tyield return new TestCaseData(typeof(DayOfWeek?), false);\n\t\t}\n\t}\n\n\t[TestCaseSource(nam" + }, + { + "title": "src/JsonSchema.Generation.Tests/NullabilityTests.cs (4/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/NullabilityTests.cs#L361-L402", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/NullabilityTests.cs", + "startLine": 361, + "endLine": 402, + "content": ".Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Property\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String | SchemaValueType.Null)\n\t\t\t\t\t.Format(Formats.DateTime)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder()\n\t\t\t.FromType()\n\t\t\t.Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class NullableDateTimeWithDescription\n\t{\n\t\t[Description(\"description\")]\n\t\tpublic DateTime? Property { get; set; }\n\t}\n\n\t[Test]\n\tpublic void NullableStructWithAnotherAttribute()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Property\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String | SchemaValueType.Null)\n\t\t\t\t\t.Format(Formats.DateTime)\n\t\t\t\t\t.Description(\"description\")\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder()\n\t\t\t.FromType()\n\t\t\t.Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": ".Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Property\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String | SchemaValueType.Null)\n\t\t\t\t\t.Format(Formats.DateTime)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBu" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Debug/net10.0/JsonSchema.Generation.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Debug/net10.0/JsonSchema.Generation.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Debug/net10.0/JsonSchema.Generation.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Debug/net8.0/JsonSchema.Generation.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Debug/net8.0/JsonSchema.Generation.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Debug/net8.0/JsonSchema.Generation.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Debug/net9.0/JsonSchema.Generation.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Debug/net9.0/JsonSchema.Generation.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Debug/net9.0/JsonSchema.Generation.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_Serialization.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_Serialization.g.cs#L1-L62", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_Serialization.g.cs", + "startLine": 1, + "endLine": 62, + "content": "// \n#nullable enable\n\nusing System.Diagnostics.CodeAnalysis;\nusing System.Runtime.CompilerServices;\nusing System.Text.Json.Serialization;\nusing Json.Schema;\nusing Json.Schema.Serialization;\n\nnamespace Json.Schema.Generation.Tests.Serialization;\n\n/// \n/// Contains generated JSON schemas for types decorated with [GenerateJsonSchema].\n/// \npublic static partial class GeneratedJsonSchemas\n{\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema.\n\t/// \n\tpublic static readonly JsonSchema DeserializationTests_FooWithSchema =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Bar\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null)\n\t\t\t.MinLength(5)),\n\t\t\t(\"Value\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Minimum(40m)\n\t\t\t)\n\t\t)\n\t\t.Required(\"Value\")\n\t\t.Build();\n\n\n\t/// \n\t/// Registers all generated schemas in the specified schema registry.\n\t/// \n\tpublic static void RegisterSchemas(Json.Schema.SchemaRegistry registry)\n\t{\n\t\tregistry.Register(DeserializationTests_FooWithSchema);\n\t}\n}\n\n/// \n/// Registers generated schemas with the ValidatingJsonConverter for AOT scenarios.\n/// \n[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"Suppressing for generated code.\")]\ninternal static class GeneratedSchemaRegistration\n{\n\t[ModuleInitializer]\n\tinternal static void RegisterSchemas()\n\t{\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.DeserializationTests_FooWithSchema,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t}\n}", + "snippet": "// \n#nullable enable\n\nusing System.Diagnostics.CodeAnalysis;\nusing System.Runtime.CompilerServices;\nusing System.Text.Json.Serialization;\nusing Json.Schema;\nusing Json.Schema.Serialization;\n\nnamespace Js" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs (1/8)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n#nullable enable\n\nusing System.Diagnostics.CodeAnalysis;\nusing System.Runtime.CompilerServices;\nusing System.Text.Json.Serialization;\nusing Json.Schema;\nusing Json.Schema.Serialization;\n\nnamespace Json.Schema.Generation.Tests.SourceGeneration;\n\n/// \n/// Extension methods for custom schema attributes.\n/// \npublic static class GeneratedSchemaExtensions\n{\n\tpublic static JsonSchemaBuilder PositiveNumber(this JsonSchemaBuilder builder)\n\t{\n\t\treturn global::Json.Schema.Generation.Tests.SourceGeneration.PositiveNumberAttribute.Apply(builder);\n\t}\n\n\tpublic static JsonSchemaBuilder Range(this JsonSchemaBuilder builder, decimal min, decimal max)\n\t{\n\t\treturn global::Json.Schema.Generation.Tests.SourceGeneration.RangeAttribute.Apply(builder, min, max);\n\t}\n\n}\n\n/// \n/// Contains generated JSON schemas for types decorated with [GenerateJsonSchema].\n/// \npublic static partial class GeneratedJsonSchemas\n{\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson.\n\t/// \n\tpublic static readonly JsonSchema TestModels_SimplePerson =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer))\n\t\t)\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson.\n\t/// \n\tpublic static readonly JsonSchema TestModels_CamelCasePerson =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"firstName\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"lastName\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer))\n\t\t)\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable.\n\t/// \n\tpublic static readonly JsonSchema TestModels_PersonWithNullable =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"Email\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null)),\n\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer, SchemaValueType.Null))\n\t\t)\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired.\n\t/// \n\tpublic static readonly JsonSchema TestModels_PersonWithRequired =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer))\n\t\t)\n\t\t.Required(\"Name\")\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum.\n\t/// \n\tpublic static readonly JsonSchema TestModels_PersonWithEnum =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"Status\", new JsonSchemaBuilder()\n\t\t\t.Enum(\"Active\", \"Inactive\", \"Pending\"))\n\t\t)\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription.\n\t/// \n\tpublic static readonly JsonSchema TestModels_PersonWithDescription =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription\")\n\t\t.Type(SchemaValueType.Object)", + "snippet": "// \n#nullable enable\n\nusing System.Diagnostics.CodeAnalysis;\nusing System.Runtime.CompilerServices;\nusing System.Text.Json.Serialization;\nusing Json.Schema;\nusing Json.Schema.Serialization;\n\nnamespace Js" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs (2/8)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs", + "startLine": 121, + "endLine": 240, + "content": ".Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Description(\"The person's full name\")),\n\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Description(\"The person's age in years\"))\n\t\t)\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes.\n\t/// \n\tpublic static readonly JsonSchema TestModels_ProductWithCustomAttributes =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"Price\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.PositiveNumber()),\n\t\t\t(\"DiscountPercentage\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Range(0m, 100m)),\n\t\t\t(\"Description\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null))\n\t\t)\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses.\n\t/// \n\tpublic static readonly JsonSchema TestModels_PersonWithAddresses =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"HomeAddress\", new JsonSchemaBuilder()\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder().Ref(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address\"),\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Null)\n\t\t\t)\n\t\t\t.Description(\"Home address\")),\n\t\t\t(\"WorkAddress\", new JsonSchemaBuilder()\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder().Ref(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address\"),\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Null)\n\t\t\t)\n\t\t\t.Description(\"Work address\"))\n\t\t)\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition.\n\t/// \n\tpublic static readonly JsonSchema TestModels_SingleCondition =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Toggle\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t),\n\t\t\t(\"Required\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null))\n\t\t)\n\t\t.Required(\"Toggle\")\n\t\t.If(new JsonSchemaBuilder()\n\t\t\t.Properties(\n\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Const(true))\n\t\t\t)\n\t\t\t.Required(\"Toggle\")\n\t\t)\n\t\t.Then(new JsonSchemaBuilder()\n\t\t\t.Required(\"Required\")\n\t\t)\n\t\t\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase.\n\t/// \n\tpublic static readonly JsonSchema TestModels_SingleConditionCamelCase =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"toggle\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t),\n\t\t\t(\"required\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null))\n\t\t)\n\t\t.Required(\"toggle\")\n\t\t.If(new JsonSchemaBuilder()\n\t\t\t.Properties(\n\t\t\t\t(\"toggle\", new JsonSchemaBuilder().Const(true))\n\t\t\t)\n\t\t\t.Required(\"toggle\")\n\t\t)\n\t\t.Then(new JsonSchemaBuilder()\n\t\t\t.Required(\"required\")\n\t\t)\n\t\t\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups.\n\t/// \n\tpublic static readonly JsonSchema TestModels_MultipleConditionGroups =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Toggle\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Boolean)", + "snippet": ".Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Description(\"The person's full name\")),\n\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Description(\"The pers" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs (3/8)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs", + "startLine": 241, + "endLine": 360, + "content": "),\n\t\t\t(\"OtherToggle\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t),\n\t\t\t(\"RequiredIfToggle\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null)),\n\t\t\t(\"RequiredIfOtherToggle\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null))\n\t\t)\n\t\t.Required(\"Toggle\", \"OtherToggle\")\n\t\t.AllOf(\n\t\t\tnew JsonSchemaBuilder()\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"Toggle\", new JsonSchemaBuilder().Const(true))\n\t\t\t\t)\n\t\t\t\t.Required(\"Toggle\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t.Required(\"RequiredIfToggle\")\n\t\t\t),\n\t\t\tnew JsonSchemaBuilder()\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"OtherToggle\", new JsonSchemaBuilder().Const(42))\n\t\t\t\t)\n\t\t\t\t.Required(\"OtherToggle\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t.Required(\"RequiredIfOtherToggle\")\n\t\t\t)\n\t\t)\n\t\t\n\t\t\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup.\n\t/// \n\tpublic static readonly JsonSchema TestModels_MultipleTriggersInSameGroup =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Count\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t),\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t),\n\t\t\t(\"SpecialField\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null))\n\t\t)\n\t\t.Required(\"Count\", \"Name\")\n\t\t.If(new JsonSchemaBuilder()\n\t\t\t.Properties(\n\t\t\t\t(\"Count\", new JsonSchemaBuilder().Const(1)),\n\t\t\t\t(\"Name\", new JsonSchemaBuilder().Const(\"special\"))\n\t\t\t)\n\t\t\t.Required(\"Count\", \"Name\")\n\t\t)\n\t\t.Then(new JsonSchemaBuilder()\n\t\t\t.Required(\"SpecialField\")\n\t\t)\n\t\t\n\t\t\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum.\n\t/// \n\tpublic static readonly JsonSchema TestModels_ConditionalWithMinimum =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t),\n\t\t\t(\"AdultField\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null))\n\t\t)\n\t\t.Required(\"Age\")\n\t\t.If(new JsonSchemaBuilder()\n\t\t\t.Properties(\n\t\t\t\t(\"Age\", new JsonSchemaBuilder().Minimum(18))\n\t\t\t)\n\t\t\t.Required(\"Age\")\n\t\t)\n\t\t.Then(new JsonSchemaBuilder()\n\t\t\t.Required(\"AdultField\")\n\t\t)\n\t\t\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum.\n\t/// \n\tpublic static readonly JsonSchema TestModels_ConditionalWithMaximum =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Score\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t),\n\t\t\t(\"BonusEligible\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null))\n\t\t)\n\t\t.Required(\"Score\")\n\t\t.If(new JsonSchemaBuilder()\n\t\t\t.Properties(\n\t\t\t\t(\"Score\", new JsonSchemaBuilder().Maximum(100))\n\t\t\t)\n\t\t\t.Required(\"Score\")\n\t\t)\n\t\t.Then(new JsonSchemaBuilder()\n\t\t\t.Required(\"BonusEligible\")\n\t\t)", + "snippet": "),\n\t\t\t(\"OtherToggle\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t),\n\t\t\t(\"RequiredIfToggle\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null)),\n\t\t\t(\"RequiredIfOtherToggle\", " + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs (4/8)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs", + "startLine": 361, + "endLine": 480, + "content": ".Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch.\n\t/// \n\tpublic static readonly JsonSchema TestModels_EnumSwitch =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Day\", new JsonSchemaBuilder()\n\t\t\t.Enum(\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\")\n\t\t\t),\n\t\t\t(\"MondayField\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null)),\n\t\t\t(\"TuesdayField\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null))\n\t\t)\n\t\t.Required(\"Day\")\n\t\t.AllOf(\n\t\t\tnew JsonSchemaBuilder()\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"Day\", new JsonSchemaBuilder().Const(\"Monday\"))\n\t\t\t\t)\n\t\t\t\t.Required(\"Day\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t.Required(\"MondayField\")\n\t\t\t),\n\t\t\tnew JsonSchemaBuilder()\n\t\t\t.If(new JsonSchemaBuilder()\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"Day\", new JsonSchemaBuilder().Const(\"Tuesday\"))\n\t\t\t\t)\n\t\t\t\t.Required(\"Day\")\n\t\t\t)\n\t\t\t.Then(new JsonSchemaBuilder()\n\t\t\t\t.Required(\"TuesdayField\")\n\t\t\t)\n\t\t)\n\t\t\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation.\n\t/// \n\tpublic static readonly JsonSchema TestModels_ConditionalValidation =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"IsActive\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t),\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null)),\n\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer, SchemaValueType.Null))\n\t\t)\n\t\t.Required(\"IsActive\")\n\t\t.If(new JsonSchemaBuilder()\n\t\t\t.Properties(\n\t\t\t\t(\"IsActive\", new JsonSchemaBuilder().Const(true))\n\t\t\t)\n\t\t\t.Required(\"IsActive\")\n\t\t)\n\t\t.Then(new JsonSchemaBuilder()\n\t\t\t.Properties(\n\t\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t\t\t.MinLength(5)\n\t\t\t\t\t.MaxLength(100)),\n\t\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t\t\t.Minimum(0m)\n\t\t\t\t\t.Maximum(150m))\n\t\t\t)\n\t\t)\n\t\t\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithSortedProperties.\n\t/// \n\tpublic static readonly JsonSchema TestModels_PersonWithSortedProperties =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithSortedProperties\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)),\n\t\t\t(\"City\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"Email\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String))\n\t\t)\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithIdReference.\n\t/// \n\tpublic static readonly JsonSchema TestModels_PersonWithIdReference =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithIdReference\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"Person\", new JsonSchemaBuilder()\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder().Ref(\"https://json-everything.test/schemas/person\"),\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Null)\n\t\t\t))\n\t\t)\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithJsonRequired.\n\t/// ", + "snippet": ".Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch.\n\t/// \n\tpublic static readonly JsonSchema TestModels_EnumSwitch =\n\t\tnew JsonSchema" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs (5/8)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs", + "startLine": 481, + "endLine": 600, + "content": "public static readonly JsonSchema TestModels_PersonWithJsonRequired =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithJsonRequired\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer))\n\t\t)\n\t\t.Required(\"Age\")\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDefaults.\n\t/// \n\tpublic static readonly JsonSchema TestModels_PersonWithDefaults =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDefaults\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Default(\"anonymous\")),\n\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Default(0)),\n\t\t\t(\"IsActive\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t.Default(true))\n\t\t)\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNoAdditionalProperties.\n\t/// \n\tpublic static readonly JsonSchema TestModels_PersonWithNoAdditionalProperties =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNoAdditionalProperties\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer))\n\t\t)\n\t\t\n\t\t.AdditionalProperties(false).Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithMultipleClosedGenerics.\n\t/// \n\tpublic static readonly JsonSchema TestModels_ModelWithMultipleClosedGenerics =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithMultipleClosedGenerics\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"IntHolder\", new JsonSchemaBuilder()\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder().Ref(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder\"),\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Null)\n\t\t\t)),\n\t\t\t(\"StringHolder\", new JsonSchemaBuilder()\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder().Ref(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder\"),\n\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Null)\n\t\t\t))\n\t\t)\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.StrictConditionalValidation.\n\t/// \n\tpublic static readonly JsonSchema TestModels_StrictConditionalValidation =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.StrictConditionalValidation\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"IsActive\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Boolean)\n\t\t\t)\n\t\t)\n\t\t.Required(\"IsActive\")\n\t\t.If(new JsonSchemaBuilder()\n\t\t\t.Properties(\n\t\t\t\t(\"IsActive\", new JsonSchemaBuilder().Const(true))\n\t\t\t)\n\t\t\t.Required(\"IsActive\")\n\t\t)\n\t\t.Then(new JsonSchemaBuilder()\n\t\t\t.Properties(\n\t\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null)\n\t\t\t\t\t.MinLength(5)\n\t\t\t\t\t.MaxLength(100)),\n\t\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer, SchemaValueType.Null)\n\t\t\t\t\t.Minimum(0m)\n\t\t\t\t\t.Maximum(150m))\n\t\t\t)\n\t\t)\n\t\t.UnevaluatedProperties(false)\n\t\t\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SourceGenTarget.\n\t/// \n\tpublic static readonly JsonSchema TestModels_SourceGenTarget =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SourceGenTarget\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"_value\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)),\n\t\t\t(\"EnumProp\", new JsonSchemaBuilder()\n\t\t\t.Enum(\"DontIgnoreThis\", \"DontIgnoreThisWhenWritingDefault\", \"DontIgnoreThisWhenWritingNull\")),\n\t\t\t(\"Integer\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)", + "snippet": "public static readonly JsonSchema TestModels_PersonWithJsonRequired =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithJsonRequired\")\n\t\t.Type(SchemaValueType.Obj" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs (6/8)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs", + "startLine": 601, + "endLine": 720, + "content": ".Minimum(5m)\n\t\t\t.ExclusiveMinimum(4m)\n\t\t\t.Maximum(10m)\n\t\t\t.ExclusiveMaximum(11m)\n\t\t\t.MultipleOf(1.5m)),\n\t\t\t(\"String\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.MaxLength(10)\n\t\t\t.Pattern(\"^[a-z0-9_]$\")),\n\t\t\t(\"RequiredString\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t),\n\t\t\t(\"rename-this-required-string\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t),\n\t\t\t(\"ListOfBool\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Boolean))\n\t\t\t.MinItems(5)\n\t\t\t.MaxItems(10)),\n\t\t\t(\"ListOfString\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t.MinLength(5))\n\t\t\t.UniqueItems(true)\n\t\t\t.Deprecated(true)),\n\t\t\t(\"Duplicated1\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Maximum(100m)),\n\t\t\t(\"Duplicated2\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t.Maximum(100m)),\n\t\t\t(\"Target\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)),\n\t\t\t(\"DontIgnoreThis\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"DontIgnoreThisWhenWritingDefault\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"DontIgnoreThisWhenWritingNull\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"rename-this\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"StrictNumber\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Number)),\n\t\t\t(\"OtherStrictNumber\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Number)),\n\t\t\t(\"ReadOnlyNumber\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.ReadOnly(true)),\n\t\t\t(\"WriteOnlyNumber\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.WriteOnly(true)),\n\t\t\t(\"StringyNumber\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Number, SchemaValueType.String)),\n\t\t\t(\"NotANumber\", new JsonSchemaBuilder()\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Number),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Enum(\"NaN\", \"Infinity\", \"-Infinity\")\n\t\t\t)),\n\t\t\t(\"StringyNotANumber\", new JsonSchemaBuilder()\n\t\t\t.AnyOf(\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Number, SchemaValueType.String),\n\t\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t\t.Enum(\"NaN\", \"Infinity\", \"-Infinity\")\n\t\t\t)),\n\t\t\t(\"Metadata\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Title(\"title\")\n\t\t\t.Description(\"description\"))\n\t\t)\n\t\t.Required(\"Integer\", \"RequiredString\", \"rename-this-required-string\")\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address.\n\t/// \n\tpublic static readonly JsonSchema TestModels_Address =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Street\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"City\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"PostalCode\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String))\n\t\t).Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithId.\n\t/// \n\tpublic static readonly JsonSchema TestModels_PersonWithId =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"https://json-everything.test/schemas/person\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Name\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)),\n\t\t\t(\"Age\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer))\n\t\t)\n\t\t.Build();\n\n\t/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder<int>.\n\t/// \n\tpublic static readonly JsonSchema TestModels_GenericHolder_Int32 =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Value\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Integer))\n\t\t).Build();", + "snippet": ".Minimum(5m)\n\t\t\t.ExclusiveMinimum(4m)\n\t\t\t.Maximum(10m)\n\t\t\t.ExclusiveMaximum(11m)\n\t\t\t.MultipleOf(1.5m)),\n\t\t\t(\"String\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.MaxLength(10)\n\t\t\t.Pattern(\"^[a-z0-9_]$\"))" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs (7/8)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs#L721-L840", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs", + "startLine": 721, + "endLine": 840, + "content": "/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder<string>.\n\t/// \n\tpublic static readonly JsonSchema TestModels_GenericHolder_String =\n\t\tnew JsonSchemaBuilder()\n\t\t.Id(\"global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder\")\n\t\t.Type(SchemaValueType.Object)\n\t\t.Properties(\n\t\t\t(\"Value\", new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.String))\n\t\t).Build();\n\n\n\t/// \n\t/// Registers all generated schemas in the specified schema registry.\n\t/// \n\tpublic static void RegisterSchemas(Json.Schema.SchemaRegistry registry)\n\t{\n\t\tregistry.Register(TestModels_SimplePerson);\n\t\tregistry.Register(TestModels_CamelCasePerson);\n\t\tregistry.Register(TestModels_PersonWithNullable);\n\t\tregistry.Register(TestModels_PersonWithRequired);\n\t\tregistry.Register(TestModels_PersonWithEnum);\n\t\tregistry.Register(TestModels_PersonWithDescription);\n\t\tregistry.Register(TestModels_ProductWithCustomAttributes);\n\t\tregistry.Register(TestModels_PersonWithAddresses);\n\t\tregistry.Register(TestModels_SingleCondition);\n\t\tregistry.Register(TestModels_SingleConditionCamelCase);\n\t\tregistry.Register(TestModels_MultipleConditionGroups);\n\t\tregistry.Register(TestModels_MultipleTriggersInSameGroup);\n\t\tregistry.Register(TestModels_ConditionalWithMinimum);\n\t\tregistry.Register(TestModels_ConditionalWithMaximum);\n\t\tregistry.Register(TestModels_EnumSwitch);\n\t\tregistry.Register(TestModels_ConditionalValidation);\n\t\tregistry.Register(TestModels_PersonWithSortedProperties);\n\t\tregistry.Register(TestModels_PersonWithIdReference);\n\t\tregistry.Register(TestModels_PersonWithJsonRequired);\n\t\tregistry.Register(TestModels_PersonWithDefaults);\n\t\tregistry.Register(TestModels_PersonWithNoAdditionalProperties);\n\t\tregistry.Register(TestModels_ModelWithMultipleClosedGenerics);\n\t\tregistry.Register(TestModels_StrictConditionalValidation);\n\t\tregistry.Register(TestModels_SourceGenTarget);\n\t\tregistry.Register(TestModels_Address);\n\t\tregistry.Register(TestModels_PersonWithId);\n\t\tregistry.Register(TestModels_GenericHolder_Int32);\n\t\tregistry.Register(TestModels_GenericHolder_String);\n\t}\n}\n\n/// \n/// Registers generated schemas with the ValidatingJsonConverter for AOT scenarios.\n/// \n[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"Suppressing for generated code.\")]\ninternal static class GeneratedSchemaRegistration\n{\n\t[ModuleInitializer]\n\tinternal static void RegisterSchemas()\n\t{\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_SimplePerson,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_CamelCasePerson,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_PersonWithNullable,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_PersonWithRequired,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_PersonWithEnum,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_PersonWithDescription,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_ProductWithCustomAttributes,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_PersonWithAddresses,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_SingleCondition,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_SingleConditionCamelCase,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_MultipleConditionGroups,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_MultipleTriggersInSameGroup,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(", + "snippet": "/// \n\t/// Generated schema for global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder<string>.\n\t/// \n\tpublic static readonly JsonSchema TestModels_GenericHolder_String =\n\t" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs (8/8)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs#L841-L922", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/JsonSchema.Net.Generation/Json.Schema.Generation.SourceGeneration.JsonSchemaSourceGenerator/Json_Schema_Generation_Tests_SourceGeneration.g.cs", + "startLine": 841, + "endLine": 922, + "content": "typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_ConditionalWithMinimum,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_ConditionalWithMaximum,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_EnumSwitch,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_ConditionalValidation,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithSortedProperties),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_PersonWithSortedProperties,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithId),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_PersonWithId,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithIdReference),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_PersonWithIdReference,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithJsonRequired),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_PersonWithJsonRequired,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDefaults),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_PersonWithDefaults,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNoAdditionalProperties),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_PersonWithNoAdditionalProperties,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithMultipleClosedGenerics),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_ModelWithMultipleClosedGenerics,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.StrictConditionalValidation),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_StrictConditionalValidation,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SourceGenTarget),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_SourceGenTarget,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address),\n\t\t\tnew ValidatingJsonConverter(\n\t\t\t\tGeneratedJsonSchemas.TestModels_Address,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder),\n\t\t\tnew ValidatingJsonConverter>(\n\t\t\t\tGeneratedJsonSchemas.TestModels_GenericHolder_Int32,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t\tValidatingJsonConverter.RegisterConverter(\n\t\t\ttypeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder),\n\t\t\tnew ValidatingJsonConverter>(\n\t\t\t\tGeneratedJsonSchemas.TestModels_GenericHolder_String,\n\t\t\t\tValidatingJsonConverter.DefaultOptionsFactory));\n\t}\n}", + "snippet": "typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum),\n\t\t\tnew ValidatingJsonConverter(\n\t\t" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Address.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Address.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Address.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Address;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Address\n #nullable enable annotations\n {\n get => _Address ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Address(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => AddressPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = AddressSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] AddressPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address)obj).Street,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address)obj).Street = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Street\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address).GetProperty(\"Street\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n properties[0].IsGetNullable = false;\n properties[0].IsSetNullable = false;\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address)obj).City,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address)obj).City = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"City\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address).GetProperty(\"City\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n properties[1].IsGetNullable = false;\n properties[1].IsSetNullable = false;\n\n var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address)obj).PostalCode,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address)obj).PostalCode = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"PostalCode\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address).GetProperty(\"PostalCode\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info2);\n properties[2].IsGetNullable = false;\n properties[2].IsSetNullable = false;\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Address.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Address.g.cs#L121-L140", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Address.g.cs", + "startLine": 121, + "endLine": 140, + "content": "// methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void AddressSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Street, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address)value).Street);\n writer.WriteString(PropName_City, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address)value).City);\n writer.WriteString(PropName_PostalCode, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address)value).PostalCode);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void AddressSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Boolean.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Boolean.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Boolean.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Boolean;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Boolean\n #nullable enable annotations\n {\n get => _Boolean ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(bool));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Boolean(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.BooleanConverter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.CamelCasePerson.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.CamelCasePerson.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.CamelCasePerson.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _CamelCasePerson;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo CamelCasePerson\n #nullable enable annotations\n {\n get => _CamelCasePerson ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_CamelCasePerson(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => CamelCasePersonPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = CamelCasePersonSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] CamelCasePersonPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson)obj).FirstName,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson)obj).FirstName = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"FirstName\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson).GetProperty(\"FirstName\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n properties[0].IsGetNullable = false;\n properties[0].IsSetNullable = false;\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson)obj).LastName,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson)obj).LastName = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"LastName\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson).GetProperty(\"LastName\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n properties[1].IsGetNullable = false;\n properties[1].IsSetNullable = false;\n\n var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson)obj).Age,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson)obj).Age = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Age\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson).GetProperty(\"Age\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info2);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void CamelCasePersonSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson? value)", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.CamelCasePerson.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.CamelCasePerson.g.cs#L121-L138", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.CamelCasePerson.g.cs", + "startLine": 121, + "endLine": 138, + "content": "{\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_FirstName, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson)value).FirstName);\n writer.WriteString(PropName_LastName, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson)value).LastName);\n writer.WriteNumber(PropName_Age, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson)value).Age);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "{\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_F" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ConditionalValidation.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ConditionalValidation.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ConditionalValidation.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _ConditionalValidation;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ConditionalValidation\n #nullable enable annotations\n {\n get => _ConditionalValidation ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_ConditionalValidation(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => ConditionalValidationPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = ConditionalValidationSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] ConditionalValidationPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation)obj).IsActive,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation)obj).IsActive = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"IsActive\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation).GetProperty(\"IsActive\", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation)obj).Name,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation)obj).Name = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Name\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation).GetProperty(\"Name\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation)obj).Age,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation)obj).Age = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Age\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation).GetProperty(\"Age\", InstanceMemberBindingFlags, null, typeof(int?), global::System.Array.Empty(), null),\n };\n \n properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info2);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void ConditionalValidationSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ConditionalValidation.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ConditionalValidation.g.cs#L121-L135", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ConditionalValidation.g.cs", + "startLine": 121, + "endLine": 135, + "content": "return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteBoolean(PropName_IsActive, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation)value).IsActive);\n writer.WriteString(PropName_Name, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation)value).Name);\n writer.WritePropertyName(PropName_Age);\n global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation)value).Age, NullableInt32);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteBoolean(PropName_IsActive, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation)value" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ConditionalWithMaximum.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ConditionalWithMaximum.g.cs#L1-L113", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ConditionalWithMaximum.g.cs", + "startLine": 1, + "endLine": 113, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _ConditionalWithMaximum;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ConditionalWithMaximum\n #nullable enable annotations\n {\n get => _ConditionalWithMaximum ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_ConditionalWithMaximum(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => ConditionalWithMaximumPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = ConditionalWithMaximumSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] ConditionalWithMaximumPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum)obj).Score,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum)obj).Score = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Score\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum).GetProperty(\"Score\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum)obj).BonusEligible,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum)obj).BonusEligible = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"BonusEligible\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum).GetProperty(\"BonusEligible\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void ConditionalWithMaximumSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteNumber(PropName_Score, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum)value).Score);\n writer.WriteString(PropName_BonusEligible, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum)value).BonusEligible);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ConditionalWithMinimum.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ConditionalWithMinimum.g.cs#L1-L113", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ConditionalWithMinimum.g.cs", + "startLine": 1, + "endLine": 113, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _ConditionalWithMinimum;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ConditionalWithMinimum\n #nullable enable annotations\n {\n get => _ConditionalWithMinimum ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_ConditionalWithMinimum(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => ConditionalWithMinimumPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = ConditionalWithMinimumSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] ConditionalWithMinimumPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum)obj).Age,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum)obj).Age = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Age\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum).GetProperty(\"Age\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum)obj).AdultField,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum)obj).AdultField = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"AdultField\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum).GetProperty(\"AdultField\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void ConditionalWithMinimumSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteNumber(PropName_Age, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum)value).Age);\n writer.WriteString(PropName_AdultField, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum)value).AdultField);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.DayOfWeek.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.DayOfWeek.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.DayOfWeek.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _DayOfWeek;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo DayOfWeek\n #nullable enable annotations\n {\n get => _DayOfWeek ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::System.DayOfWeek));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_DayOfWeek(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.GetEnumConverter(options));\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Decimal.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Decimal.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Decimal.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Decimal;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Decimal\n #nullable enable annotations\n {\n get => _Decimal ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(decimal));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Decimal(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.DecimalConverter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.EnumSwitch.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.EnumSwitch.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.EnumSwitch.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _EnumSwitch;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo EnumSwitch\n #nullable enable annotations\n {\n get => _EnumSwitch ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_EnumSwitch(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => EnumSwitchPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = EnumSwitchSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] EnumSwitchPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch)obj).Day,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch)obj).Day = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Day\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch).GetProperty(\"Day\", InstanceMemberBindingFlags, null, typeof(global::System.DayOfWeek), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch)obj).MondayField,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch)obj).MondayField = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"MondayField\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch).GetProperty(\"MondayField\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch)obj).TuesdayField,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch)obj).TuesdayField = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"TuesdayField\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch).GetProperty(\"TuesdayField\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info2);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void EnumSwitchSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.EnumSwitch.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.EnumSwitch.g.cs#L121-L135", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.EnumSwitch.g.cs", + "startLine": 121, + "endLine": 135, + "content": "return;\n }\n \n writer.WriteStartObject();\n\n writer.WritePropertyName(PropName_Day);\n global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch)value).Day, DayOfWeek);\n writer.WriteString(PropName_MondayField, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch)value).MondayField);\n writer.WriteString(PropName_TuesdayField, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch)value).TuesdayField);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "return;\n }\n \n writer.WriteStartObject();\n\n writer.WritePropertyName(PropName_Day);\n global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::Json.Schema.G" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.EnumTest.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.EnumTest.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.EnumTest.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _EnumTest;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo EnumTest\n #nullable enable annotations\n {\n get => _EnumTest ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.ArrayGenerationTests.EnumTest));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_EnumTest(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.GetEnumConverter(options));\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.EvaluationResults.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.EvaluationResults.g.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.EvaluationResults.g.cs", + "startLine": 1, + "endLine": 38, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _EvaluationResults;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo EvaluationResults\n #nullable enable annotations\n {\n get => _EvaluationResults ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.EvaluationResults));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_EvaluationResults(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n global::System.Text.Json.Serialization.JsonConverter converter = ExpandConverter(typeof(global::Json.Schema.EvaluationResults), new global::Json.Schema.EvaluationResultsJsonConverter(), options);\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo (options, converter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Foo.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Foo.g.cs#L1-L113", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Foo.g.cs", + "startLine": 1, + "endLine": 113, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Foo;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Foo\n #nullable enable annotations\n {\n get => _Foo ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Foo(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => FooPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = FooSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] FooPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo)obj).Bar,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo)obj).Bar = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Bar\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo).GetProperty(\"Bar\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo)obj).Value,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo)obj).Value = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Value\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo).GetProperty(\"Value\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void FooSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Bar, ((global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo)value).Bar);\n writer.WriteNumber(PropName_Value, ((global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo)value).Value);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.FooWithSchema.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.FooWithSchema.g.cs#L1-L113", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.FooWithSchema.g.cs", + "startLine": 1, + "endLine": 113, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _FooWithSchema;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo FooWithSchema\n #nullable enable annotations\n {\n get => _FooWithSchema ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_FooWithSchema(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => FooWithSchemaPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = FooWithSchemaSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] FooWithSchemaPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema)obj).Bar,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema)obj).Bar = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Bar\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema).GetProperty(\"Bar\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema)obj).Value,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema)obj).Value = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Value\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema).GetProperty(\"Value\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void FooWithSchemaSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Bar, ((global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema)value).Bar);\n writer.WriteNumber(PropName_Value, ((global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema)value).Value);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.g.cs#L1-L88", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.g.cs", + "startLine": 1, + "endLine": 88, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Text.Json.SourceGeneration\", \"10.0.14.15411\")]\n public partial class TestSerializerContext\n {\n private readonly static global::System.Text.Json.JsonSerializerOptions s_defaultOptions = new();\n \n private const global::System.Reflection.BindingFlags InstanceMemberBindingFlags =\n global::System.Reflection.BindingFlags.Instance |\n global::System.Reflection.BindingFlags.Public |\n global::System.Reflection.BindingFlags.NonPublic;\n \n /// \n /// The default associated with a default instance.\n /// \n public static global::Json.Schema.Generation.Tests.TestSerializerContext Default { get; } = new global::Json.Schema.Generation.Tests.TestSerializerContext(new global::System.Text.Json.JsonSerializerOptions(s_defaultOptions));\n \n /// \n /// The source-generated options associated with this context.\n /// \n protected override global::System.Text.Json.JsonSerializerOptions? GeneratedSerializerOptions { get; } = s_defaultOptions;\n \n /// \n public TestSerializerContext() : base(null)\n {\n }\n \n /// \n public TestSerializerContext(global::System.Text.Json.JsonSerializerOptions options) : base(options)\n {\n }\n\n private static bool TryGetTypeInfoForRuntimeCustomConverter(global::System.Text.Json.JsonSerializerOptions options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo)\n {\n global::System.Text.Json.Serialization.JsonConverter? converter = GetRuntimeConverterForType(typeof(TJsonMetadataType), options);\n if (converter != null)\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, converter);\n return true;\n }\n \n jsonTypeInfo = null;\n return false;\n }\n \n private static global::System.Text.Json.Serialization.JsonConverter? GetRuntimeConverterForType(global::System.Type type, global::System.Text.Json.JsonSerializerOptions options)\n {\n for (int i = 0; i < options.Converters.Count; i++)\n {\n global::System.Text.Json.Serialization.JsonConverter? converter = options.Converters[i];\n if (converter?.CanConvert(type) == true)\n {\n return ExpandConverter(type, converter, options, validateCanConvert: false);\n }\n }\n \n return null;\n }\n \n private static global::System.Text.Json.Serialization.JsonConverter ExpandConverter(global::System.Type type, global::System.Text.Json.Serialization.JsonConverter converter, global::System.Text.Json.JsonSerializerOptions options, bool validateCanConvert = true)\n {\n if (validateCanConvert && !converter.CanConvert(type))\n {\n throw new global::System.InvalidOperationException(string.Format(\"The converter '{0}' is not compatible with the type '{1}'.\", converter.GetType(), type));\n }\n \n if (converter is global::System.Text.Json.Serialization.JsonConverterFactory factory)\n {\n converter = factory.CreateConverter(type, options);\n if (converter is null || converter is global::System.Text.Json.Serialization.JsonConverterFactory)\n {\n throw new global::System.InvalidOperationException(string.Format(\"The converter '{0}' cannot return null or a JsonConverterFactory instance.\", factory.GetType()));\n }\n }\n \n return converter;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.GetJsonTypeInfo.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.GetJsonTypeInfo.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.GetJsonTypeInfo.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext : global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver\n {\n /// \n public override global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo(global::System.Type type)\n {\n Options.TryGetTypeInfo(type, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? typeInfo);\n return typeInfo;\n }\n\n global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver.GetTypeInfo(global::System.Type type, global::System.Text.Json.JsonSerializerOptions options)\n {\n if (type == typeof(bool))\n {\n return Create_Boolean(options);\n }\n if (type == typeof(decimal))\n {\n return Create_Decimal(options);\n }\n if (type == typeof(global::Json.Schema.EvaluationResults))\n {\n return Create_EvaluationResults(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.ArrayGenerationTests.EnumTest))\n {\n return Create_EnumTest(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue890_Status))\n {\n return Create_Issue890_Status(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA))\n {\n return Create_Issue977_ConfigTypeA(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA[]))\n {\n return Create_Issue977_ConfigTypeAArray(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeB))\n {\n return Create_Issue977_ConfigTypeB(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType))\n {\n return Create_Issue977_RootType(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_SampleEnum))\n {\n return Create_Issue977_SampleEnum(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_SampleEnum?))\n {\n return Create_NullableIssue977_SampleEnum(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.Foo))\n {\n return Create_Foo(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.Serialization.DeserializationTests.FooWithSchema))\n {\n return Create_FooWithSchema(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address))\n {\n return Create_Address(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson))\n {\n return Create_CamelCasePerson(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation))\n {\n return Create_ConditionalValidation(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum))\n {\n return Create_ConditionalWithMaximum(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum))\n {\n return Create_ConditionalWithMinimum(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch))\n {\n return Create_EnumSwitch(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups))\n {\n return Create_MultipleConditionGroups(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup))\n {\n return Create_MultipleTriggersInSameGroup(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses))\n {\n return Create_PersonWithAddresses(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription))\n {\n return Create_PersonWithDescription(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum))\n {\n return Create_PersonWithEnum(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable))\n {\n return Create_PersonWithNullable(options);", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.GetJsonTypeInfo.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.GetJsonTypeInfo.g.cs#L121-L174", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.GetJsonTypeInfo.g.cs", + "startLine": 121, + "endLine": 174, + "content": "}\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired))\n {\n return Create_PersonWithRequired(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes))\n {\n return Create_ProductWithCustomAttributes(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson))\n {\n return Create_SimplePerson(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition))\n {\n return Create_SingleCondition(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase))\n {\n return Create_SingleConditionCamelCase(options);\n }\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Status))\n {\n return Create_Status(options);\n }\n if (type == typeof(global::Json.Schema.JsonSchema))\n {\n return Create_JsonSchema(options);\n }\n if (type == typeof(global::System.DayOfWeek))\n {\n return Create_DayOfWeek(options);\n }\n if (type == typeof(global::System.Drawing.Point))\n {\n return Create_Point(options);\n }\n if (type == typeof(int))\n {\n return Create_Int32(options);\n }\n if (type == typeof(int?))\n {\n return Create_NullableInt32(options);\n }\n if (type == typeof(string))\n {\n return Create_String(options);\n }\n return null;\n }\n }\n}", + "snippet": "}\n if (type == typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired))\n {\n return Create_PersonWithRequired(options);\n }\n if" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Int32.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Int32.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Int32.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Int32;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Int32\n #nullable enable annotations\n {\n get => _Int32 ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(int));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Int32(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.Int32Converter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue890_Status.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue890_Status.g.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue890_Status.g.cs", + "startLine": 1, + "endLine": 38, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Issue890_Status;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Issue890_Status\n #nullable enable annotations\n {\n get => _Issue890_Status ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue890_Status));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Issue890_Status(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n global::System.Text.Json.Serialization.JsonConverter converter = ExpandConverter(typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue890_Status), new global::System.Text.Json.Serialization.JsonStringEnumConverter(), options);\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo (options, converter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_ConfigTypeA.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_ConfigTypeA.g.cs#L1-L105", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_ConfigTypeA.g.cs", + "startLine": 1, + "endLine": 105, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Issue977_ConfigTypeA;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Issue977_ConfigTypeA\n #nullable enable annotations\n {\n get => _Issue977_ConfigTypeA ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Issue977_ConfigTypeA(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = null,\n ObjectWithParameterizedConstructorCreator = static args => new global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA(){ Mode = (global::Json.Schema.Generation.Tests.ClientTests.Issue977_SampleEnum?)args[0] },\n PropertyMetadataInitializer = _ => Issue977_ConfigTypeAPropInit(options),\n ConstructorParameterMetadataInitializer = Issue977_ConfigTypeACtorParamInit,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = Issue977_ConfigTypeASerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] Issue977_ConfigTypeAPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[1];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA)obj).Mode,\n Setter = static (obj, value) => throw new global::System.InvalidOperationException(\"Setting init-only properties is not supported in source generation mode.\"),\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Mode\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA).GetProperty(\"Mode\", InstanceMemberBindingFlags, null, typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_SampleEnum?), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void Issue977_ConfigTypeASerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WritePropertyName(PropName_Mode);\n global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA)value).Mode, NullableIssue977_SampleEnum);\n\n writer.WriteEndObject();\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] Issue977_ConfigTypeACtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]\n {\n new()\n {\n Name = \"Mode\",\n ParameterType = typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_SampleEnum?),\n Position = 0,\n IsNullable = true,\n IsMemberInitializer = true,\n },\n };\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_ConfigTypeAArray.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_ConfigTypeAArray.g.cs#L1-L64", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_ConfigTypeAArray.g.cs", + "startLine": 1, + "endLine": 64, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Issue977_ConfigTypeAArray;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Issue977_ConfigTypeAArray\n #nullable enable annotations\n {\n get => _Issue977_ConfigTypeAArray ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA[]));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Issue977_ConfigTypeAArray(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var info = new global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues\n {\n ObjectCreator = null,\n SerializeHandler = Issue977_ConfigTypeAArraySerializeHandler\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateArrayInfo(options, info);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void Issue977_ConfigTypeAArraySerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA[]? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartArray();\n\n for (int i = 0; i < value.Length; i++)\n {\n Issue977_ConfigTypeASerializeHandler(writer, value[i]);\n }\n\n writer.WriteEndArray();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_ConfigTypeB.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_ConfigTypeB.g.cs#L1-L107", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_ConfigTypeB.g.cs", + "startLine": 1, + "endLine": 107, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Issue977_ConfigTypeB;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Issue977_ConfigTypeB\n #nullable enable annotations\n {\n get => _Issue977_ConfigTypeB ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeB));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Issue977_ConfigTypeB(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = null,\n ObjectWithParameterizedConstructorCreator = static args => new global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeB(){ Items = (global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA[])args[0] },\n PropertyMetadataInitializer = _ => Issue977_ConfigTypeBPropInit(options),\n ConstructorParameterMetadataInitializer = Issue977_ConfigTypeBCtorParamInit,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeB).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = Issue977_ConfigTypeBSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] Issue977_ConfigTypeBPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[1];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeB),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeB)obj).Items,\n Setter = static (obj, value) => throw new global::System.InvalidOperationException(\"Setting init-only properties is not supported in source generation mode.\"),\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Items\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeB).GetProperty(\"Items\", InstanceMemberBindingFlags, null, typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA[]), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n properties[0].IsGetNullable = false;\n properties[0].IsSetNullable = false;\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void Issue977_ConfigTypeBSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeB? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WritePropertyName(PropName_Items);\n Issue977_ConfigTypeAArraySerializeHandler(writer, ((global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeB)value).Items);\n\n writer.WriteEndObject();\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] Issue977_ConfigTypeBCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]\n {\n new()\n {\n Name = \"Items\",\n ParameterType = typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA[]),\n Position = 0,\n IsNullable = false,\n IsMemberInitializer = true,\n },\n };\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_RootType.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_RootType.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_RootType.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Issue977_RootType;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Issue977_RootType\n #nullable enable annotations\n {\n get => _Issue977_RootType ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Issue977_RootType(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = null,\n ObjectWithParameterizedConstructorCreator = static args => new global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType(){ ConfigA = (global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA)args[0], ConfigB = (global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeB)args[1] },\n PropertyMetadataInitializer = _ => Issue977_RootTypePropInit(options),\n ConstructorParameterMetadataInitializer = Issue977_RootTypeCtorParamInit,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = Issue977_RootTypeSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] Issue977_RootTypePropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType)obj).ConfigA,\n Setter = static (obj, value) => throw new global::System.InvalidOperationException(\"Setting init-only properties is not supported in source generation mode.\"),\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"ConfigA\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType).GetProperty(\"ConfigA\", InstanceMemberBindingFlags, null, typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType)obj).ConfigB,\n Setter = static (obj, value) => throw new global::System.InvalidOperationException(\"Setting init-only properties is not supported in source generation mode.\"),\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"ConfigB\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType).GetProperty(\"ConfigB\", InstanceMemberBindingFlags, null, typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeB), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void Issue977_RootTypeSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WritePropertyName(PropName_ConfigA);\n Issue977_ConfigTypeASerializeHandler(writer, ((global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType)value).ConfigA);\n writer.WritePropertyName(PropName_ConfigB);\n Issue977_ConfigTypeBSerializeHandler(writer, ((global::Json.Schema.Generation.Tests.ClientTests.Issue977_RootType)value).ConfigB);\n\n writer.WriteEndObject();\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] Issue977_RootTypeCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]\n {\n new()\n {\n Name = \"ConfigA\",\n ParameterType = typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeA),\n Position = 0,", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_RootType.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_RootType.g.cs#L121-L136", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_RootType.g.cs", + "startLine": 121, + "endLine": 136, + "content": "IsNullable = true,\n IsMemberInitializer = true,\n },\n\n new()\n {\n Name = \"ConfigB\",\n ParameterType = typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_ConfigTypeB),\n Position = 1,\n IsNullable = true,\n IsMemberInitializer = true,\n },\n };\n }\n}", + "snippet": "IsNullable = true,\n IsMemberInitializer = true,\n },\n\n new()\n {\n Name = \"ConfigB\",\n ParameterType = typeof(global::Json.Schema.Generation.Tests" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_SampleEnum.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_SampleEnum.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Issue977_SampleEnum.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Issue977_SampleEnum;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Issue977_SampleEnum\n #nullable enable annotations\n {\n get => _Issue977_SampleEnum ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_SampleEnum));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Issue977_SampleEnum(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.GetEnumConverter(options));\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.JsonSchema.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.JsonSchema.g.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.JsonSchema.g.cs", + "startLine": 1, + "endLine": 38, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _JsonSchema;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo JsonSchema\n #nullable enable annotations\n {\n get => _JsonSchema ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.JsonSchema));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_JsonSchema(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n global::System.Text.Json.Serialization.JsonConverter converter = ExpandConverter(typeof(global::Json.Schema.JsonSchema), new global::Json.Schema.JsonSchemaJsonConverter(), options);\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo (options, converter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.MultipleConditionGroups.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.MultipleConditionGroups.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.MultipleConditionGroups.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _MultipleConditionGroups;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo MultipleConditionGroups\n #nullable enable annotations\n {\n get => _MultipleConditionGroups ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_MultipleConditionGroups(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => MultipleConditionGroupsPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = MultipleConditionGroupsSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] MultipleConditionGroupsPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[4];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups)obj).Toggle,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups)obj).Toggle = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Toggle\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups).GetProperty(\"Toggle\", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups)obj).OtherToggle,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups)obj).OtherToggle = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"OtherToggle\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups).GetProperty(\"OtherToggle\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups)obj).RequiredIfToggle,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups)obj).RequiredIfToggle = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"RequiredIfToggle\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups).GetProperty(\"RequiredIfToggle\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info2);\n\n var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups)obj).RequiredIfOtherToggle,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups)obj).RequiredIfOtherToggle = value!,\n IgnoreCondition = null,", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.MultipleConditionGroups.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.MultipleConditionGroups.g.cs#L121-L155", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.MultipleConditionGroups.g.cs", + "startLine": 121, + "endLine": 155, + "content": "HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"RequiredIfOtherToggle\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups).GetProperty(\"RequiredIfOtherToggle\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info3);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void MultipleConditionGroupsSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteBoolean(PropName_Toggle, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups)value).Toggle);\n writer.WriteNumber(PropName_OtherToggle, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups)value).OtherToggle);\n writer.WriteString(PropName_RequiredIfToggle, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups)value).RequiredIfToggle);\n writer.WriteString(PropName_RequiredIfOtherToggle, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups)value).RequiredIfOtherToggle);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"RequiredIfOtherToggle\",\n JsonPropertyName = null,\n Att" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.MultipleTriggersInSameGroup.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.MultipleTriggersInSameGroup.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.MultipleTriggersInSameGroup.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _MultipleTriggersInSameGroup;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo MultipleTriggersInSameGroup\n #nullable enable annotations\n {\n get => _MultipleTriggersInSameGroup ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_MultipleTriggersInSameGroup(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => MultipleTriggersInSameGroupPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = MultipleTriggersInSameGroupSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] MultipleTriggersInSameGroupPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup)obj).Count,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup)obj).Count = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Count\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup).GetProperty(\"Count\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup)obj).Name,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup)obj).Name = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Name\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup).GetProperty(\"Name\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n properties[1].IsGetNullable = false;\n properties[1].IsSetNullable = false;\n\n var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup)obj).SpecialField,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup)obj).SpecialField = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"SpecialField\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup).GetProperty(\"SpecialField\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info2);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void MultipleTriggersInSameGroupSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup? value)\n {\n if (value is null)", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.MultipleTriggersInSameGroup.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.MultipleTriggersInSameGroup.g.cs#L121-L136", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.MultipleTriggersInSameGroup.g.cs", + "startLine": 121, + "endLine": 136, + "content": "{\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteNumber(PropName_Count, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup)value).Count);\n writer.WriteString(PropName_Name, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup)value).Name);\n writer.WriteString(PropName_SpecialField, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup)value).SpecialField);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "{\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteNumber(PropName_Count, ((global::Json.Schema.Generation.Tests." + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.NullableInt32.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.NullableInt32.g.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.NullableInt32.g.cs", + "startLine": 1, + "endLine": 38, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _NullableInt32;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo NullableInt32\n #nullable enable annotations\n {\n get => _NullableInt32 ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(int?));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_NullableInt32(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n global::System.Text.Json.Serialization.JsonConverter converter = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.GetNullableConverter(options);\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, converter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.NullableIssue977_SampleEnum.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.NullableIssue977_SampleEnum.g.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.NullableIssue977_SampleEnum.g.cs", + "startLine": 1, + "endLine": 38, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _NullableIssue977_SampleEnum;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo NullableIssue977_SampleEnum\n #nullable enable annotations\n {\n get => _NullableIssue977_SampleEnum ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.ClientTests.Issue977_SampleEnum?));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_NullableIssue977_SampleEnum(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n global::System.Text.Json.Serialization.JsonConverter converter = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.GetNullableConverter(options);\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, converter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithAddresses.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithAddresses.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithAddresses.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _PersonWithAddresses;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo PersonWithAddresses\n #nullable enable annotations\n {\n get => _PersonWithAddresses ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_PersonWithAddresses(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => PersonWithAddressesPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = PersonWithAddressesSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] PersonWithAddressesPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses)obj).Name,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses)obj).Name = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Name\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses).GetProperty(\"Name\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n properties[0].IsGetNullable = false;\n properties[0].IsSetNullable = false;\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses)obj).HomeAddress,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses)obj).HomeAddress = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"HomeAddress\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses).GetProperty(\"HomeAddress\", InstanceMemberBindingFlags, null, typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses)obj).WorkAddress,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses)obj).WorkAddress = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"WorkAddress\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses).GetProperty(\"WorkAddress\", InstanceMemberBindingFlags, null, typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address), global::System.Array.Empty(), null),\n };\n \n properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info2);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void PersonWithAddressesSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses? value)\n {\n if (value is null)", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithAddresses.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithAddresses.g.cs#L121-L138", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithAddresses.g.cs", + "startLine": 121, + "endLine": 138, + "content": "{\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Name, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses)value).Name);\n writer.WritePropertyName(PropName_HomeAddress);\n AddressSerializeHandler(writer, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses)value).HomeAddress);\n writer.WritePropertyName(PropName_WorkAddress);\n AddressSerializeHandler(writer, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses)value).WorkAddress);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "{\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Name, ((global::Json.Schema.Generation.Tests.S" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithDescription.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithDescription.g.cs#L1-L115", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithDescription.g.cs", + "startLine": 1, + "endLine": 115, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _PersonWithDescription;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo PersonWithDescription\n #nullable enable annotations\n {\n get => _PersonWithDescription ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_PersonWithDescription(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => PersonWithDescriptionPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = PersonWithDescriptionSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] PersonWithDescriptionPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription)obj).Name,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription)obj).Name = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Name\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription).GetProperty(\"Name\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n properties[0].IsGetNullable = false;\n properties[0].IsSetNullable = false;\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription)obj).Age,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription)obj).Age = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Age\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription).GetProperty(\"Age\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void PersonWithDescriptionSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Name, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription)value).Name);\n writer.WriteNumber(PropName_Age, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription)value).Age);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithEnum.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithEnum.g.cs#L1-L116", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithEnum.g.cs", + "startLine": 1, + "endLine": 116, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _PersonWithEnum;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo PersonWithEnum\n #nullable enable annotations\n {\n get => _PersonWithEnum ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_PersonWithEnum(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => PersonWithEnumPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = PersonWithEnumSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] PersonWithEnumPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum)obj).Name,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum)obj).Name = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Name\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum).GetProperty(\"Name\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n properties[0].IsGetNullable = false;\n properties[0].IsSetNullable = false;\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum)obj).Status,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum)obj).Status = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Status\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum).GetProperty(\"Status\", InstanceMemberBindingFlags, null, typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Status), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void PersonWithEnumSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Name, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum)value).Name);\n writer.WritePropertyName(PropName_Status);\n global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum)value).Status, Status);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithNullable.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithNullable.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithNullable.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _PersonWithNullable;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo PersonWithNullable\n #nullable enable annotations\n {\n get => _PersonWithNullable ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_PersonWithNullable(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => PersonWithNullablePropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = PersonWithNullableSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] PersonWithNullablePropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable)obj).Name,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable)obj).Name = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Name\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable).GetProperty(\"Name\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n properties[0].IsGetNullable = false;\n properties[0].IsSetNullable = false;\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable)obj).Email,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable)obj).Email = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Email\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable).GetProperty(\"Email\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable)obj).Age,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable)obj).Age = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Age\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable).GetProperty(\"Age\", InstanceMemberBindingFlags, null, typeof(int?), global::System.Array.Empty(), null),\n };\n \n properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info2);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void PersonWithNullableSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable? value)\n {\n if (value is null)", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithNullable.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithNullable.g.cs#L121-L137", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithNullable.g.cs", + "startLine": 121, + "endLine": 137, + "content": "{\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Name, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable)value).Name);\n writer.WriteString(PropName_Email, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable)value).Email);\n writer.WritePropertyName(PropName_Age);\n global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable)value).Age, NullableInt32);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "{\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Name, ((global::Json.Schema.Generation.Tests.S" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithRequired.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithRequired.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithRequired.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _PersonWithRequired;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo PersonWithRequired\n #nullable enable annotations\n {\n get => _PersonWithRequired ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_PersonWithRequired(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = null,\n ObjectWithParameterizedConstructorCreator = static args => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired(){ Name = (string)args[0] },\n PropertyMetadataInitializer = _ => PersonWithRequiredPropInit(options),\n ConstructorParameterMetadataInitializer = PersonWithRequiredCtorParamInit,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = PersonWithRequiredSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] PersonWithRequiredPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired)obj).Name,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired)obj).Name = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Name\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired).GetProperty(\"Name\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n properties[0].IsRequired = true;\n properties[0].IsGetNullable = false;\n properties[0].IsSetNullable = false;\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired)obj).Age,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired)obj).Age = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Age\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired).GetProperty(\"Age\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void PersonWithRequiredSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Name, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired)value).Name);\n writer.WriteNumber(PropName_Age, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired)value).Age);\n\n writer.WriteEndObject();\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] PersonWithRequiredCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]\n {\n new()\n {\n Name = \"Name\",\n ParameterType = typeof(string),", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithRequired.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithRequired.g.cs#L121-L128", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PersonWithRequired.g.cs", + "startLine": 121, + "endLine": 128, + "content": "Position = 0,\n IsNullable = false,\n IsMemberInitializer = true,\n },\n };\n }\n}", + "snippet": "Position = 0,\n IsNullable = false,\n IsMemberInitializer = true,\n },\n };\n }\n}" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Point.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Point.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Point.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Point;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Point\n #nullable enable annotations\n {\n get => _Point ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::System.Drawing.Point));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Point(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::System.Drawing.Point(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => PointPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::System.Drawing.Point).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = PointSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] PointPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::System.Drawing.Point),\n Converter = null,\n Getter = static obj => ((global::System.Drawing.Point)obj).IsEmpty,\n Setter = null,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"IsEmpty\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::System.Drawing.Point).GetProperty(\"IsEmpty\", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::System.Drawing.Point),\n Converter = null,\n Getter = static obj => ((global::System.Drawing.Point)obj).X,\n Setter = static (obj, value) => global::System.Runtime.CompilerServices.Unsafe.Unbox(obj).X = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"X\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::System.Drawing.Point).GetProperty(\"X\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::System.Drawing.Point),\n Converter = null,\n Getter = static obj => ((global::System.Drawing.Point)obj).Y,\n Setter = static (obj, value) => global::System.Runtime.CompilerServices.Unsafe.Unbox(obj).Y = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Y\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::System.Drawing.Point).GetProperty(\"Y\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info2);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void PointSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::System.Drawing.Point value)\n {\n writer.WriteStartObject();\n\n writer.WriteBoolean(PropName_IsEmpty, ((global::System.Drawing.Point)value).IsEmpty);", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Point.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Point.g.cs#L121-L128", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Point.g.cs", + "startLine": 121, + "endLine": 128, + "content": "writer.WriteNumber(PropName_X, ((global::System.Drawing.Point)value).X);\n writer.WriteNumber(PropName_Y, ((global::System.Drawing.Point)value).Y);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "writer.WriteNumber(PropName_X, ((global::System.Drawing.Point)value).X);\n writer.WriteNumber(PropName_Y, ((global::System.Drawing.Point)value).Y);\n\n writer.WriteEndObject();\n }\n }\n}" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ProductWithCustomAttributes.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ProductWithCustomAttributes.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ProductWithCustomAttributes.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _ProductWithCustomAttributes;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ProductWithCustomAttributes\n #nullable enable annotations\n {\n get => _ProductWithCustomAttributes ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_ProductWithCustomAttributes(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => ProductWithCustomAttributesPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = ProductWithCustomAttributesSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] ProductWithCustomAttributesPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[4];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)obj).Name,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)obj).Name = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Name\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes).GetProperty(\"Name\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n properties[0].IsGetNullable = false;\n properties[0].IsSetNullable = false;\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)obj).Price,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)obj).Price = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Price\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes).GetProperty(\"Price\", InstanceMemberBindingFlags, null, typeof(decimal), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)obj).DiscountPercentage,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)obj).DiscountPercentage = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"DiscountPercentage\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes).GetProperty(\"DiscountPercentage\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info2);\n\n var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)obj).Description,", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ProductWithCustomAttributes.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ProductWithCustomAttributes.g.cs#L121-L157", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.ProductWithCustomAttributes.g.cs", + "startLine": 121, + "endLine": 157, + "content": "Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)obj).Description = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Description\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes).GetProperty(\"Description\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info3);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void ProductWithCustomAttributesSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Name, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)value).Name);\n writer.WriteNumber(PropName_Price, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)value).Price);\n writer.WriteNumber(PropName_DiscountPercentage, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)value).DiscountPercentage);\n writer.WriteString(PropName_Description, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)value).Description);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes)obj).Description = value!,\n IgnoreCondition = null,\n HasJsonInc" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PropertyNames.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PropertyNames.g.cs#L1-L52", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.PropertyNames.g.cs", + "startLine": 1, + "endLine": 52, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Mode = global::System.Text.Json.JsonEncodedText.Encode(\"Mode\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Items = global::System.Text.Json.JsonEncodedText.Encode(\"Items\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_ConfigA = global::System.Text.Json.JsonEncodedText.Encode(\"ConfigA\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_ConfigB = global::System.Text.Json.JsonEncodedText.Encode(\"ConfigB\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Bar = global::System.Text.Json.JsonEncodedText.Encode(\"Bar\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Value = global::System.Text.Json.JsonEncodedText.Encode(\"Value\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Street = global::System.Text.Json.JsonEncodedText.Encode(\"Street\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_City = global::System.Text.Json.JsonEncodedText.Encode(\"City\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_PostalCode = global::System.Text.Json.JsonEncodedText.Encode(\"PostalCode\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_FirstName = global::System.Text.Json.JsonEncodedText.Encode(\"FirstName\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_LastName = global::System.Text.Json.JsonEncodedText.Encode(\"LastName\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Age = global::System.Text.Json.JsonEncodedText.Encode(\"Age\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_IsActive = global::System.Text.Json.JsonEncodedText.Encode(\"IsActive\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Name = global::System.Text.Json.JsonEncodedText.Encode(\"Name\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Score = global::System.Text.Json.JsonEncodedText.Encode(\"Score\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_BonusEligible = global::System.Text.Json.JsonEncodedText.Encode(\"BonusEligible\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_AdultField = global::System.Text.Json.JsonEncodedText.Encode(\"AdultField\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Day = global::System.Text.Json.JsonEncodedText.Encode(\"Day\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_MondayField = global::System.Text.Json.JsonEncodedText.Encode(\"MondayField\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_TuesdayField = global::System.Text.Json.JsonEncodedText.Encode(\"TuesdayField\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Toggle = global::System.Text.Json.JsonEncodedText.Encode(\"Toggle\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_OtherToggle = global::System.Text.Json.JsonEncodedText.Encode(\"OtherToggle\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_RequiredIfToggle = global::System.Text.Json.JsonEncodedText.Encode(\"RequiredIfToggle\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_RequiredIfOtherToggle = global::System.Text.Json.JsonEncodedText.Encode(\"RequiredIfOtherToggle\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Count = global::System.Text.Json.JsonEncodedText.Encode(\"Count\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_SpecialField = global::System.Text.Json.JsonEncodedText.Encode(\"SpecialField\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_HomeAddress = global::System.Text.Json.JsonEncodedText.Encode(\"HomeAddress\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_WorkAddress = global::System.Text.Json.JsonEncodedText.Encode(\"WorkAddress\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Status = global::System.Text.Json.JsonEncodedText.Encode(\"Status\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Email = global::System.Text.Json.JsonEncodedText.Encode(\"Email\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Price = global::System.Text.Json.JsonEncodedText.Encode(\"Price\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_DiscountPercentage = global::System.Text.Json.JsonEncodedText.Encode(\"DiscountPercentage\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Description = global::System.Text.Json.JsonEncodedText.Encode(\"Description\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Required = global::System.Text.Json.JsonEncodedText.Encode(\"Required\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_IsEmpty = global::System.Text.Json.JsonEncodedText.Encode(\"IsEmpty\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_X = global::System.Text.Json.JsonEncodedText.Encode(\"X\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Y = global::System.Text.Json.JsonEncodedText.Encode(\"Y\");\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.SimplePerson.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.SimplePerson.g.cs#L1-L115", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.SimplePerson.g.cs", + "startLine": 1, + "endLine": 115, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _SimplePerson;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo SimplePerson\n #nullable enable annotations\n {\n get => _SimplePerson ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_SimplePerson(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => SimplePersonPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = SimplePersonSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] SimplePersonPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson)obj).Name,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson)obj).Name = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Name\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson).GetProperty(\"Name\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n properties[0].IsGetNullable = false;\n properties[0].IsSetNullable = false;\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson)obj).Age,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson)obj).Age = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Age\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson).GetProperty(\"Age\", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void SimplePersonSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Name, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson)value).Name);\n writer.WriteNumber(PropName_Age, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson)value).Age);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.SingleCondition.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.SingleCondition.g.cs#L1-L113", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.SingleCondition.g.cs", + "startLine": 1, + "endLine": 113, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _SingleCondition;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo SingleCondition\n #nullable enable annotations\n {\n get => _SingleCondition ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_SingleCondition(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => SingleConditionPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = SingleConditionSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] SingleConditionPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition)obj).Toggle,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition)obj).Toggle = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Toggle\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition).GetProperty(\"Toggle\", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition)obj).Required,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition)obj).Required = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Required\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition).GetProperty(\"Required\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void SingleConditionSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteBoolean(PropName_Toggle, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition)value).Toggle);\n writer.WriteString(PropName_Required, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition)value).Required);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.SingleConditionCamelCase.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.SingleConditionCamelCase.g.cs#L1-L113", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.SingleConditionCamelCase.g.cs", + "startLine": 1, + "endLine": 113, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _SingleConditionCamelCase;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo SingleConditionCamelCase\n #nullable enable annotations\n {\n get => _SingleConditionCamelCase ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_SingleConditionCamelCase(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => SingleConditionCamelCasePropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = SingleConditionCamelCaseSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] SingleConditionCamelCasePropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase)obj).Toggle,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase)obj).Toggle = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Toggle\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase).GetProperty(\"Toggle\", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase)obj).Required,\n Setter = static (obj, value) => ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase)obj).Required = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Required\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase).GetProperty(\"Required\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void SingleConditionCamelCaseSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteBoolean(PropName_Toggle, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase)value).Toggle);\n writer.WriteString(PropName_Required, ((global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase)value).Required);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Status.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Status.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.Status.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Status;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Status\n #nullable enable annotations\n {\n get => _Status ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Generation.Tests.SourceGeneration.TestModels.Status));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Status(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.GetEnumConverter(options));\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.String.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.String.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Generated/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/TestSerializerContext.String.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generation.Tests\n{\n public partial class TestSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _String;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo String\n #nullable enable annotations\n {\n get => _String ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(string));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_String(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.StringConverter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema.Generatio" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Release/net10.0/JsonSchema.Generation.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Release/net10.0/JsonSchema.Generation.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Release/net10.0/JsonSchema.Generation.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Release/net8.0/JsonSchema.Generation.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Release/net8.0/JsonSchema.Generation.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Release/net8.0/JsonSchema.Generation.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Generation.Tests/obj/Release/net9.0/JsonSchema.Generation.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/obj/Release/net9.0/JsonSchema.Generation.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/obj/Release/net9.0/JsonSchema.Generation.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Generation.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation.Tests/PropertyNameResolverTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/PropertyNameResolverTests.cs#L1-L66", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/PropertyNameResolverTests.cs", + "startLine": 1, + "endLine": 66, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable InconsistentNaming\n// ReSharper disable UnusedMember.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class PropertyNameResolverTests\n{\n\tprivate class TargetWithJsonPropertyName\n\t{\n\t\t[JsonPropertyName(\"JsonName\")]\n\t\tpublic string PropertyThatNeeds_Changing { get; set; }\n\t}\n\n\tprivate class TargetWithoutJsonPropertyName\n\t{\n\t\tpublic string PropertyThatNeeds_Changing { get; set; }\n\t}\n\n\tpublic static IEnumerable TestCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(typeof(TargetWithoutJsonPropertyName), PropertyNameResolvers.AsDeclared, \"PropertyThatNeeds_Changing\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithoutJsonPropertyName), PropertyNameResolvers.CamelCase, \"propertyThatNeedsChanging\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithoutJsonPropertyName), PropertyNameResolvers.PascalCase, \"PropertyThatNeedsChanging\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithoutJsonPropertyName), PropertyNameResolvers.KebabCase, \"property-that-needs-changing\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithoutJsonPropertyName), PropertyNameResolvers.UpperKebabCase, \"PROPERTY-THAT-NEEDS-CHANGING\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithoutJsonPropertyName), PropertyNameResolvers.SnakeCase, \"property_that_needs_changing\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithoutJsonPropertyName), PropertyNameResolvers.UpperSnakeCase, \"PROPERTY_THAT_NEEDS_CHANGING\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithoutJsonPropertyName), new PropertyNameResolver(static _ => \"CustomName\"), \"CustomName\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithJsonPropertyName), PropertyNameResolvers.AsDeclared, \"JsonName\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithJsonPropertyName), PropertyNameResolvers.CamelCase, \"JsonName\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithJsonPropertyName), PropertyNameResolvers.PascalCase, \"JsonName\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithJsonPropertyName), PropertyNameResolvers.KebabCase, \"JsonName\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithJsonPropertyName), PropertyNameResolvers.UpperKebabCase, \"JsonName\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithJsonPropertyName), PropertyNameResolvers.SnakeCase, \"JsonName\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithJsonPropertyName), PropertyNameResolvers.UpperSnakeCase, \"JsonName\");\n\t\t\tyield return new TestCaseData(typeof(TargetWithJsonPropertyName), new PropertyNameResolver(static _ => \"CustomName\"), \"JsonName\");\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(TestCases))]\n\tpublic void VerifyNameChanges(Type type, PropertyNameResolver resolver, string expectedName)\n\t{\n\t\tvar config = new SchemaGeneratorConfiguration\n\t\t{\n\t\t\tPropertyNameResolver = resolver\n\t\t};\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(expectedName, new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.Build();\n\n\t\tvar actual = new JsonSchemaBuilder().FromType(type, config).Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable InconsistentNaming\n// ReSh" + }, + { + "title": "src/JsonSchema.Generation.Tests/PropertyOrderTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/PropertyOrderTests.cs#L1-L107", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/PropertyOrderTests.cs", + "startLine": 1, + "endLine": 107, + "content": "using System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class PropertyOrderTests\n{\n\tprivate class SpecifiedOrder\n\t{\n\t\tpublic int Second { get; set; }\n\t\tpublic int First { get; set; }\n\t}\n\n\tprivate class SpecifiedOrderDerived : SpecifiedOrder\n\t{\n\t\tpublic int Third { get; set; }\n\t}\n\n\t[Test]\n\tpublic void PropertiesAsDeclared()\n\t{\n\t\tvar config = new SchemaGeneratorConfiguration\n\t\t{\n\t\t\tPropertyOrder = PropertyOrder.AsDeclared\n\t\t};\n\n\t\tvar builder = new JsonSchemaBuilder();\n\t\tbuilder.FromType(config);\n\n\t\tvar schema = builder.Build();\n\t\tTestConsole.WriteLine(schema.Root.Source);\n\n\t\tvar expected = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"Second\": {\"type\": \"integer\"},\n\t\t\t \"First\": {\"type\": \"integer\"}\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\n\t\tAssert.That(expected.IsEquivalentTo(schema.Root.Source));\n\t}\n\n\t[Test]\n\tpublic void PropertiesAsDeclaredByType()\n\t{\n\t\tvar config = new SchemaGeneratorConfiguration\n\t\t{\n\t\t\tPropertyOrder = PropertyOrder.AsDeclared\n\t\t};\n\n\t\tvar builder = new JsonSchemaBuilder();\n\t\tbuilder.FromType(config);\n\n\t\tvar schema = builder.Build();\n\t\tTestConsole.WriteLine(schema.Root.Source);\n\n\t\tvar expected = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"Second\": {\"type\": \"integer\"},\n\t\t\t \"First\": {\"type\": \"integer\"},\n\t\t\t \"Third\": {\"type\": \"integer\"}\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\n\t\tAssert.That(expected.IsEquivalentTo(schema.Root.Source));\n\t}\n\n\t[Test]\n\tpublic void PropertiesByName()\n\t{\n\t\tvar config = new SchemaGeneratorConfiguration\n\t\t{\n\t\t\tPropertyOrder = PropertyOrder.ByName\n\t\t};\n\n\t\tvar builder = new JsonSchemaBuilder();\n\t\tbuilder.FromType(config);\n\n\t\tvar schema = builder.Build();\n\t\tTestConsole.WriteLine(schema.Root.Source);\n\n\t\tvar expected = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"First\": {\"type\": \"integer\"},\n\t\t\t \"Second\": {\"type\": \"integer\"}\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\n\t\tAssert.That(expected.IsEquivalentTo(schema.Root.Source));\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class PropertyOrder" + }, + { + "title": "src/JsonSchema.Generation.Tests/PropertyOverridesTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/PropertyOverridesTests.cs#L1-L42", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/PropertyOverridesTests.cs", + "startLine": 1, + "endLine": 42, + "content": "using System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Generation.Tests;\n\ninternal class PropertyOverridesTests\n{\n\t[Test]\n\tpublic void TypeWithPropertyOverride_GeneratesCorrectly()\n\t{\n\t\tvar builder = new JsonSchemaBuilder();\n\t\tbuilder.FromType();\n\n\t\tvar schema = builder.Build();\n\t\tTestConsole.WriteLine(schema.Root.Source);\n\n\t\tvar expected = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"MyProperty\": {\"type\": [\"null\", \"string\"]}\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\n\t\tAssert.That(expected.IsEquivalentTo(schema.Root.Source));\n\t}\n}\n\npublic class BaseClassWithProperty\n{\n\tpublic int MyProperty { get; set; }\n}\n\npublic class DerivedClassWithProperty : BaseClassWithProperty\n{\n\tpublic new string? MyProperty { get; set; }\n}", + "snippet": "using System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Generation.Tests;\n\ninternal class PropertyOverridesTests\n{\n\t[Test]\n\tpublic void TypeWithPropertyOverride_Generates" + }, + { + "title": "src/JsonSchema.Generation.Tests/ReadabilityAndWriteabilityTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ReadabilityAndWriteabilityTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ReadabilityAndWriteabilityTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class ReadabilityAndWritabilityTests\n{\n\tprivate class ReadOnlyProperty\n\t{\n\t\tpublic int Prop { get; }\n\t}\n\n\t[Test]\n\tpublic void ReadOnlyPropertyTest()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Prop\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.ReadOnly(true)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class ReadOnlyPropertyWithReadOnlyAttributeFalse\n\t{\n\t\t[ReadOnly(false)] public int Prop { get; }\n\t}\n\n\t[Test]\n\tpublic void ReadOnlyPropertyWithReadOnlyAttributeFalseTest()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Prop\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.ReadOnly(false)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class ReadWritePropertyWithReadOnlyAttribute\n\t{\n\t\t[ReadOnly(true)] public int Prop { get; set; }\n\t}\n\n\t[Test]\n\tpublic void ReadWritePropertyWithReadOnlyAttributeTest()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Prop\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.ReadOnly(true)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class ReadWritePropertyWithReadOnlyAttributeFalse\n\t{\n\t\t[ReadOnly(false)] public int Prop { get; set; }\n\n\t}\n\n\t[Test]\n\tpublic void ReadWritePropertyWithReadOnlyAttributeFalseTest()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Prop\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.ReadOnly(false)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class WriteOnlyProperty\n\t{\n\t\tpublic int Prop\n\t\t{\n\t\t\tset { }\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void WriteOnlyPropertyTest()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Prop\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.WriteOnly(true)", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class ReadabilityAndWritabilityTes" + }, + { + "title": "src/JsonSchema.Generation.Tests/ReadabilityAndWriteabilityTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/ReadabilityAndWriteabilityTests.cs#L121-L201", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/ReadabilityAndWriteabilityTests.cs", + "startLine": 121, + "endLine": 201, + "content": ")\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class WriteOnlyPropertyWithWriteOnlyAttributeFalse\n\t{\n\t\t[WriteOnly(false)]\n\t\tpublic int Prop\n\t\t{\n\t\t\tset { }\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void WriteOnlyPropertyWithWriteOnlyAttributeFalseTest()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Prop\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.WriteOnly(false)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class ReadWritePropertyWithWriteOnlyAttribute\n\t{\n\t\t[WriteOnly(true)] public int Prop { get; set; }\n\t}\n\n\t[Test]\n\tpublic void ReadWritePropertyWithWriteOnlyAttributeTest()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Prop\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.WriteOnly(true)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class ReadWritePropertyWithWriteOnlyAttributeFalse\n\t{\n\t\t[WriteOnly(false)] public int Prop { get; set; }\n\t}\n\n\t[Test]\n\tpublic void ReadWritePropertyWithWriteOnlyAttributeFalseTest()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Prop\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.WriteOnly(false)\n\t\t\t\t)\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": ")\n\t\t\t);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class WriteOnlyPropertyWithWriteOnlyAttributeFalse\n\t{\n\t\t[WriteOnly(false)]\n\t\tpublic int Prop\n\t" + }, + { + "title": "src/JsonSchema.Generation.Tests/RefinerTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/RefinerTests.cs#L1-L83", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/RefinerTests.cs", + "startLine": 1, + "endLine": 83, + "content": "using System.Text.Json;\nusing Json.Schema.Generation.Intents;\nusing NUnit.Framework;\nusing TestHelpers;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class RefinerTests\n{\n\tprivate class TwoProps\n\t{\n\t\tpublic int Value1 { get; set; }\n\t\tpublic string Value2 { get; set; }\n\t}\n\n\tprivate class ThreeProps\n\t{\n\t\tpublic int Value1 { get; set; }\n\t\tpublic string Value2 { get; set; }\n\t\tpublic bool Value3 { get; set; }\n\t}\n\n\tprivate class Refiner : ISchemaRefiner\n\t{\n\t\tpublic bool ShouldRun(SchemaGenerationContextBase context)\n\t\t{\n\t\t\treturn context.Type.GetProperties().Length % 2 == 1;\n\t\t}\n\n\t\tpublic void Run(SchemaGenerationContextBase context)\n\t\t{\n\t\t\tcontext.Intents.Add(new ReadOnlyIntent(true));\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void TypesWithAnOddNumberOfPropertiesShouldBeImmutable()\n\t{\n\t\tvar configuration = new SchemaGeneratorConfiguration\n\t\t{\n\t\t\tRefiners = { new Refiner() }\n\t\t};\n\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Value1\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"Value2\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"Value3\", new JsonSchemaBuilder().Type(SchemaValueType.Boolean))\n\t\t\t)\n\t\t\t.ReadOnly(true);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType(configuration);\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(expected, TestEnvironment.SerializerOptions));\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(actual, TestEnvironment.SerializerOptions));\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void TypesWithAnEvenNumberOfPropertiesShouldBeMutable()\n\t{\n\t\tvar configuration = new SchemaGeneratorConfiguration\n\t\t{\n\t\t\tRefiners = { new Refiner() }\n\t\t};\n\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Value1\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"Value2\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType(configuration);\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(expected, TestEnvironment.SerializerOptions));\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(actual, TestEnvironment.SerializerOptions));\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": "using System.Text.Json;\nusing Json.Schema.Generation.Intents;\nusing NUnit.Framework;\nusing TestHelpers;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable ClassNeverInstantiated.Local\n\nna" + }, + { + "title": "src/JsonSchema.Generation.Tests/SchemaGenerationTests.cs (1/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SchemaGenerationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SchemaGenerationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable InconsistentNaming\n// ReSharper disable ClassNeverInstantiated.Local\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class SchemaGenerationTests\n{\n\tpublic static IEnumerable SimpleTypeCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(typeof(bool), SchemaValueType.Boolean);\n\t\t\tyield return new TestCaseData(typeof(string), SchemaValueType.String);\n\t\t\tyield return new TestCaseData(typeof(byte), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(short), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(ushort), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(int), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(uint), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(long), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(ulong), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(float), SchemaValueType.Number);\n\t\t\tyield return new TestCaseData(typeof(double), SchemaValueType.Number);\n\t\t\tyield return new TestCaseData(typeof(decimal), SchemaValueType.Number);\n\t\t\tyield return new TestCaseData(typeof(bool?), SchemaValueType.Boolean);\n\t\t\tyield return new TestCaseData(typeof(byte?), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(short?), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(ushort?), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(int?), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(uint?), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(long?), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(ulong?), SchemaValueType.Integer);\n\t\t\tyield return new TestCaseData(typeof(float?), SchemaValueType.Number);\n\t\t\tyield return new TestCaseData(typeof(double?), SchemaValueType.Number);\n\t\t\tyield return new TestCaseData(typeof(decimal?), SchemaValueType.Number);\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(SimpleTypeCases))]\n\tpublic void CheckSimpleTypes(Type dotnetType, SchemaValueType schemaType)\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder().Schema(MetaSchemas.Draft202012Id).Type(schemaType);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType(dotnetType);\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void IntArray()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder().Schema(MetaSchemas.Draft202012Id).Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer));\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void NullableIntArray()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder().Schema(MetaSchemas.Draft202012Id).Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Integer));\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\t// ReSharper disable once InconsistentNaming\n\tpublic void IEnumerableOfListOfStrings()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType>>();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void GeneralArrayOfThings()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder().Schema(MetaSchemas.Draft202012Id).Type(SchemaValueType.Array);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void StringDictionaryOfInt()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.AdditionalProperties(new JsonSchemaBuilder().Type(SchemaValueType.Integer));\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType>();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void EmptyObject()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder().Schema(MetaSchemas.Draft202012Id);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable InconsistentNaming\n// ReSha" + }, + { + "title": "src/JsonSchema.Generation.Tests/SchemaGenerationTests.cs (2/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SchemaGenerationTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SchemaGenerationTests.cs", + "startLine": 121, + "endLine": 240, + "content": "AssertEqual(expected, actual);\n\t}\n\n\tprivate enum GenerationTargetEnumeration\n\t{\n\t\t[JsonIgnore]\n\t\tIgnoreThis,\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.Never)]\n\t\tDontIgnoreThis,\n\n\t\t[JsonExclude]\n\t\tIgnoreThisWithJsonExclude,\n\n\t\t[JsonIgnore]\n\t\t[JsonExclude]\n\t\tIgnoreAndExcludeThis,\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.Never)]\n\t\t[JsonExclude]\n\t\tExcludeTrumpsIgnore,\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]\n\t\t[JsonExclude]\n\t\tExcludeTrumpsIgnoreWhenWritingDefault,\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]\n\t\tDontIgnoreThisWhenWritingDefault,\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]\n\t\tDontIgnoreThisWhenWritingNull,\n\t}\n\n\t// ReSharper disable once ClassNeverInstantiated.Local\n\t// ReSharper disable UnusedMember.Local\n\tprivate class GenerationTarget\n\t{\n\t\t[JsonInclude]\n#pragma warning disable 169\n\t\tprivate int _value;\n\n\t\tprivate int _notIncluded;\n#pragma warning restore 169\n\n\t\tpublic GenerationTargetEnumeration EnumProp { get; set; }\n\n\t\t[Required]\n\t\t[Minimum(5)]\n\t\t[ExclusiveMinimum(4)]\n\t\t[Maximum(10)]\n\t\t[ExclusiveMaximum(11)]\n\t\t[MultipleOf(1.5)]\n\t\tpublic int Integer { get; set; }\n\n\t\t[MaxLength(10)]\n\t\t[Pattern(\"^[a-z0-9_]$\")]\n\t\tpublic string String { get; set; }\n\n\t\t[Required]\n\t\tpublic string RequiredString { get; set; }\n\n\t\t[JsonPropertyName(\"rename-this-required-string\")]\n\t\t[Required]\n\t\tpublic string RenameThisRequiredString { get; set; }\n\n\t\t[MinItems(5)]\n\t\t[MaxItems(10)]\n\t\tpublic List ListOfBool { get; set; }\n\n\t\t[MinLength(5, GenericParameter = 0)]\n\t\t[UniqueItems(true)]\n\t\t[Obsolete]\n\t\tpublic List ListOfString { get; set; }\n\n\t\t[Maximum(100)]\n\t\tpublic int Duplicated1 { get; set; }\n\n\t\t[Maximum(100)]\n\t\tpublic int Duplicated2 { get; set; }\n\n\t\tpublic GenerationTarget Target { get; set; }\n\n\t\t[JsonIgnore]\n\t\tpublic int IgnoreThis { get; set; }\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.Never)]\n\t\tpublic string DontIgnoreThis { get; set; }\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]\n\t\tpublic string DontIgnoreThisWhenWritingDefault { get; set; }\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]\n\t\tpublic string DontIgnoreThisWhenWritingNull { get; set; }\n\n\t\t[JsonExclude]\n\t\tpublic string IgnoreThisWithJsonExclude { get; set; }\n\n\t\t[JsonIgnore]\n\t\t[JsonExclude]\n\t\tpublic double IgnoreAndExcludeThis { get; set; }\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.Never)]\n\t\t[JsonExclude]\n\t\tpublic double ExcludeTrumpsIgnore { get; set; }\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]\n\t\t[JsonExclude]\n\t\tpublic double ExcludeTrumpsIgnoreWhenWritingDefault { get; set; }\n\n\n\t\t[JsonPropertyName(\"rename-this\")]\n\t\tpublic string RenameThis { get; set; }\n\n\t\tpublic float StrictNumber { get; set; }\n\t\tpublic float OtherStrictNumber { get; set; }\n\n\t\t[ReadOnly]\n\t\tpublic float ReadOnlyNumber { get; set; }", + "snippet": "AssertEqual(expected, actual);\n\t}\n\n\tprivate enum GenerationTargetEnumeration\n\t{\n\t\t[JsonIgnore]\n\t\tIgnoreThis,\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.Never)]\n\t\tDontIgnoreThis,\n\n\t\t[JsonExclude]\n\t\tIgnoreThisWithJsonE" + }, + { + "title": "src/JsonSchema.Generation.Tests/SchemaGenerationTests.cs (3/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SchemaGenerationTests.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SchemaGenerationTests.cs", + "startLine": 241, + "endLine": 360, + "content": "[WriteOnly]\n\t\tpublic float WriteOnlyNumber { get; set; }\n\n\t\t[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)]\n\t\tpublic float StringyNumber { get; set; }\n\n\t\t[JsonNumberHandling(JsonNumberHandling.AllowNamedFloatingPointLiterals)]\n\t\tpublic float NotANumber { get; set; }\n\n\t\t[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.AllowNamedFloatingPointLiterals)]\n\t\tpublic float StringyNotANumber { get; set; }\n\n\t\t[Title(\"title\")]\n\t\t[Description(\"description\")]\n\t\tpublic string Metadata { get; set; }\n\t}\n\t// ReSharper restore UnusedMember.Local\n\n\t[Test]\n\tpublic void GeneratorForObject()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"_value\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"EnumProp\", new JsonSchemaBuilder()\n\t\t\t\t\t.Enum(\"DontIgnoreThis\", \"DontIgnoreThisWhenWritingDefault\", \"DontIgnoreThisWhenWritingNull\")),\n\t\t\t\t(\"Integer\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Minimum(5)\n\t\t\t\t\t.ExclusiveMinimum(4)\n\t\t\t\t\t.Maximum(10)\n\t\t\t\t\t.ExclusiveMaximum(11)\n\t\t\t\t\t.MultipleOf(1.5m)\n\t\t\t\t),\n\t\t\t\t(\"String\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.MaxLength(10)\n\t\t\t\t\t.Pattern(\"^[a-z0-9_]$\")\n\t\t\t\t),\n\t\t\t\t(\"RequiredString\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t),\n\t\t\t\t(\"rename-this-required-string\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t),\n\t\t\t\t(\"ListOfBool\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items(new JsonSchemaBuilder().Type(SchemaValueType.Boolean))\n\t\t\t\t\t.MinItems(5)\n\t\t\t\t\t.MaxItems(10)\n\t\t\t\t),\n\t\t\t\t(\"ListOfString\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t\t.MinLength(5))\n\t\t\t\t\t.UniqueItems(true)\n\t\t\t\t\t.Deprecated(true)\n\t\t\t\t),\n\t\t\t\t(\"Duplicated1\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Maximum(100)\n\t\t\t\t),\n\t\t\t\t(\"Duplicated2\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Maximum(100)\n\t\t\t\t),\n\t\t\t\t(\"Target\", JsonSchemaBuilder.RefRoot()),\n\t\t\t\t(\"DontIgnoreThis\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"DontIgnoreThisWhenWritingDefault\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"DontIgnoreThisWhenWritingNull\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"rename-this\", new JsonSchemaBuilder().Type(SchemaValueType.String)),\n\t\t\t\t(\"StrictNumber\", new JsonSchemaBuilder().Type(SchemaValueType.Number)),\n\t\t\t\t(\"OtherStrictNumber\", new JsonSchemaBuilder().Type(SchemaValueType.Number)),\n\t\t\t\t(\"ReadOnlyNumber\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Number)\n\t\t\t\t\t.ReadOnly(true)\n\t\t\t\t),\n\t\t\t\t(\"WriteOnlyNumber\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Number)\n\t\t\t\t\t.WriteOnly(true)\n\t\t\t\t),\n\t\t\t\t(\"StringyNumber\", new JsonSchemaBuilder().Type(SchemaValueType.String | SchemaValueType.Number)),\n\t\t\t\t(\"NotANumber\", new JsonSchemaBuilder()\n\t\t\t\t\t.AnyOf(new JsonSchemaBuilder().Type(SchemaValueType.Number),\n\t\t\t\t\t\tnew JsonSchemaBuilder().Enum(\"NaN\", \"Infinity\", \"-Infinity\")\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\t(\"StringyNotANumber\", new JsonSchemaBuilder()\n\t\t\t\t\t.AnyOf(new JsonSchemaBuilder().Type(SchemaValueType.String | SchemaValueType.Number),\n\t\t\t\t\t\tnew JsonSchemaBuilder().Enum(\"NaN\", \"Infinity\", \"-Infinity\")\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\t(\"Metadata\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.Title(\"title\")\n\t\t\t\t\t.Description(\"description\")\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Required(nameof(GenerationTarget.Integer), \"RequiredString\", \"rename-this-required-string\");\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class InitializedType\n\t{\n\t\t[Default(46)]\n\t\tpublic int FortySix { get; set; } = 46;\n\t\t[Default(2)]\n\t\tpublic int Two { get; set; } = 2;\n\t}\n\n\t[Test]\n\tpublic void InitializedTypeGeneration()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()", + "snippet": "[WriteOnly]\n\t\tpublic float WriteOnlyNumber { get; set; }\n\n\t\t[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)]\n\t\tpublic float StringyNumber { get; set; }\n\n\t\t[JsonNumberHandling(JsonNumberHandling.AllowNamedF" + }, + { + "title": "src/JsonSchema.Generation.Tests/SchemaGenerationTests.cs (4/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SchemaGenerationTests.cs#L361-L400", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SchemaGenerationTests.cs", + "startLine": 361, + "endLine": 400, + "content": ".Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"FortySix\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Default(46)\n\t\t\t\t),\n\t\t\t\t(\"Two\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Default(2)\n\t\t\t\t)\n\t\t\t);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\tprivate class LinkedList\n\t{\n\t\tpublic int Value { get; set; }\n\t\tpublic LinkedList Next { get; set; }\n\t}\n\n\t[Test]\n\tpublic void RecursiveDefinition()\n\t{\n\t\tJsonSchema expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"Value\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"Next\", new JsonSchemaBuilder().Ref(\"#\"))\n\t\t\t);\n\n\t\tJsonSchema actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": ".Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"FortySix\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Default(46)\n\t\t\t\t),\n\t\t\t\t(\"Two\", new JsonSchemaBuilder(" + }, + { + "title": "src/JsonSchema.Generation.Tests/Serialization/DeserializationTests.cs (1/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/Serialization/DeserializationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/Serialization/DeserializationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Drawing;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing Json.Schema.Generation.Serialization;\nusing Json.Schema.Serialization;\nusing NUnit.Framework;\nusing TestHelpers;\nusing RangeAttribute = System.ComponentModel.DataAnnotations.RangeAttribute;\n\nnamespace Json.Schema.Generation.Tests.Serialization;\n\npublic class DeserializationTests\n{\n\tpublic class Foo\n\t{\n\t\t[MinLength(5)]\n\t\tpublic string? Bar { get; set; }\n\t\t[Range(40, int.MaxValue)]\n\t\t[Required]\n\t\tpublic int Value { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class FooWithSchema\n\t{\n\t\t[MinLength(5)]\n\t\tpublic string? Bar { get; set; }\n\t\t[Minimum(40)]\n\t\t[Required]\n\t\tpublic int Value { get; set; }\n\t}\n\n\tprivate static readonly JsonSerializerOptions _options = new()\n\t{\n\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\tWriteIndented = true,\n\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\tConverters = { new GenerativeValidatingJsonConverter { EvaluationOptions = { OutputFormat = OutputFormat.List } } }\n\t};\n\n\t[SetUp]\n\tpublic void Setup()\n\t{\n\t\tValidatingJsonConverter.MapType(PointSchema);\n\t}\n\n\tpublic static readonly JsonSchema PointSchema =\n\t\tnew JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"X\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"Y\", new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t)\n\t\t\t.AdditionalProperties(false);\n\n\t/// \n\t/// Demonstrates that even without a schema, the incorrect JSON data type is\n\t/// caught by the serializer. However, the error is only thrown for the first\n\t/// problem that is encountered. The serializer doesn't report that `Value`\n\t/// is also incorrect.\n\t/// \n\t[Test]\n\tpublic void NoSchema_BadType()\n\t{\n\t\tAssert.Throws(() =>\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": 10,\n \"\"Value\"\": \"\"value\"\"\n}\";\n\n\t\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tHandleException(e);\n\t\t\t\tAssert.That(e.Message, Is.Not.EqualTo(\"JSON does not meet schema requirements\"));\n\t\t\t\tthrow;\n\t\t\t}\n\t\t});\n\t}\n\n\t/// \n\t/// Demonstrates that with a schema, the entire payload is validated and all of\n\t/// the problems are reported.\n\t/// \n\t[Test]\n\tpublic void WithSchema_BadType()\n\t{\n\t\tAssert.Throws(() =>\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": 10,\n \"\"Value\"\": \"\"value\"\"\n}\";\n\n\t\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tHandleException(e);\n\t\t\t\tAssert.That(e.Message, Is.EqualTo(\"JSON does not meet schema requirements\"));\n\t\t\t\tthrow;\n\t\t\t}\n\t\t});\n\t}\n\n\t/// \n\t/// Demonstrates that the serializer doesn't consider data annotations.\n\t/// As long as the data types are correct, the serializer will complete,\n\t/// even if the values are out of the acceptable range.", + "snippet": "using System;\nusing System.Drawing;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing Json.Schema.Generation.Serialization;\nusing Json.Schema.Serialization;\nusing NUnit.Framework;\nusing TestHelpers;\nusing Ra" + }, + { + "title": "src/JsonSchema.Generation.Tests/Serialization/DeserializationTests.cs (2/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/Serialization/DeserializationTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/Serialization/DeserializationTests.cs", + "startLine": 121, + "endLine": 240, + "content": "/// \n\t[Test]\n\tpublic void NoSchema_BadValue()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n\"\"Bar\"\": \"\"bar\"\",\n\"\"Value\"\": 30\n}\";\n\n\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tHandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}\n\n\t/// \n\t/// Demonstrates that the serializer doesn't consider required properties\n\t/// that are missing from the data.\n\t/// \n\t[Test]\n\tpublic void NoSchema_MissingValue()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n\"\"Bar\"\": \"\"bar\"\"\n}\";\n\n\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tHandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}\n\n\t/// \n\t/// Demonstrates that with a schema, out-of-range values are captured and\n\t/// deserialization stops.\n\t/// \n\t[Test]\n\tpublic void WithSchema_BadValue()\n\t{\n\t\tAssert.Throws(() =>\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": \"\"bar\"\",\n \"\"Value\"\": 30\n}\";\n\n\t\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tHandleException(e);\n\t\t\t\tthrow;\n\t\t\t}\n\t\t});\n\t}\n\n\t/// \n\t/// Demonstrates that with a schema, missing required values are captured\n\t/// and deserialization stops.\n\t/// \n\t[Test]\n\tpublic void WithSchema_MissingValue()\n\t{\n\t\tAssert.Throws(() =>\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": \"\"bar\"\"\n}\";\n\n\t\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tHandleException(e);\n\t\t\t\tthrow;\n\t\t\t}\n\t\t});\n\t}\n\n\t/// \n\t/// Demonstrates a happy path without a schema.\n\t/// \n\t[Test]\n\tpublic void NoSchema_GoodValue()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": \"\"bartholomew\"\",\n \"\"Value\"\": 42\n}\";\n\n\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{", + "snippet": "/// \n\t[Test]\n\tpublic void NoSchema_BadValue()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n\"\"Bar\"\": \"\"bar\"\",\n\"\"Value\"\": 30\n}\";\n\n\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\tTestConsole.WriteLin" + }, + { + "title": "src/JsonSchema.Generation.Tests/Serialization/DeserializationTests.cs (3/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/Serialization/DeserializationTests.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/Serialization/DeserializationTests.cs", + "startLine": 241, + "endLine": 360, + "content": "HandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}\n\n\t/// \n\t/// Demonstrates a happy path with a schema.\n\t/// \n\t[Test]\n\tpublic void WithSchema_GoodValue()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": \"\"bartholomew\"\",\n \"\"Value\"\": 42\n}\";\n\n\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tHandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void WithSchema_MultipleDeserializations()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": \"\"bartholomew\"\",\n \"\"Value\"\": 42\n}\";\n\n\t\t\tfor (int i = 0; i < 10; i++)\n\t\t\t{\n\t\t\t\tvar options = new JsonSerializerOptions\n\t\t\t\t{\n\t\t\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\t\t\tWriteIndented = true,\n\t\t\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\t\t\t\tConverters = { new GenerativeValidatingJsonConverter { EvaluationOptions = { OutputFormat = OutputFormat.List } } }\n\t\t\t\t};\n\n\t\t\t\tvar model = JsonSerializer.Deserialize(jsonText, options);\n\n\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, options));\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tHandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void InaccessibleType_Valid()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n \"\"X\"\": 4,\n \"\"Y\"\": 5\n}\";\n\n\t\t\tvar options = new JsonSerializerOptions\n\t\t\t{\n\t\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\t\tWriteIndented = true,\n\t\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\t\t\tConverters = { new GenerativeValidatingJsonConverter { EvaluationOptions = { OutputFormat = OutputFormat.List } } }\n\t\t\t};\n\n\t\t\tvar model = JsonSerializer.Deserialize(jsonText, options);\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, options));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tHandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void InaccessibleType_Invalid()\n\t{\n\t\tAssert.Throws(() =>\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tvar jsonText = @\"{\n \"\"X\"\": \"\"string\"\",\n \"\"Y\"\": 5\n}\";\n\n\t\t\t\t\tvar options = new JsonSerializerOptions\n\t\t\t\t\t{\n\t\t\t\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\t\t\t\tWriteIndented = true,\n\t\t\t\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\t\t\t\t\tConverters = { new GenerativeValidatingJsonConverter { EvaluationOptions = { OutputFormat = OutputFormat.List } } }\n\t\t\t\t\t};\n\n\t\t\t\t\tvar model = JsonSerializer.Deserialize(jsonText, options);\n\n\t\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, options));\n\t\t\t\t}\n\t\t\t\tcatch (Exception e)\n\t\t\t\t{\n\t\t\t\t\tHandleException(e);\n\t\t\t\t\tAssert.That(e.Message, Is.EqualTo(\"JSON does not meet schema requirements\"));\n\t\t\t\t\tthrow;\n\t\t\t\t}", + "snippet": "HandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}\n\n\t/// \n\t/// Demonstrates a happy path with a schema.\n\t/// \n\t[Test]\n\tpublic void WithSchema_GoodValue()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": \"\"bartholomew\"\"" + }, + { + "title": "src/JsonSchema.Generation.Tests/Serialization/DeserializationTests.cs (4/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/Serialization/DeserializationTests.cs#L361-L379", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/Serialization/DeserializationTests.cs", + "startLine": 361, + "endLine": 379, + "content": "}\n\t\t);\n\t}\n\n\t/// \n\t/// The validation result is passed in the \n\t/// property under the `\"validation\"` key.\n\t/// \n\tprivate static void HandleException(Exception e)\n\t{\n\t\tTestConsole.WriteLine(e);\n\t\tTestConsole.WriteLine();\n\t\tif (e.Data.Contains(\"validation\"))\n\t\t{\n\t\t\tvar validation = (EvaluationResults)e.Data[\"validation\"]!;\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(validation, _options));\n\t\t}\n\t}\n}", + "snippet": "}\n\t\t);\n\t}\n\n\t/// \n\t/// The validation result is passed in the \n\t/// property under the `\"validation\"` key.\n\t/// \n\tprivate static void HandleException(Exception e)\n\t{\n\t\tTestCo" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/AlternateModels.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/AlternateModels.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/AlternateModels.cs", + "startLine": 1, + "endLine": 27, + "content": "using Json.Schema.Generation.Serialization;\n\nnamespace Json.Schema.Generation.Tests.SourceGeneration.AlternateNamespace;\n\npublic class AlternateModels\n{\n\t[GenerateJsonSchema]\n\tpublic class CrossNamespacePerson\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\tpublic int Age { get; set; }\n\t}\n}\n\n/// \n/// Outer class with the same name as TestModels in the main namespace,\n/// so that nested ConflictModel triggers name de-duplication.\n/// \npublic class TestModels\n{\n\t[GenerateJsonSchema]\n\tpublic class ConflictModel\n\t{\n\t\tpublic int Count { get; set; }\n\t}\n}", + "snippet": "using Json.Schema.Generation.Serialization;\n\nnamespace Json.Schema.Generation.Tests.SourceGeneration.AlternateNamespace;\n\npublic class AlternateModels\n{\n\t[GenerateJsonSchema]\n\tpublic class CrossNamespacePerson\n\t{\n\t\tpubli" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/ConverterRegistrationTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/ConverterRegistrationTests.cs#L1-L99", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/ConverterRegistrationTests.cs", + "startLine": 1, + "endLine": 99, + "content": "using System.Linq;\nusing System.Text.Json;\nusing Json.Schema.Generation.Serialization;\nusing NUnit.Framework;\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nnamespace Json.Schema.Generation.Tests.SourceGeneration;\n\npublic class ConverterRegistrationTests\n{\n\t[Test]\n\tpublic void GeneratedCode_ContainsRegistrationClass()\n\t{\n\t\tvar assembly = typeof(TestModels).Assembly;\n\t\tvar registrationType = assembly.GetTypes()\n\t\t\t.FirstOrDefault(t => t.Name == \"GeneratedSchemaRegistration\");\n\t\t\n\t\tAssert.That(registrationType, Is.Not.Null, \"GeneratedSchemaRegistration class should be generated\");\n\t}\n\n\t[Test]\n\tpublic void GeneratedCode_ContainsModuleInitializer()\n\t{\n\t\tvar assembly = typeof(TestModels).Assembly;\n\t\tvar registrationType = assembly.GetTypes()\n\t\t\t.FirstOrDefault(t => t.Name == \"GeneratedSchemaRegistration\");\n\t\t\n\t\tAssert.That(registrationType, Is.Not.Null);\n\t\t\n\t\tvar registerMethod = registrationType?.GetMethod(\"RegisterSchemas\", \n\t\t\tSystem.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);\n\t\t\n\t\tAssert.That(registerMethod, Is.Not.Null, \"RegisterSchemas method should exist\");\n\t\t\n\t\tvar moduleInitAttr = registerMethod?.GetCustomAttributes(false)\n\t\t\t.FirstOrDefault(a => a.GetType().Name == \"ModuleInitializerAttribute\");\n\t\t\n\t\tAssert.That(moduleInitAttr, Is.Not.Null, \"RegisterSchemas should have ModuleInitializer attribute\");\n\t}\n\n\t[Test]\n\tpublic void ConvertersAreRegistered_AfterModuleInitialization()\n\t{\n\t\tvar options = new JsonSerializerOptions{ TypeInfoResolverChain = { TestSerializerContext.Default } };\n\t\toptions.Converters.Add(new GenerativeValidatingJsonConverter());\n\t\t\n\t\tvar person = new TestModels.SimplePerson { Name = \"Alice\", Age = 30 };\n\t\tvar json = JsonSerializer.Serialize(person, options);\n\t\t\n\t\tAssert.That(json, Does.Contain(\"Alice\"));\n\t\t\n\t\tvar deserialized = JsonSerializer.Deserialize(json, options);\n\t\t\n\t\tAssert.That(deserialized, Is.Not.Null);\n\t\tAssert.That(deserialized!.Name, Is.EqualTo(\"Alice\"));\n\t\tAssert.That(deserialized.Age, Is.EqualTo(30));\n\t}\n\n\t[Test]\n\tpublic void InvalidJson_ThrowsWithValidation()\n\t{\n\t\tvar options = new JsonSerializerOptions { TypeInfoResolverChain = { TestSerializerContext.Default } };\n\t\toptions.Converters.Add(new GenerativeValidatingJsonConverter());\n\n\t\tvar invalidJson = \"\"\"{\"Name\": \"Bob\", \"Age\": \"not-a-number\"}\"\"\";\n\t\t\n\t\tAssert.Throws(() =>\n\t\t{\n\t\t\tJsonSerializer.Deserialize(invalidJson, options);\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void MultipleTypes_AllRegistered()\n\t{\n\t\tvar options = new JsonSerializerOptions\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tPropertyNameCaseInsensitive = true\n\t\t};\n\t\toptions.Converters.Add(new GenerativeValidatingJsonConverter());\n\n\t\t// Test SimplePerson (PascalCase properties)\n\t\tvar json1 = \"\"\"{\"Name\": \"Alice\", \"Age\": 30}\"\"\";\n\t\tvar deserialized1 = JsonSerializer.Deserialize(json1, options);\n\t\tAssert.That(deserialized1, Is.Not.Null);\n\t\tAssert.That(deserialized1!.Name, Is.EqualTo(\"Alice\"));\n\t\tAssert.That(deserialized1.Age, Is.EqualTo(30));\n\t\t\n\t\t// Test CamelCasePerson (camelCase properties as per schema attribute)\n\t\tvar json2 = \"\"\"{\"firstName\": \"Bob\", \"lastName\": \"Smith\", \"age\": 25}\"\"\";\n\t\tvar deserialized2 = JsonSerializer.Deserialize(json2, options);\n\t\tAssert.That(deserialized2, Is.Not.Null);\n\t\tAssert.That(deserialized2!.FirstName, Is.EqualTo(\"Bob\"));\n\t\tAssert.That(deserialized2.LastName, Is.EqualTo(\"Smith\"));\n\t\tAssert.That(deserialized2.Age, Is.EqualTo(25));\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json;\nusing Json.Schema.Generation.Serialization;\nusing NUnit.Framework;\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nnamespace Json.Sche" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/CustomEmitterAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/CustomEmitterAttributes.cs#L1-L108", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/CustomEmitterAttributes.cs", + "startLine": 1, + "endLine": 108, + "content": "using System;\n\nnamespace Json.Schema.Generation.Tests.SourceGeneration;\n\n/// \n/// Example custom attribute demonstrating extensibility for source generation.\n/// Users can create attributes like this that implement IAttributeHandler\n/// and provide their own schema builder logic via a static Apply method.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)]\npublic class CustomFormatAttribute : Attribute, IAttributeHandler\n{\n\tpublic string FormatName { get; }\n\n\tpublic CustomFormatAttribute(string formatName)\n\t{\n\t\tFormatName = formatName;\n\t}\n\n\t/// \n\t/// This static method is called by the generated code to apply schema constraints.\n\t/// The method signature must match: static JsonSchemaBuilder Apply(JsonSchemaBuilder builder, [constructor_args...])\n\t/// \n\tpublic static JsonSchemaBuilder Apply(JsonSchemaBuilder builder, string formatName)\n\t{\n\t\treturn builder.Format(new Format(formatName));\n\t}\n\n\t/// \n\t/// Runtime handler method (not used by source generator).\n\t/// \n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\t// Runtime implementation not needed for source generation\n\t}\n}\n\n[SchemaHandler(typeof(TestModels.Optional<>))]\npublic static class OptionalSchemaHandler\n{\n\tpublic static JsonSchemaBuilder Apply(this JsonSchemaBuilder builder, Type type)\n\t{\n\t\tvar innerType = type.GetGenericArguments()[0];\n\t\tif (innerType.IsGenericType && innerType.GetGenericTypeDefinition() == typeof(Nullable<>))\n\t\t\treturn builder.BuildForType(innerType);\n\n\t\tbuilder.AnyOf(\n\t\t\tnew JsonSchemaBuilder().BuildForType(innerType),\n\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Null)\n\t\t);\n\n\t\treturn builder;\n\t}\n}\n\n/// \n/// Another example showing a numeric constraint attribute.\n/// \n[AttributeUsage(AttributeTargets.Property)]\npublic class PositiveNumberAttribute : Attribute, IAttributeHandler\n{\n\t/// \n\t/// Applies minimum and exclusiveMinimum constraints of 0.\n\t/// \n\tpublic static JsonSchemaBuilder Apply(JsonSchemaBuilder builder)\n\t{\n\t\treturn builder.Minimum(0).ExclusiveMinimum(0);\n\t}\n\n\t/// \n\t/// Runtime handler method (not used by source generator).\n\t/// \n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\t// Runtime implementation not needed for source generation\n\t}\n}\n\n/// \n/// Example with multiple parameters.\n/// \n[AttributeUsage(AttributeTargets.Property)]\npublic class RangeAttribute : Attribute, IAttributeHandler\n{\n\tpublic double Min { get; }\n\tpublic double Max { get; }\n\n\tpublic RangeAttribute(double min, double max)\n\t{\n\t\tMin = min;\n\t\tMax = max;\n\t}\n\n\tpublic static JsonSchemaBuilder Apply(JsonSchemaBuilder builder, decimal min, decimal max)\n\t{\n\t\treturn builder.Minimum(min).Maximum(max);\n\t}\n\n\t/// \n\t/// Runtime handler method (not used by source generator).\n\t/// \n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\t// Runtime implementation not needed for source generation\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation.Tests.SourceGeneration;\n\n/// \n/// Example custom attribute demonstrating extensibility for source generation.\n/// Users can create attributes like this that implem" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs (1/12)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable UnusedVariable\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nnamespace Json.Schema.Generation.Tests.SourceGeneration;\n\npublic class SourceGeneratorTests\n{\n\t[Test]\n\tpublic void SimplePerson_GeneratesSchema()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t \"Age\": { \"type\": \"integer\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_SimplePerson;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void CamelCasePerson_UsesCamelCase()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.CamelCasePerson\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"firstName\": { \"type\": \"string\" },\n\t\t \"lastName\": { \"type\": \"string\" },\n\t\t \"age\": { \"type\": \"integer\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_CamelCasePerson;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void NestedTypeOfCamelCaseModel_UsesCamelCase()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.NestedType\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"externalId\": { \"type\": \"string\" },\n\t\t \"displayName\": { \"type\": \"string\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_NestedType;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithNullable_AllowsNull()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNullable\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t \"Email\": { \"type\": [\"null\", \"string\"] },\n\t\t \"Age\": { \"type\": [\"null\", \"integer\"] }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_PersonWithNullable;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithRequired_MarksRequired()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithRequired\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t \"Age\": { \"type\": \"integer\" }\n\t\t },\n\t\t \"required\": [\"Name\"]\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_PersonWithRequired;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithEnum_HasEnumValues()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing NUnit.Framework;\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n// ReSharper disable UnusedVariable\n#pragma warning disable CS1591 " + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs (2/12)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs", + "startLine": 121, + "endLine": 240, + "content": "\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t\t\"Status\": { \"$ref\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.Status\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_PersonWithEnum;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithNullableEnumArray_AllowsNull()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithNullableEnumArray\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"styles\": {\n\t\t \"type\": [\"null\", \"array\"],\n\t\t \"items\": {\n\t\t\t\t \"$ref\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ContentStyle\"\n\t\t }\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithNullableEnumArray;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithDescription_HasDescriptions()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDescription\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": {\n\t\t \"type\": \"string\",\n\t\t \"description\": \"The person's full name\"\n\t\t },\n\t\t \"Age\": {\n\t\t \"type\": \"integer\",\n\t\t \"description\": \"The person's age in years\"\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_PersonWithDescription;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ProductWithCustomAttributes_AppliesCustomEmitters()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ProductWithCustomAttributes\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t \"Price\": {\n\t\t \"type\": \"number\",\n\t\t \"minimum\": 0,\n\t\t \"exclusiveMinimum\": 0\n\t\t },\n\t\t \"DiscountPercentage\": {\n\t\t \"type\": \"integer\",\n\t\t \"minimum\": 0,\n\t\t \"maximum\": 100\n\t\t },\n\t\t \"Description\": { \"type\": [\"null\", \"string\"] }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ProductWithCustomAttributes;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithGuidArrayAndMinItems_EmitsArrayOfUuid()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithGuidArrayAndMinItems\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"recipientIds\": {\n\t\t \"type\": \"array\",\n\t\t \"items\": {\n\t\t \"type\": \"string\",\n\t\t \"format\": \"uuid\"\n\t\t },\n\t\t \"minItems\": 1\n\t\t }\n\t\t },\n\t\t \"required\": [\"recipientIds\"]\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithGuidArrayAndMinItems;\n\n\t\tAssertEqual(expected, actual);", + "snippet": "\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithEnum\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"t" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs (3/12)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs", + "startLine": 241, + "endLine": 360, + "content": "}\n\n\t[Test]\n\tpublic void PersonWithAddresses_UsesDefsAndRefs()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithAddresses\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t \"HomeAddress\": {\n\t\t \"description\": \"Home address\",\n\t\t \"anyOf\": [\n\t\t\t\t{ \"$ref\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address\" },\n\t\t { \"type\": \"null\" }\n\t\t ]\n\t\t },\n\t\t \"WorkAddress\": {\n\t\t \"description\": \"Work address\",\n\t\t \"anyOf\": [\n\t\t\t\t{ \"$ref\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.Address\" },\n\t\t { \"type\": \"null\" }\n\t\t ]\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_PersonWithAddresses;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithId_UsesCustomId()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"https://json-everything.test/schemas/person\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t \"Age\": { \"type\": \"integer\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_PersonWithId;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithIdReference_UsesCustomIdInRef()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithIdReference\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t \"Person\": {\n\t\t \"anyOf\": [\n\t\t { \"$ref\": \"https://json-everything.test/schemas/person\" },\n\t\t { \"type\": \"null\" }\n\t\t ]\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_PersonWithIdReference;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithJsonRequired_MarksRequired()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithJsonRequired\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t \"Age\": { \"type\": \"integer\" }\n\t\t },\n\t\t \"required\": [\"Age\"]\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_PersonWithJsonRequired;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithDefaults_EmitsDefaultValues()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithDefaults\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\", \"default\": \"anonymous\" },\n\t\t \"Age\": { \"type\": \"integer\", \"default\": 0 },\n\t\t \"IsActive\": { \"type\": \"boolean\", \"default\": true }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_PersonWithDefaults;\n\t\t\n\t\tAssertEqual(expected, actual);", + "snippet": "}\n\n\t[Test]\n\tpublic void PersonWithAddresses_UsesDefsAndRefs()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceG" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs (4/12)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs", + "startLine": 361, + "endLine": 480, + "content": "}\n\n\t[Test]\n\tpublic void PersonWithNoAdditionalProperties_EmitsAdditionalProperties()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.PersonWithNoAdditionalProperties\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t \"Age\": { \"type\": \"integer\" }\n\t\t },\n\t\t \"additionalProperties\": false\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_PersonWithNoAdditionalProperties;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithMultipleClosedGenerics_UsesDistinctRefs()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithMultipleClosedGenerics\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"IntHolder\": {\n\t\t \"anyOf\": [\n\t\t\t\t{ \"$ref\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder-int\" },\n\t\t { \"type\": \"null\" }\n\t\t ]\n\t\t },\n\t\t \"StringHolder\": {\n\t\t \"anyOf\": [\n\t\t\t\t{ \"$ref\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder-string\" },\n\t\t { \"type\": \"null\" }\n\t\t ]\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithMultipleClosedGenerics;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void GenericHolderInt_GeneratesSchema()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder-int\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Value\": { \"type\": \"integer\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_GenericHolderOfInt32;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void GenericHolderString_GeneratesSchema()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.GenericHolder-string\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Value\": { \"type\": \"string\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_GenericHolderOfString;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithOptionalWrapper_UsesSchemaHandlerForWrappedType()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithOptionalWrapper\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Age\": { \n\t\t \"anyOf\":[\n\t\t {\"type\":\"integer\"},\n\t\t {\"type\":\"null\"}\n\t\t ]\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithOptionalWrapper;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithOptionalObjectWrapper_UsesRefForGeneratedType()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{", + "snippet": "}\n\n\t[Test]\n\tpublic void PersonWithNoAdditionalProperties_EmitsAdditionalProperties()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.G" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs (5/12)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs", + "startLine": 481, + "endLine": 600, + "content": "\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithOptionalObjectWrapper\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Person\": {\n\t\t \"anyOf\":[\n\t\t\t\t {\"$ref\":\"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.SimplePerson\"},\n\t\t {\"type\":\"null\"}\n\t\t ]\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithOptionalObjectWrapper;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithOptionalCollections_ContinuesWithGenerated()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithOptionalCollections\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"ValueA\": {\n\t\t \"anyOf\":[\n\t\t\t\t {\"$ref\":\"urn:jsonschema:array-int\"},\n\t\t {\"type\":\"null\"}\n\t\t ]\n\t\t },\n\t\t \"ValueB\": {\n\t\t \"anyOf\":[\n\t\t\t\t {\"$ref\":\"urn:jsonschema:array-int\"},\n\t\t {\"type\":\"null\"}\n\t\t ]\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithOptionalCollections;\n\t\tvar enumerableParameter = GeneratedJsonSchemas.IEnumerableOfInt32;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithOptionalDictionary_ContinuesWithGenerated()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithOptionalDictionary\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Data\": {\n\t\t \"anyOf\":[\n\t\t\t\t {\"$ref\":\"urn:jsonschema:object-string-int\"},\n\t\t {\"type\":\"null\"}\n\t\t ]\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithOptionalDictionary;\n\t\tvar dictionaryParameter = GeneratedJsonSchemas.DictionaryOfStringAndInt32;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithOptionalAdditionalCollections_ContinuesWithGenerated()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithOptionalAdditionalCollections\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"ValueA\": {\n\t\t \"anyOf\":[\n\t\t\t\t {\"$ref\":\"urn:jsonschema:array-int\"},\n\t\t {\"type\":\"null\"}\n\t\t ]\n\t\t },\n\t\t \"ValueB\": {\n\t\t \"anyOf\":[\n\t\t\t\t {\"$ref\":\"urn:jsonschema:array-int\"},\n\t\t {\"type\":\"null\"}\n\t\t ]\n\t\t },\n\t\t \"ValueC\": {\n\t\t \"anyOf\":[\n\t\t\t\t {\"$ref\":\"urn:jsonschema:array-int\"},\n\t\t {\"type\":\"null\"}\n\t\t ]\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithOptionalAdditionalCollections;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithOptionalUngeneratedType_ContinuesWithGenerated()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithOptionalUngeneratedType\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {", + "snippet": "\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithOptionalObjectWrapper\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs (6/12)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs", + "startLine": 601, + "endLine": 720, + "content": "\"Ungenerated\": {\n\t\t \"anyOf\":[\n\t\t\t\t {\"$ref\":\"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.UngeneratedType\"},\n\t\t {\"type\":\"null\"}\n\t\t ]\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithOptionalUngeneratedType;\n\t\tvar parameter = GeneratedJsonSchemas.TestModels_UngeneratedType;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void BuildForType_UsesSchemaHandlerForOpenGenericType()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"anyOf\":[\n\t\t {\"type\":\"string\"},\n\t\t {\"type\":\"null\"}\n\t\t ]\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = new JsonSchemaBuilder()\n\t\t\t.BuildForType(typeof(TestModels.Optional))\n\t\t\t.Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void BuildForType_Array_UsesGeneratedSchema()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$ref\": \"urn:jsonschema:array-int\"\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = new JsonSchemaBuilder()\n\t\t\t.BuildForType(typeof(int[]))\n\t\t\t.Build();\n\t\tvar parameter = GeneratedJsonSchemas.IEnumerableOfInt32;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void BuildForType_Dictionary_UsesGeneratedSchema()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$ref\": \"urn:jsonschema:object-string-int\"\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = new JsonSchemaBuilder()\n\t\t\t.BuildForType(typeof(Dictionary))\n\t\t\t.Build();\n\t\tvar parameter = GeneratedJsonSchemas.DictionaryOfStringAndInt32;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void BuildForType_NullableGuid_EmitsNullableStringUuid()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"type\": [\"null\", \"string\"],\n\t\t \"format\": \"uuid\"\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = new JsonSchemaBuilder()\n\t\t\t.BuildForType(typeof(Guid?))\n\t\t\t.Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void BuildForType_UsesSchemaForGeneratedTypeInAnotherNamespace()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$ref\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.AlternateNamespace.AlternateModels.CrossNamespacePerson\"\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = new JsonSchemaBuilder()\n\t\t\t.BuildForType(typeof(AlternateNamespace.AlternateModels.CrossNamespacePerson))\n\t\t\t.Build();\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void CentralGeneratedSchemasClass_ContainsSchemasFromAnotherNamespace()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.AlternateNamespace.AlternateModels.CrossNamespacePerson\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t \"Age\": { \"type\": \"integer\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.AlternateModels_CrossNamespacePerson;\n\n\t\tAssertEqual(expected, actual);", + "snippet": "\"Ungenerated\": {\n\t\t \"anyOf\":[\n\t\t\t\t {\"$ref\":\"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.UngeneratedType\"},\n\t\t {\"type\":\"null\"}\n\t\t ]\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = J" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs (7/12)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs#L721-L840", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs", + "startLine": 721, + "endLine": 840, + "content": "}\n\n\t[Test]\n\tpublic void ConflictingNames_AreDisambiguatedWithNamespacePrefix()\n\t{\n\t\t// Both TestModels.ConflictModel classes produce the same raw SchemaPropertyName\n\t\t// (\"TestModels_ConflictModel\"). The generator must prefix each with its\n\t\t// relative namespace so both can coexist in GeneratedJsonSchemas.\n\t\tvar expectedMain = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConflictModel\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Value\": { \"type\": \"string\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expectedAlt = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.AlternateNamespace.TestModels.ConflictModel\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Count\": { \"type\": \"integer\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\n\t\tvar registry = new SchemaRegistry();\n\t\tAssertEqual(\n\t\t\tJsonSchema.FromText(expectedMain, new BuildOptions { SchemaRegistry = registry }),\n\t\t\tGeneratedJsonSchemas.SourceGeneration_TestModels_ConflictModel);\n\t\tAssertEqual(\n\t\t\tJsonSchema.FromText(expectedAlt, new BuildOptions { SchemaRegistry = registry }),\n\t\t\tGeneratedJsonSchemas.SourceGeneration_AlternateNamespace_TestModels_ConflictModel);\n\t}\n\n\t[Test]\n\tpublic void NullableGenericArguments_GenerateDistinctSchemaMembers()\n\t{\n\t\tAssert.That(GeneratedJsonSchemas.TestModels_OptionalOfGuid, Is.Not.Null);\n\t\tAssert.That(GeneratedJsonSchemas.TestModels_OptionalOfGuidNullable, Is.Not.Null);\n\t}\n\n\t[Test]\n\tpublic void GeneratedSchemaForHandledWrapper_UsesHandlerOutput()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.Optional-int\",\n\t\t \"anyOf\":[\n\t\t {\"type\":\"integer\"},\n\t\t {\"type\":\"null\"}\n\t\t ]\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_OptionalOfInt32;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithBuiltInJsonTypes_UsesExpectedSchemas()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithBuiltInJsonTypes\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Document\": {},\n\t\t \"Element\": {},\n\t\t \"Node\": {},\n\t\t \"Value\": {},\n\t\t \"Object\": { \"type\": \"object\" },\n\t\t \"Array\": { \"type\": \"array\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithBuiltInJsonTypes;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void BuildForType_MapsBuiltInJsonTypes()\n\t{\n\t\tvar anySchema = JsonSchema.FromText(\"{}\", new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar objectSchema = JsonSchema.FromText(\"\"\"{ \"type\": \"object\" }\"\"\", new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar arraySchema = JsonSchema.FromText(\"\"\"{ \"type\": \"array\" }\"\"\", new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\n\t\tAssertEqual(anySchema, new JsonSchemaBuilder().BuildForType(typeof(System.Text.Json.JsonDocument)).Build());\n\t\tAssertEqual(anySchema, new JsonSchemaBuilder().BuildForType(typeof(System.Text.Json.JsonElement)).Build());\n\t\tAssertEqual(anySchema, new JsonSchemaBuilder().BuildForType(typeof(System.Text.Json.Nodes.JsonNode)).Build());\n\t\tAssertEqual(anySchema, new JsonSchemaBuilder().BuildForType(typeof(System.Text.Json.Nodes.JsonValue)).Build());\n\t\tAssertEqual(objectSchema, new JsonSchemaBuilder().BuildForType(typeof(System.Text.Json.Nodes.JsonObject)).Build());\n\t\tAssertEqual(arraySchema, new JsonSchemaBuilder().BuildForType(typeof(System.Text.Json.Nodes.JsonArray)).Build());\n\t}\n\n\t[Test]\n\tpublic void ModelWithStringKeyDictionary_UsesAdditionalProperties()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithStringKeyDictionary\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Data\": {\n\t\t \"type\": \"object\",\n\t\t \"additionalProperties\": { \"type\": \"integer\" }\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });", + "snippet": "}\n\n\t[Test]\n\tpublic void ConflictingNames_AreDisambiguatedWithNamespacePrefix()\n\t{\n\t\t// Both TestModels.ConflictModel classes produce the same raw SchemaPropertyName\n\t\t// (\"TestModels_ConflictModel\"). The generator must p" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs (8/12)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs#L841-L960", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs", + "startLine": 841, + "endLine": 960, + "content": "var actual = GeneratedJsonSchemas.TestModels_ModelWithStringKeyDictionary;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithEnumKeyDictionary_UsesPropertyNamesAndAdditionalProperties()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithEnumKeyDictionary\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Flags\": {\n\t\t \"type\": \"object\",\n\t\t\t\"propertyNames\": { \"$ref\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.Status\" },\n\t\t \"additionalProperties\": { \"type\": \"boolean\" }\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithEnumKeyDictionary;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithGuidKeyDictionary_UsesGuidPropertyNamesAndAdditionalProperties()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithGuidKeyDictionary\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Data\": {\n\t\t \"type\": \"object\",\n\t\t \"propertyNames\": { \"type\": \"string\", \"format\": \"uuid\" },\n\t\t \"additionalProperties\": { \"type\": \"integer\" }\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithGuidKeyDictionary;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void NullableAttribute_OverridesTypeNullability()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithNullableOverrides\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"ForcedNullable\": { \"type\": [\"null\", \"string\"], \"description\": \"Force-nullable non-nullable string.\" },\n\t\t \"ForcedNonNullable\": { \"type\": \"integer\", \"description\": \"Force-non-nullable nullable int.\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithNullableOverrides;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void DuplicateMappedPropertyNames_DoNotBreakSchemaGeneration()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ModelWithDuplicateSchemaPropertyNames\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"foo\": { \"type\": \"integer\" }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ModelWithDuplicateSchemaPropertyNames;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void SingleCondition_GeneratesIfThen()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleCondition\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Toggle\": { \"type\": \"boolean\" },\n\t\t \"Required\": { \"type\": [\"null\", \"string\"] }\n\t\t },\n\t\t \"required\": [\"Toggle\"],\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"Toggle\": { \"const\": true }\n\t\t },\n\t\t \"required\": [\"Toggle\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"Required\"]\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_SingleCondition;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}", + "snippet": "var actual = GeneratedJsonSchemas.TestModels_ModelWithStringKeyDictionary;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ModelWithEnumKeyDictionary_UsesPropertyNamesAndAdditionalProperties()\n\t{\n\t\tvar expecte" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs (9/12)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs#L961-L1080", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs", + "startLine": 961, + "endLine": 1080, + "content": "[Test]\n\tpublic void SingleConditionCamelCase_HonorsNamingConvention()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.SingleConditionCamelCase\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"toggle\": { \"type\": \"boolean\" },\n\t\t \"required\": { \"type\": [\"null\", \"string\"] }\n\t\t },\n\t\t \"required\": [\"toggle\"],\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"toggle\": { \"const\": true }\n\t\t },\n\t\t \"required\": [\"toggle\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"required\"]\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_SingleConditionCamelCase;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void MultipleConditionGroups_GeneratesMultipleIfThen()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleConditionGroups\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Toggle\": { \"type\": \"boolean\" },\n\t\t \"OtherToggle\": { \"type\": \"integer\" },\n\t\t \"RequiredIfToggle\": { \"type\": [\"null\", \"string\"] },\n\t\t \"RequiredIfOtherToggle\": { \"type\": [\"null\", \"string\"] }\n\t\t },\n\t\t \"required\": [\"Toggle\", \"OtherToggle\"],\n\t\t \"allOf\": [\n\t\t {\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"Toggle\": { \"const\": true }\n\t\t },\n\t\t \"required\": [\"Toggle\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"RequiredIfToggle\"]\n\t\t }\n\t\t },\n\t\t {\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"OtherToggle\": { \"const\": 42 }\n\t\t },\n\t\t \"required\": [\"OtherToggle\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"RequiredIfOtherToggle\"]\n\t\t }\n\t\t }\n\t\t ]\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_MultipleConditionGroups;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void MultipleTriggersInSameGroup_CombinesTriggers()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleTriggersInSameGroup\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Count\": { \"type\": \"integer\" },\n\t\t \"Name\": { \"type\": \"string\" },\n\t\t \"SpecialField\": { \"type\": [\"null\", \"string\"] }\n\t\t },\n\t\t \"required\": [\"Count\", \"Name\"],\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"Count\": { \"const\": 1 },\n\t\t \"Name\": { \"const\": \"special\" }\n\t\t },\n\t\t \"required\": [\"Count\", \"Name\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"SpecialField\"]\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_MultipleTriggersInSameGroup;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void MultipleIfsSamePropertyAndGroup_CombinesToSinglePropertyTrigger()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleIfsSamePropertyAndGroup\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Status\": { \"$ref\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.Status\" },\n\t\t \"Note\": {", + "snippet": "[Test]\n\tpublic void SingleConditionCamelCase_HonorsNamingConvention()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs (10/12)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs#L1081-L1200", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs", + "startLine": 1081, + "endLine": 1200, + "content": "\"type\": [\"null\", \"string\"]\n\t\t }\n\t\t },\n\t\t \"required\": [\"Status\"],\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"Status\": {\n\t\t \"enum\": [\"Active\", \"Pending\"]\n\t\t }\n\t\t },\n\t\t \"required\": [\"Status\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"Note\"]\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_MultipleIfsSamePropertyAndGroup;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void MultipleIfsSamePropertyAcrossGroups_GeneratesWithoutDuplicateIfProperties()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.MultipleIfsSamePropertyAcrossGroups\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Status\": { \"$ref\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.Status\" },\n\t\t \"JobListingId\": {\n\t\t \"type\": [\"null\", \"string\"],\n\t\t \"format\": \"uuid\"\n\t\t },\n\t\t \"OrgId\": {\n\t\t \"type\": [\"null\", \"string\"],\n\t\t \"format\": \"uuid\"\n\t\t }\n\t\t },\n\t\t \"required\": [\"Status\"],\n\t\t \"allOf\": [\n\t\t {\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"Status\": {\n\t\t \"enum\": [\"Active\", \"Pending\"]\n\t\t }\n\t\t },\n\t\t \"required\": [\"Status\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"JobListingId\"]\n\t\t }\n\t\t },\n\t\t {\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"Status\": {\n\t\t \"const\": \"Inactive\"\n\t\t }\n\t\t },\n\t\t \"required\": [\"Status\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"OrgId\"]\n\t\t }\n\t\t }\n\t\t ]\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_MultipleIfsSamePropertyAcrossGroups;\n\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ConditionalWithMinimum_GeneratesMinimumTrigger()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMinimum\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Age\": { \"type\": \"integer\" },\n\t\t \"AdultField\": { \"type\": [\"null\", \"string\"] }\n\t\t },\n\t\t \"required\": [\"Age\"],\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"Age\": { \"minimum\": 18 }\n\t\t },\n\t\t \"required\": [\"Age\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"AdultField\"]\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ConditionalWithMinimum;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ConditionalWithMaximum_GeneratesMaximumTrigger()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalWithMaximum\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Score\": { \"type\": \"integer\" },\n\t\t \"BonusEligible\": { \"type\": [\"null\", \"string\"] }", + "snippet": "\"type\": [\"null\", \"string\"]\n\t\t }\n\t\t },\n\t\t \"required\": [\"Status\"],\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"Status\": {\n\t\t \"enum\": [\"Active\", \"Pending\"]\n\t\t }\n\t\t },\n\t\t \"required\": [\"Status\"]\n\t\t },\n\t" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs (11/12)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs#L1201-L1320", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs", + "startLine": 1201, + "endLine": 1320, + "content": "},\n\t\t \"required\": [\"Score\"],\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"Score\": { \"maximum\": 100 }\n\t\t },\n\t\t \"required\": [\"Score\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"BonusEligible\"]\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ConditionalWithMaximum;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void EnumSwitch_GeneratesConditionPerEnumValue()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.EnumSwitch\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"Day\": { \"$ref\": \"urn:jsonschema:System.DayOfWeek\" },\n\t\t \"MondayField\": { \"type\": [\"null\", \"string\"] },\n\t\t \"TuesdayField\": { \"type\": [\"null\", \"string\"] }\n\t\t },\n\t\t \"required\": [\"Day\"],\n\t\t \"allOf\": [\n\t\t {\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"Day\": { \"const\": \"Monday\" }\n\t\t },\n\t\t \"required\": [\"Day\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"MondayField\"]\n\t\t }\n\t\t },\n\t\t {\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"Day\": { \"const\": \"Tuesday\" }\n\t\t },\n\t\t \"required\": [\"Day\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"TuesdayField\"]\n\t\t }\n\t\t }\n\t\t ]\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_EnumSwitch;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void ConditionalValidation_EmitsValidationInThenClause()\n\t{\n\t\tvar expectedJson = \"\"\"\n\t\t{\n\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t \"$id\": \"urn:jsonschema:Json.Schema.Generation.Tests.SourceGeneration.TestModels.ConditionalValidation\",\n\t\t \"type\": \"object\",\n\t\t \"properties\": {\n\t\t \"IsActive\": { \"type\": \"boolean\" },\n\t\t \"Name\": { \"type\": [\"null\", \"string\"] },\n\t\t \"Age\": { \"type\": [\"null\", \"integer\"] }\n\t\t },\n\t\t \"required\": [\"IsActive\"],\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"IsActive\": { \"const\": true }\n\t\t },\n\t\t \"required\": [\"IsActive\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"properties\": {\n\t\t \"Name\": {\n\t\t \"minLength\": 5,\n\t\t \"maxLength\": 100\n\t\t },\n\t\t \"Age\": {\n\t\t \"minimum\": 0,\n\t\t \"maximum\": 150\n\t\t }\n\t\t }\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar expected = JsonSchema.FromText(expectedJson, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ConditionalValidation;\n\t\t\n\t\tAssertEqual(expected, actual);\n\t}\n\n\t[Test]\n\tpublic void PersonWithSortedProperties_SortsPropertiesByName()\n\t{\n\t\tvar actual = GeneratedJsonSchemas.TestModels_PersonWithSortedProperties;\n\t\t\n\t\t// Use Root.Source to get the JSON element\n\t\tvar propertiesElement = actual.Root.Source.GetProperty(\"properties\");\n\t\t\n\t\tvar propertyNames = propertiesElement.EnumerateObject().Select(p => p.Name).ToList();\n\t\t\n\t\t// Properties should be sorted alphabetically: Age, City, Email, Name\n\t\tAssert.That(propertyNames.Count, Is.EqualTo(4));\n\t\tAssert.That(propertyNames[0], Is.EqualTo(\"Age\"));\n\t\tAssert.That(propertyNames[1], Is.EqualTo(\"City\"));\n\t\tAssert.That(propertyNames[2], Is.EqualTo(\"Email\"));", + "snippet": "},\n\t\t \"required\": [\"Score\"],\n\t\t \"if\": {\n\t\t \"properties\": {\n\t\t \"Score\": { \"maximum\": 100 }\n\t\t },\n\t\t \"required\": [\"Score\"]\n\t\t },\n\t\t \"then\": {\n\t\t \"required\": [\"BonusEligible\"]\n\t\t }\n\t\t}\n\t\t\"\"\";\n\t\tvar exp" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs (12/12)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs#L1321-L1407", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/SourceGeneratorTests.cs", + "startLine": 1321, + "endLine": 1407, + "content": "Assert.That(propertyNames[3], Is.EqualTo(\"Name\"));\n\t}\n\n\t[Test]\n\tpublic void StrictConditionalValidation_ExcludesConditionalPropertiesFromGlobalScope()\n\t{\n\t\tvar actual = GeneratedJsonSchemas.TestModels_StrictConditionalValidation;\n\t\t\n\t\t// In strict mode, properties with conditional constraints should NOT be in global properties\n\t\tvar propertiesElement = actual.Root.Source.GetProperty(\"properties\");\n\t\tvar propertyNames = propertiesElement.EnumerateObject().Select(p => p.Name).ToList();\n\t\t\n\t\t// Only IsActive should be in global properties, not Name or Age\n\t\tAssert.That(propertyNames.Count, Is.EqualTo(1));\n\t\tAssert.That(propertyNames[0], Is.EqualTo(\"IsActive\"));\n\t}\n\n\t[Test]\n\tpublic void StrictConditionalValidation_UsesUnevaluatedProperties()\n\t{\n\t\tvar actual = GeneratedJsonSchemas.TestModels_StrictConditionalValidation;\n\t\t\n\t\t// In strict mode, should use unevaluatedProperties instead of additionalProperties\n\t\tAssert.That(actual.Root.Source.TryGetProperty(\"unevaluatedProperties\", out var unevaluatedProps), Is.True);\n\t\tAssert.That(unevaluatedProps.GetBoolean(), Is.False);\n\t\t\n\t\t// Should NOT have additionalProperties\n\t\tAssert.That(actual.Root.Source.TryGetProperty(\"additionalProperties\", out _), Is.False);\n\t}\n\n\t[Test]\n\tpublic void StrictConditionalValidation_EmitsFullPropertySchemasInThenClause()\n\t{\n\t\tvar actual = GeneratedJsonSchemas.TestModels_StrictConditionalValidation;\n\t\t\n\t\t// Get the if/then structure\n\t\tvar ifElement = actual.Root.Source.GetProperty(\"if\");\n\t\tvar thenElement = actual.Root.Source.GetProperty(\"then\");\n\t\t\n\t\t// Then clause should have properties with full schemas\n\t\tvar thenProperties = thenElement.GetProperty(\"properties\");\n\t\t\n\t\t// Name and Age should be in then clause\n\t\tAssert.That(thenProperties.TryGetProperty(\"Name\", out var nameSchema), Is.True);\n\t\tAssert.That(thenProperties.TryGetProperty(\"Age\", out var ageSchema), Is.True);\n\t\t\n\t\t// Name should have type definition (full schema)\n\t\tAssert.That(nameSchema.TryGetProperty(\"type\", out var nameType), Is.True);\n\t\t\n\t\t// Age should have type definition (full schema)\n\t\tAssert.That(ageSchema.TryGetProperty(\"type\", out var ageType), Is.True);\n\t\t\n\t\t// Name should have conditional constraints\n\t\tAssert.That(nameSchema.TryGetProperty(\"minLength\", out var minLength), Is.True);\n\t\tAssert.That(minLength.GetInt32(), Is.EqualTo(5));\n\t\tAssert.That(nameSchema.TryGetProperty(\"maxLength\", out var maxLength), Is.True);\n\t\tAssert.That(maxLength.GetInt32(), Is.EqualTo(100));\n\t\t\n\t\t// Age should have conditional constraints\n\t\tAssert.That(ageSchema.TryGetProperty(\"minimum\", out var minimum), Is.True);\n\t\tAssert.That(minimum.GetInt32(), Is.EqualTo(0));\n\t\tAssert.That(ageSchema.TryGetProperty(\"maximum\", out var maximum), Is.True);\n\t\tAssert.That(maximum.GetInt32(), Is.EqualTo(150));\n\t}\n\n\t[Test]\n\tpublic void ConditionalValidation_NonStrict_IncludesPropertiesGlobally()\n\t{\n\t\tvar actual = GeneratedJsonSchemas.TestModels_ConditionalValidation;\n\t\t\n\t\t// In non-strict mode (default), all properties should be in global properties\n\t\tvar propertiesElement = actual.Root.Source.GetProperty(\"properties\");\n\t\tvar propertyNames = propertiesElement.EnumerateObject().Select(p => p.Name).ToList();\n\t\t\n\t\t// All three properties should be present: IsActive, Name, Age\n\t\tAssert.That(propertyNames.Count, Is.EqualTo(3));\n\t\tAssert.That(propertyNames, Does.Contain(\"IsActive\"));\n\t\tAssert.That(propertyNames, Does.Contain(\"Name\"));\n\t\tAssert.That(propertyNames, Does.Contain(\"Age\"));\n\t\t\n\t\t// In non-strict mode, should not have unevaluatedProperties or additionalProperties\n\t\tAssert.That(actual.Root.Source.TryGetProperty(\"unevaluatedProperties\", out _), Is.False);\n\t\tAssert.That(actual.Root.Source.TryGetProperty(\"additionalProperties\", out _), Is.False);\n\t}\n}", + "snippet": "Assert.That(propertyNames[3], Is.EqualTo(\"Name\"));\n\t}\n\n\t[Test]\n\tpublic void StrictConditionalValidation_ExcludesConditionalPropertiesFromGlobalScope()\n\t{\n\t\tvar actual = GeneratedJsonSchemas.TestModels_StrictConditionalVa" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs (1/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Generation.Serialization;\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nnamespace Json.Schema.Generation.Tests.SourceGeneration;\n\npublic static class TestModels\n{\n\t[GenerateJsonSchema]\n\tpublic class SimplePerson\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\tpublic int Age { get; set; }\n\t}\n\n\t[GenerateJsonSchema(PropertyNaming = NamingConvention.CamelCase)]\n\tpublic class CamelCasePerson\n\t{\n\t\tpublic string FirstName { get; set; } = string.Empty;\n\t\tpublic string LastName { get; set; } = string.Empty;\n\t\tpublic int Age { get; set; }\n\t}\n\n\t[GenerateJsonSchema(PropertyNaming = NamingConvention.CamelCase)]\n\tpublic class CamelCaseWithNestedType\n\t{\n\t\tpublic NestedType Nested { get; set; } = new();\n\t}\n\n\tpublic class NestedType\n\t{\n\t\tpublic string ExternalId { get; set; } = string.Empty;\n\t\tpublic string DisplayName { get; set; } = string.Empty;\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithNullable\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\tpublic string? Email { get; set; }\n\t\tpublic int? Age { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithRequired\n\t{\n\t\tpublic required string Name { get; set; }\n\t\tpublic int Age { get; set; }\n\t}\n\n\tpublic enum Status\n\t{\n\t\tActive,\n\t\tInactive,\n\t\tPending\n\t}\n\n\tpublic enum ContentStyle\n\t{\n\t\tConfident,\n\t\tPassionate,\n\t\tEngaging,\n\t\tPractical,\n\t\tHumorous\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithEnum\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\tpublic Status Status { get; set; }\n\t}\n\n\t[GenerateJsonSchema(PropertyNaming = NamingConvention.CamelCase)]\n\tpublic class ModelWithNullableEnumArray\n\t{\n\t\tpublic ContentStyle[]? Styles { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithDescription\n\t{\n\t\t/// \n\t\t/// The person's full name\n\t\t/// \n\t\tpublic string Name { get; set; } = string.Empty;\n\n\t\t/// \n\t\t/// The person's age in years\n\t\t/// \n\t\tpublic int Age { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ProductWithCustomAttributes\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\n\t\t[PositiveNumber]\n\t\tpublic decimal Price { get; set; }\n\n\t\t[Range(0, 100)]\n\t\tpublic int DiscountPercentage { get; set; }\n\n\t\tpublic string? Description { get; set; }\n\t}\n\n\t[GenerateJsonSchema(PropertyNaming = NamingConvention.CamelCase)]\n\tpublic class ModelWithGuidArrayAndMinItems\n\t{\n\t\t[Required]\n\t\t[MinItems(1)]\n\t\tpublic Guid[] RecipientIds { get; set; } = [];\n\t}\n\n\tpublic class Address", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Generation.Serialization;\n#pragma warning disable CS1591 // Mi" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs (2/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs", + "startLine": 121, + "endLine": 240, + "content": "{\n\t\tpublic string Street { get; set; } = string.Empty;\n\t\tpublic string City { get; set; } = string.Empty;\n\t\tpublic string PostalCode { get; set; } = string.Empty;\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithAddresses\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\t[Description(\"Home address\")]\n\t\tpublic Address? HomeAddress { get; set; }\n\t\t[Description(\"Work address\")]\n\t\tpublic Address? WorkAddress { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\t[If(nameof(Toggle), true, 0)]\n\tpublic class SingleCondition\n\t{\n\t\t[Required]\n\t\tpublic bool Toggle { get; set; }\n\n\t\t[Required(ConditionGroup = 0)]\n\t\tpublic string? Required { get; set; }\n\t}\n\n\t[GenerateJsonSchema(PropertyNaming = NamingConvention.CamelCase)]\n\t[If(nameof(Toggle), true, 0)]\n\tpublic class SingleConditionCamelCase\n\t{\n\t\t[Required]\n\t\tpublic bool Toggle { get; set; }\n\n\t\t[Required(ConditionGroup = 0)]\n\t\tpublic string? Required { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\t[If(nameof(Toggle), true, \"ifToggle\")]\n\t[If(nameof(OtherToggle), 42, \"ifOtherToggle\")]\n\tpublic class MultipleConditionGroups\n\t{\n\t\t[Required]\n\t\tpublic bool Toggle { get; set; }\n\n\t\t[Required]\n\t\tpublic int OtherToggle { get; set; }\n\n\t\t[Required(ConditionGroup = \"ifToggle\")]\n\t\tpublic string? RequiredIfToggle { get; set; }\n\n\t\t[Required(ConditionGroup = \"ifOtherToggle\")]\n\t\tpublic string? RequiredIfOtherToggle { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\t[If(nameof(Count), 1, 0)]\n\t[If(nameof(Name), \"special\", 0)]\n\tpublic class MultipleTriggersInSameGroup\n\t{\n\t\t[Required]\n\t\tpublic int Count { get; set; }\n\n\t\t[Required]\n\t\tpublic string Name { get; set; } = string.Empty;\n\n\t\t[Required(ConditionGroup = 0)]\n\t\tpublic string? SpecialField { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\t[If(nameof(Status), nameof(TestModels.Status.Active), \"state-note\")]\n\t[If(nameof(Status), nameof(TestModels.Status.Pending), \"state-note\")]\n\tpublic class MultipleIfsSamePropertyAndGroup\n\t{\n\t\t[Required]\n\t\tpublic Status Status { get; set; }\n\n\t\t[Required(ConditionGroup = \"state-note\")]\n\t\tpublic string? Note { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\t[If(nameof(Status), nameof(TestModels.Status.Active), \"job-required\")]\n\t[If(nameof(Status), nameof(TestModels.Status.Pending), \"job-required\")]\n\t[If(nameof(Status), nameof(TestModels.Status.Inactive), \"org-required\")]\n\tpublic class MultipleIfsSamePropertyAcrossGroups\n\t{\n\t\t[Required]\n\t\tpublic Status Status { get; set; }\n\n\t\t[Required(ConditionGroup = \"job-required\")]\n\t\tpublic Guid? JobListingId { get; set; }\n\n\t\t[Required(ConditionGroup = \"org-required\")]\n\t\tpublic Guid? OrgId { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\t[IfMin(nameof(Age), 18, 0)]\n\tpublic class ConditionalWithMinimum\n\t{\n\t\t[Required]\n\t\tpublic int Age { get; set; }\n\n\t\t[Required(ConditionGroup = 0)]\n\t\tpublic string? AdultField { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\t[IfMax(nameof(Score), 100, 0)]\n\tpublic class ConditionalWithMaximum\n\t{\n\t\t[Required]\n\t\tpublic int Score { get; set; }\n\n\t\t[Required(ConditionGroup = 0)]\n\t\tpublic string? BonusEligible { get; set; }\n\t}", + "snippet": "{\n\t\tpublic string Street { get; set; } = string.Empty;\n\t\tpublic string City { get; set; } = string.Empty;\n\t\tpublic string PostalCode { get; set; } = string.Empty;\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithAddress" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs (3/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs", + "startLine": 241, + "endLine": 360, + "content": "[GenerateJsonSchema]\n\t[IfEnum(nameof(Day))]\n\tpublic class EnumSwitch\n\t{\n\t\t[Required]\n\t\tpublic DayOfWeek Day { get; set; }\n\n\t\t[Required(ConditionGroup = DayOfWeek.Monday)]\n\t\tpublic string? MondayField { get; set; }\n\n\t\t[Required(ConditionGroup = DayOfWeek.Tuesday)]\n\t\tpublic string? TuesdayField { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\t[If(nameof(IsActive), true, 0)]\n\tpublic class ConditionalValidation\n\t{\n\t\t[Required]\n\t\tpublic bool IsActive { get; set; }\n\n\t\t[MinLength(5, ConditionGroup = 0)]\n\t\t[MaxLength(100, ConditionGroup = 0)]\n\t\tpublic string? Name { get; set; }\n\n\t\t[Minimum(0, ConditionGroup = 0)]\n\t\t[Maximum(150, ConditionGroup = 0)]\n\t\tpublic int? Age { get; set; }\n\t}\n\n\t[GenerateJsonSchema(PropertyOrder = PropertyOrder.ByName)]\n\tpublic class PersonWithSortedProperties\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\tpublic int Age { get; set; }\n\t\tpublic string Email { get; set; } = string.Empty;\n\t\tpublic string City { get; set; } = string.Empty;\n\t}\n\n\t[GenerateJsonSchema]\n\t[Id(\"https://json-everything.test/schemas/person\")]\n\tpublic class PersonWithId\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\tpublic int Age { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithIdReference\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\tpublic PersonWithId? Person { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithJsonRequired\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\t[System.Text.Json.Serialization.JsonRequired]\n\t\tpublic int Age { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class PersonWithDefaults\n\t{\n\t\t[Default(\"anonymous\")]\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\t[Default(0)]\n\t\tpublic int Age { get; set; }\n\t\t[Default(true)]\n\t\tpublic bool IsActive { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\t[AdditionalProperties(false)]\n\tpublic class PersonWithNoAdditionalProperties\n\t{\n\t\tpublic string Name { get; set; } = string.Empty;\n\t\tpublic int Age { get; set; }\n\t}\n\n\tpublic class GenericHolder\n\t{\n\t\tpublic T Value { get; set; } = default!;\n\t}\n\n\tpublic class Optional\n\t{\n\t\tpublic T Value { get; set; } = default!;\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithMultipleClosedGenerics\n\t{\n\t\tpublic GenericHolder? IntHolder { get; set; }\n\t\tpublic GenericHolder? StringHolder { get; set; }\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithOptionalWrapper\n\t{\n\t\tpublic Optional Age { get; set; } = new();\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithOptionalObjectWrapper\n\t{\n\t\tpublic Optional Person { get; set; } = new();\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithNullableOptionalGuid\n\t{\n\t\tpublic Optional ValueA { get; set; } = new();\n\t\tpublic Optional ValueB { get; set; } = new();\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithOptionalCollections", + "snippet": "[GenerateJsonSchema]\n\t[IfEnum(nameof(Day))]\n\tpublic class EnumSwitch\n\t{\n\t\t[Required]\n\t\tpublic DayOfWeek Day { get; set; }\n\n\t\t[Required(ConditionGroup = DayOfWeek.Monday)]\n\t\tpublic string? MondayField { get; set; }\n\n\t\t[Re" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs (4/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs", + "startLine": 361, + "endLine": 480, + "content": "{\n\t\tpublic Optional> ValueA { get; set; } = new();\n\t\tpublic Optional ValueB { get; set; } = new();\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithOptionalUngeneratedType\n\t{\n\t\tpublic Optional Ungenerated { get; set; } = new();\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithOptionalDictionary\n\t{\n\t\tpublic Optional> Data { get; set; } = new();\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithOptionalAdditionalCollections\n\t{\n\t\tpublic Optional> ValueA { get; set; } = new();\n\t\tpublic Optional> ValueB { get; set; } = new();\n\t\tpublic Optional> ValueC { get; set; } = new();\n\t}\n\n\tpublic class UngeneratedType\n\t{\n\t\tpublic string Foo { get; set; } = null!;\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithBuiltInJsonTypes\n\t{\n\t\tpublic JsonDocument Document { get; set; } = null!;\n\t\tpublic JsonElement Element { get; set; }\n\t\tpublic JsonNode Node { get; set; } = null!;\n\t\tpublic JsonValue Value { get; set; } = JsonValue.Create(0)!;\n\t\tpublic JsonObject Object { get; set; } = new();\n\t\tpublic JsonArray Array { get; set; } = [];\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithStringKeyDictionary\n\t{\n\t\tpublic Dictionary Data { get; set; } = [];\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithEnumKeyDictionary\n\t{\n\t\tpublic Dictionary Flags { get; set; } = [];\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithGuidKeyDictionary\n\t{\n\t\tpublic Dictionary Data { get; set; } = [];\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ConflictModel\n\t{\n\t\tpublic string Value { get; set; } = string.Empty;\n\t}\n\n\t/// \n\t/// First line of summary.\n\t/// Second line of summary.\n\t/// \n\t[GenerateJsonSchema]\n\tpublic class TypeWithMultiLineSummary\n\t{\n\t\t/// \n\t\t/// First line of property summary.\n\t\t/// Second line of property summary.\n\t\t/// \n\t\tpublic string Value { get; set; } = string.Empty;\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithNullableOverrides\n\t{\n\t\t/// Force-nullable non-nullable string.\n\t\t[Nullable(true)]\n\t\tpublic string ForcedNullable { get; set; } = string.Empty;\n\n\t\t/// Force-non-nullable nullable int.\n\t\t[Nullable(false)]\n\t\tpublic int? ForcedNonNullable { get; set; }\n\t}\n\n#pragma warning disable JSGEN003\n\t[GenerateJsonSchema(PropertyNaming = NamingConvention.CamelCase)]\n\tpublic class ModelWithDuplicateSchemaPropertyNames\n\t{\n\t\tpublic int Foo { get; set; }\n\t\t// ReSharper disable once InconsistentNaming\n\t\tpublic int foo { get; set; }\n\t}\n#pragma warning restore JSGEN003\n\n\t[GenerateJsonSchema(StrictConditionals = true)]\n\t[If(nameof(IsActive), true, 0)]\n\tpublic class StrictConditionalValidation\n\t{\n\t\t[Required]\n\t\tpublic bool IsActive { get; set; }\n\n\t\t[MinLength(5, ConditionGroup = 0)]\n\t\t[MaxLength(100, ConditionGroup = 0)]\n\t\tpublic string? Name { get; set; }\n\n\t\t[Minimum(0, ConditionGroup = 0)]\n\t\t[Maximum(150, ConditionGroup = 0)]\n\t\tpublic int? Age { get; set; }\n\t}\n\n\tpublic enum SourceGenTargetEnumeration\n\t{\n\t\t[JsonIgnore]", + "snippet": "{\n\t\tpublic Optional> ValueA { get; set; } = new();\n\t\tpublic Optional ValueB { get; set; } = new();\n\t}\n\n\t[GenerateJsonSchema]\n\tpublic class ModelWithOptionalUngeneratedType\n\t{\n\t\tpublic Optional ListOfBool { get; set; }\n\n\t\t[MinLength(5, GenericParameter = 0)]\n\t\t[UniqueItems(true)]\n\t\t[Obsolete]\n\t\tpublic List ListOfString { get; set; }\n\n\t\t[Maximum(100)]\n\t\tpublic int Duplicated1 { get; set; }\n\n\t\t[Maximum(100)]\n\t\tpublic int Duplicated2 { get; set; }\n\n\t\tpublic SourceGenTarget Target { get; set; }\n\n\t\t[JsonIgnore]\n\t\tpublic int IgnoreThis { get; set; }\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.Never)]\n\t\tpublic string DontIgnoreThis { get; set; }\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]\n\t\tpublic string DontIgnoreThisWhenWritingDefault { get; set; }\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]\n\t\tpublic string DontIgnoreThisWhenWritingNull { get; set; }\n\n\t\t[JsonExclude]\n\t\tpublic string IgnoreThisWithJsonExclude { get; set; }\n\n\t\t[JsonIgnore]\n\t\t[JsonExclude]\n\t\tpublic double IgnoreAndExcludeThis { get; set; }\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.Never)]\n\t\t[JsonExclude]\n\t\tpublic double ExcludeTrumpsIgnore { get; set; }\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]\n\t\t[JsonExclude]\n\t\tpublic double ExcludeTrumpsIgnoreWhenWritingDefault { get; set; }\n\n\t\t[JsonPropertyName(\"rename-this\")]\n\t\tpublic string RenameThis { get; set; }\n\n\t\tpublic float StrictNumber { get; set; }\n\t\tpublic float OtherStrictNumber { get; set; }\n\n\t\t[ReadOnly]\n\t\tpublic float ReadOnlyNumber { get; set; }\n\n\t\t[WriteOnly]\n\t\tpublic float WriteOnlyNumber { get; set; }\n\n\t\t[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)]\n\t\tpublic float StringyNumber { get; set; }\n\n\t\t[JsonNumberHandling(JsonNumberHandling.AllowNamedFloatingPointLiterals)]\n\t\tpublic float NotANumber { get; set; }", + "snippet": "IgnoreThis,\n\n\t\t[JsonIgnore(Condition = JsonIgnoreCondition.Never)]\n\t\tDontIgnoreThis,\n\n\t\t[JsonExclude]\n\t\tIgnoreThisWithJsonExclude,\n\n\t\t[JsonIgnore]\n\t\t[JsonExclude]\n\t\tIgnoreAndExcludeThis,\n\n\t\t[JsonIgnore(Condition = JsonIg" + }, + { + "title": "src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs (6/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs#L601-L609", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/SourceGeneration/TestModels.cs", + "startLine": 601, + "endLine": 609, + "content": "[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.AllowNamedFloatingPointLiterals)]\n\t\tpublic float StringyNotANumber { get; set; }\n\n\t\t[Title(\"title\")]\n\t\t[Description(\"description\")]\n\t\tpublic string Metadata { get; set; }\n\t}\n}", + "snippet": "[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.AllowNamedFloatingPointLiterals)]\n\t\tpublic float StringyNotANumber { get; set; }\n\n\t\t[Title(\"title\")]\n\t\t[Description(\"description\")]\n\t\tpub" + }, + { + "title": "src/JsonSchema.Generation.Tests/TestEnvironment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/TestEnvironment.cs#L1-L61", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/TestEnvironment.cs", + "startLine": 1, + "endLine": 61, + "content": "using System.Drawing;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Generation.Tests.Serialization;\nusing Json.Schema.Generation.Tests.SourceGeneration;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Generation.Tests;\n\n[SetUpFixture]\ninternal static class TestEnvironment\n{\n\tpublic static readonly JsonSerializerOptions SerializerOptions =\n\t\tnew()\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tWriteIndented = true,\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t\t};\n\n\t[OneTimeSetUp]\n\tpublic static void Setup()\n\t{\n\t\tSchemaGeneratorConfiguration.Default.DefaultDialect = MetaSchemas.Draft202012Id;\n\t}\n}\n\n[JsonSerializable(typeof(Point))]\n[JsonSerializable(typeof(JsonSchema))]\n[JsonSerializable(typeof(EvaluationResults))]\n[JsonSerializable(typeof(DeserializationTests.Foo))]\n[JsonSerializable(typeof(DeserializationTests.FooWithSchema))]\n[JsonSerializable(typeof(ArrayGenerationTests.EnumTest))]\n[JsonSerializable(typeof(TestModels.SimplePerson))]\n[JsonSerializable(typeof(TestModels.CamelCasePerson))]\n[JsonSerializable(typeof(TestModels.PersonWithNullable))]\n[JsonSerializable(typeof(TestModels.PersonWithRequired))]\n[JsonSerializable(typeof(TestModels.Status))]\n[JsonSerializable(typeof(TestModels.PersonWithEnum))]\n[JsonSerializable(typeof(TestModels.PersonWithDescription))]\n[JsonSerializable(typeof(TestModels.ProductWithCustomAttributes))]\n[JsonSerializable(typeof(TestModels.Address))]\n[JsonSerializable(typeof(TestModels.PersonWithAddresses))]\n[JsonSerializable(typeof(TestModels.SingleCondition))]\n[JsonSerializable(typeof(TestModels.SingleConditionCamelCase))]\n[JsonSerializable(typeof(TestModels.MultipleConditionGroups))]\n[JsonSerializable(typeof(TestModels.MultipleTriggersInSameGroup))]\n[JsonSerializable(typeof(TestModels.ConditionalWithMinimum))]\n[JsonSerializable(typeof(TestModels.ConditionalWithMaximum))]\n[JsonSerializable(typeof(TestModels.EnumSwitch))]\n[JsonSerializable(typeof(TestModels.ConditionalValidation))]\n[JsonSerializable(typeof(ClientTests.Issue977_RootType))]\n[JsonSerializable(typeof(ClientTests.Issue977_ConfigTypeA))]\n[JsonSerializable(typeof(ClientTests.Issue977_ConfigTypeB))]\n[JsonSerializable(typeof(ClientTests.Issue977_SampleEnum))]\n#if NET9_0_OR_GREATER\n[JsonSerializable(typeof(ClientTests.Issue890_Status))]\n#endif\npublic partial class TestSerializerContext : JsonSerializerContext;", + "snippet": "using System.Drawing;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Generation.Tests.Serialization;\nusing Json.Schema.Generation.Tests.SourceGeneration;\n" + }, + { + "title": "src/JsonSchema.Generation.Tests/TypeAttributeTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation.Tests/TypeAttributeTests.cs#L1-L41", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation.Tests/TypeAttributeTests.cs", + "startLine": 1, + "endLine": 41, + "content": "using NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class TypeAttributeTests\n{\n\t// ReSharper disable once ClassNeverInstantiated.Local\n\t// ReSharper disable UnusedMember.Local\n\t[Title(\"an object with attributes\")]\n\t[Description(\"this object has attributes\")]\n\t[ReadOnly]\n\tprivate class AttributedObject\n\t{\n\t\t[Title(\"a property with attributes\")]\n\t\tpublic int Value { get; set; }\n\t}\n\t// ReSharper restore UnusedMember.Local\n\n\t[Test]\n\tpublic void AttributedObjectHasTitleAndDescription()\n\t{\n\t\tvar expected = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Title(\"an object with attributes\")\n\t\t\t.Description(\"this object has attributes\")\n\t\t\t.Properties(\n\t\t\t\t(\"Value\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Title(\"a property with attributes\")\n\t\t\t\t)\n\t\t\t)\n\t\t\t.ReadOnly(true);\n\n\t\tvar actual = new JsonSchemaBuilder().FromType();\n\n\t\tAssertEqual(expected, actual);\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nusing static Json.Schema.Generation.Tests.AssertionExtensions;\n\nnamespace Json.Schema.Generation.Tests;\n\npublic class TypeAttributeTests\n{\n\t// ReSharper disable once ClassNeverInstantiated.Local\n\t" + }, + { + "title": "src/JsonSchema.Generation/AdHocGenerationContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/AdHocGenerationContext.cs#L1-L13", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/AdHocGenerationContext.cs", + "startLine": 1, + "endLine": 13, + "content": "using System;\n\nnamespace Json.Schema.Generation;\n\ninternal class AdHocGenerationContext : SchemaGenerationContextBase\n{\n\tpublic override Type Type => null!;\n\n\tinternal override void GenerateIntents()\n\t{\n\t\tthrow new NotImplementedException();\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation;\n\ninternal class AdHocGenerationContext : SchemaGenerationContextBase\n{\n\tpublic override Type Type => null!;\n\n\tinternal override void GenerateIntents()\n\t{\n\t\tthrow new NotIm" + }, + { + "title": "src/JsonSchema.Generation/AttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/AttributeHandler.cs#L1-L95", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/AttributeHandler.cs", + "startLine": 1, + "endLine": 95, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Generation.Intents;\n#pragma warning disable IL2111\n#pragma warning disable IL2075\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Adds attribute-related schema elements.\n/// \npublic static class AttributeHandler\n{\n\tprivate static readonly List _externalHandlers = new()\n\t{\n\t\t// Explicitly instantiate all non-attribute handlers in the library for AOT compatibility\n\t\tnew JsonNumberHandlingAttributeHandler()\n\t};\n\n\t/// \n\t/// Adds a handler for a custom attribute that cannot be made to implement .\n\t/// \n\t/// The handler type.\n\t[RequiresDynamicCode(\"This method uses reflection to query types and is not suited for AOT scenarios.\")]\n\tpublic static void AddHandler()\n\t\twhere T : IAttributeHandler, new()\n\t{\n\t\tif (typeof(Attribute).IsAssignableFrom(typeof(T))) return;\n\t\tif (_externalHandlers.Any(h => h.GetType() == typeof(T))) return;\n\n\t\t_externalHandlers.Add(new T());\n\t}\n\n\t/// \n\t/// Adds a handler for a custom attribute that cannot be made to implement .\n\t/// \n\t/// The handler.\n\t[RequiresDynamicCode(\"This method uses reflection to query types and is not suited for AOT scenarios.\")]\n\tpublic static void AddHandler(IAttributeHandler handler)\n\t{\n\t\tvar handlerType = handler.GetType();\n\t\tif (typeof(Attribute).IsAssignableFrom(handlerType)) return;\n\t\tif (_externalHandlers.Any(h => h.GetType() == handlerType)) return;\n\n\t\t_externalHandlers.Add(handler);\n\t}\n\n\t/// \n\t/// Removes a handler type.\n\t/// \n\t/// The handler type.\n\t[RequiresDynamicCode(\"This method uses reflection to query types and is not suited for AOT scenarios.\")]\n\tpublic static void RemoveHandler()\n\t\twhere T : IAttributeHandler\n\t{\n\t\tvar handler = _externalHandlers.OfType().FirstOrDefault();\n\t\tif (handler == null) return;\n\n\t\t_externalHandlers.Remove(handler);\n\t}\n\n\tinternal static void HandleAttributes(SchemaGenerationContextBase context)\n\t{\n\t\tIEnumerable handlers = _externalHandlers;\n\n\t\tvar attributes = context.GetAttributes().ToList();\n\n\t\thandlers = handlers.Concat(attributes.OfType()).ToArray();\n\n\t\tforeach (var handler in handlers)\n\t\t{\n\t\t\tif (handler is IdAttribute && context.Intents.Any(x => x is RefIntent)) continue;\n\n\t\t\tvar attribute = handler as Attribute;\n\t\t\tif (attribute == null)\n\t\t\t{\n\t\t\t\tvar interfaces = handler.GetType().GetInterfaces();\n\t\t\t\tvar handlerInterface = interfaces.FirstOrDefault(x => x.IsGenericType &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t x.GetGenericTypeDefinition() == typeof(IAttributeHandler<>));\n\t\t\t\tif (handlerInterface == null) continue;\n\n\t\t\t\tvar attributeType = handlerInterface.GetGenericArguments()[0];\n\t\t\t\tattribute = attributes.FirstOrDefault(x => x.GetType() == attributeType);\n\n\t\t\t\tif (attribute == null) continue;\n\t\t\t}\n\n\t\t\thandler.AddConstraints(context, attribute);\n\t\t}\n\t}\n\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Generation.Intents;\n#pragma warning disable IL2111\n#pragma" + }, + { + "title": "src/JsonSchema.Generation/Attributes/AdditionalItemsAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/AdditionalItemsAttribute.cs#L1-L60", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/AdditionalItemsAttribute.cs", + "startLine": 1, + "endLine": 60, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies an `additionalProperties` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class AdditionalItemsAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// If the attribute value represents a boolean schema, gets the boolean value.\n\t/// \n\tpublic bool? BoolValue { get; }\n\t/// \n\t/// If the attribute value represents a type schema, gets the type.\n\t/// \n\tpublic Type? TypeValue { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// A boolean schema.\n\tpublic AdditionalItemsAttribute(bool boolSchema)\n\t{\n\t\tBoolValue = boolSchema;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// A type to generate a schema for the keyword.\n\tpublic AdditionalItemsAttribute(Type typeSchema)\n\t{\n\t\tTypeValue = typeSchema;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (!context.Type.IsArray()) return;\n\n\t\tif (BoolValue.HasValue)\n\t\t{\n\t\t\tcontext.Intents.Add(new AdditionalItemsIntent(BoolValue.Value\n\t\t\t\t? SchemaGenerationContextBase.True\n\t\t\t\t: SchemaGenerationContextBase.False));\n\t\t\treturn;\n\t\t}\n\n\t\tcontext.Intents.Add(new AdditionalItemsIntent(SchemaGenerationContextCache.Get(TypeValue!)));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies an `additionalProperties` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTar" + }, + { + "title": "src/JsonSchema.Generation/Attributes/AdditionalPropertiesAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/AdditionalPropertiesAttribute.cs#L1-L58", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/AdditionalPropertiesAttribute.cs", + "startLine": 1, + "endLine": 58, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies an `additionalProperties` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class AdditionalPropertiesAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// If the attribute value represents a boolean schema, gets the boolean value.\n\t/// \n\tpublic bool? BoolValue { get; }\n\t/// \n\t/// If the attribute value represents a type schema, gets the type.\n\t/// \n\tpublic Type? TypeValue { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// A boolean schema.\n\tpublic AdditionalPropertiesAttribute(bool boolSchema)\n\t{\n\t\tBoolValue = boolSchema;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// A type to generate the a schema for the keyword.\n\tpublic AdditionalPropertiesAttribute(Type typeSchema)\n\t{\n\t\tTypeValue = typeSchema;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (BoolValue.HasValue)\n\t\t{\n\t\t\tcontext.Intents.Add(new AdditionalPropertiesIntent(BoolValue.Value\n\t\t\t\t? SchemaGenerationContextBase.True\n\t\t\t\t: SchemaGenerationContextBase.False));\n\t\t\treturn;\n\t\t}\n\n\t\tcontext.Intents.Add(new AdditionalPropertiesIntent(SchemaGenerationContextCache.Get(TypeValue!)));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies an `additionalProperties` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTar" + }, + { + "title": "src/JsonSchema.Generation/Attributes/ConditionalAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/ConditionalAttribute.cs#L1-L14", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/ConditionalAttribute.cs", + "startLine": 1, + "endLine": 14, + "content": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Serves as a base class for attributes which support conditional schema generation.\n/// \npublic abstract class ConditionalAttribute : Attribute\n{\n\t/// \n\t/// Identifies the condition group under which this attribute applies.\n\t/// \n\tpublic object? ConditionGroup { get; set; }\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Serves as a base class for attributes which support conditional schema generation.\n/// \npublic abstract class ConditionalAttribute : Attribute" + }, + { + "title": "src/JsonSchema.Generation/Attributes/ConstAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/ConstAttribute.cs#L1-L101", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/ConstAttribute.cs", + "startLine": 1, + "endLine": 101, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `const` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n AttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class ConstAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic JsonNode? Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ConstAttribute(int value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ConstAttribute(uint value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ConstAttribute(long value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ConstAttribute(ulong value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ConstAttribute(float value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ConstAttribute(double value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ConstAttribute(string? value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ConstAttribute(bool value)\n\t{\n\t\tValue = value;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tcontext.Intents.Add(new ConstIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `const` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property " + }, + { + "title": "src/JsonSchema.Generation/Attributes/DefaultAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/DefaultAttribute.cs#L1-L101", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/DefaultAttribute.cs", + "startLine": 1, + "endLine": 101, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `default` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n AttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class DefaultAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic JsonNode? Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic DefaultAttribute(int value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic DefaultAttribute(uint value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic DefaultAttribute(long value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic DefaultAttribute(ulong value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic DefaultAttribute(float value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic DefaultAttribute(double value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic DefaultAttribute(string? value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic DefaultAttribute(bool value)\n\t{\n\t\tValue = value;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tcontext.Intents.Add(new DefaultIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `default` keyword.\n/// \n[AttributeUsage(AttributeTargets.Propert" + }, + { + "title": "src/JsonSchema.Generation/Attributes/DescriptionAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/DescriptionAttribute.cs#L1-L44", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/DescriptionAttribute.cs", + "startLine": 1, + "endLine": 44, + "content": "using System;\nusing System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `description` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class DescriptionAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The description.\n\t/// \n\tpublic string Description { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic DescriptionAttribute(string description)\n\t{\n\t\tDescription = description;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tvar existingDescription = context.Intents.Where(x => x is DescriptionIntent).ToArray();\n\t\tforeach (var intent in existingDescription)\n\t\t{\n\t\t\tcontext.Intents.Remove(intent);\n\t\t}\n\n\t\tcontext.Intents.Add(new DescriptionIntent(Description));\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `description` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | Att" + }, + { + "title": "src/JsonSchema.Generation/Attributes/ExclusiveMaximumAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/ExclusiveMaximumAttribute.cs#L1-L50", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/ExclusiveMaximumAttribute.cs", + "startLine": 1, + "endLine": 50, + "content": "using System;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies an `exclusiveMaximum` keyword.\n/// \n/// \n/// The `value` parameter is provided in the constructor as a `double` but stored as a `decimal`\n/// because `decimal` is not a valid attribute parameter type.\n/// As such, to prevent overflows, the value is clamped to the `decimal` range prior to being converted.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n AttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class ExclusiveMaximumAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The exclusive maximum.\n\t/// \n\tpublic decimal Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\t/// \n\t/// The parameter is provided as a `double` but stored as a `decimal`\n\t/// because `decimal` is not a valid attribute parameter type.\n\t/// As such, to prevent overflows, the value is clamped to the `decimal` range prior to being converted.\n\t/// \n\tpublic ExclusiveMaximumAttribute(double value)\n\t{\n\t\tValue = value.ClampToDecimal();\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (!context.Type.IsNumber() && !context.Type.IsNullableNumber()) return;\n\n\t\tcontext.Intents.Add(new ExclusiveMaximumIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies an `exclusiveMaximum` keyword.\n/// \n/// \n/// The `value` parameter is " + }, + { + "title": "src/JsonSchema.Generation/Attributes/ExclusiveMinimumAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/ExclusiveMinimumAttribute.cs#L1-L50", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/ExclusiveMinimumAttribute.cs", + "startLine": 1, + "endLine": 50, + "content": "using System;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies an `exclusiveMinimum` keyword.\n/// \n/// \n/// The `value` parameter is provided in the constructor as a `double` but stored as a `decimal`\n/// because `decimal` is not a valid attribute parameter type.\n/// As such, to prevent overflows, the value is clamped to the `decimal` range prior to being converted.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n AttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class ExclusiveMinimumAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The exclusive minimum.\n\t/// \n\tpublic decimal Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\t/// \n\t/// The parameter is provided as a `double` but stored as a `decimal`\n\t/// because `decimal` is not a valid attribute parameter type.\n\t/// As such, to prevent overflows, the value is clamped to the `decimal` range prior to being converted.\n\t/// \n\tpublic ExclusiveMinimumAttribute(double value)\n\t{\n\t\tValue = value.ClampToDecimal();\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (!context.Type.IsNumber() && !context.Type.IsNullableNumber()) return;\n\n\t\tcontext.Intents.Add(new ExclusiveMinimumIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies an `exclusiveMinimum` keyword.\n/// \n/// \n/// The `value` parameter is " + }, + { + "title": "src/JsonSchema.Generation/Attributes/IConditionAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/IConditionAttribute.cs#L1-L7", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/IConditionAttribute.cs", + "startLine": 1, + "endLine": 7, + "content": "namespace Json.Schema.Generation;\n\ninternal interface IConditionalAttribute\n{\n\tstring PropertyName { get; set; }\n\tobject? ConditionGroup { get; set; }\n}", + "snippet": "namespace Json.Schema.Generation;\n\ninternal interface IConditionalAttribute\n{\n\tstring PropertyName { get; set; }\n\tobject? ConditionGroup { get; set; }\n}" + }, + { + "title": "src/JsonSchema.Generation/Attributes/IdAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/IdAttribute.cs#L1-L34", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/IdAttribute.cs", + "startLine": 1, + "endLine": 34, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies an `$id` keyword.\n/// \n[AttributeUsage(AttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface)]\npublic class IdAttribute : Attribute, IAttributeHandler\n{\n\t/// \n\t/// The regular expression pattern.\n\t/// \n\tpublic Uri Uri { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic IdAttribute([StringSyntax(StringSyntaxAttribute.Uri)] string value)\n\t{\n\t\tif (!Uri.IsWellFormedUriString(value, UriKind.RelativeOrAbsolute))\n\t\t\tthrow new ArgumentException(\"[Id] attribute requires a valid URI\", nameof(value));\n\n\t\tUri = new Uri(value, UriKind.RelativeOrAbsolute);\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tcontext.Intents.Insert(0, new IdIntent(Uri));\n\t}\n}", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies an `$id` keyword.\n/// \n[AttributeUsage(AttributeTargets.E" + }, + { + "title": "src/JsonSchema.Generation/Attributes/IfAttribute.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/IfAttribute.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/IfAttribute.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Creates or amends a condition group by expecting a value in a property.\n/// \n[AttributeUsage(AttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = true)]\npublic class IfAttribute : ConditionalAttribute, INestableAttribute, IConditionalAttribute\n{\n\t/// \n\t/// The property name.\n\t/// \n\tpublic string PropertyName { get; set; }\n\n\t/// \n\t/// The expected property value.\n\t/// \n\t/// \n\t/// The compiler will allow any compile-time constant, however only JSON-compatible\n\t/// values will work.\n\t/// \n\tpublic JsonNode? Value { get; set; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The name of the property.\n\t/// The expected value for the property.\n\t/// The condition group.\n\tpublic IfAttribute(string propertyName, int value, object? group)\n\t{\n\t\tPropertyName = propertyName;\n\t\tValue = value;\n\t\tConditionGroup = group;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The name of the property.\n\t/// The expected value for the property.\n\t/// The condition group.\n\tpublic IfAttribute(string propertyName, uint value, object? group)\n\t{\n\t\tPropertyName = propertyName;\n\t\tValue = value;\n\t\tConditionGroup = group;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The name of the property.\n\t/// The expected value for the property.\n\t/// The condition group.\n\tpublic IfAttribute(string propertyName, long value, object? group)\n\t{\n\t\tPropertyName = propertyName;\n\t\tValue = value;\n\t\tConditionGroup = group;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The name of the property.\n\t/// The expected value for the property.\n\t/// The condition group.\n\tpublic IfAttribute(string propertyName, ulong value, object? group)\n\t{\n\t\tPropertyName = propertyName;\n\t\tValue = value;\n\t\tConditionGroup = group;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The name of the property.\n\t/// The expected value for the property.\n\t/// The condition group.\n\tpublic IfAttribute(string propertyName, float value, object? group)\n\t{\n\t\tPropertyName = propertyName;\n\t\tValue = value;\n\t\tConditionGroup = group;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The name of the property.\n\t/// The expected value for the property.\n\t/// The condition group.\n\tpublic IfAttribute(string propertyName, double value, object? group)\n\t{\n\t\tPropertyName = propertyName;\n\t\tValue = value;\n\t\tConditionGroup = group;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The name of the property.\n\t/// The expected value for the property.\n\t/// The condition group.\n\tpublic IfAttribute(string propertyName, bool value, object? group)\n\t{\n\t\tPropertyName = propertyName;\n\t\tValue = value;\n\t\tConditionGroup = group;\n\t}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Creates or amends a condition group by expecting a value in a property.\n/// \n[AttributeUsage(AttributeTargets.En" + }, + { + "title": "src/JsonSchema.Generation/Attributes/IfAttribute.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/IfAttribute.cs#L121-L134", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/IfAttribute.cs", + "startLine": 121, + "endLine": 134, + "content": "/// \n\t/// Creates a new instance.\n\t/// \n\t/// The name of the property.\n\t/// The expected value for the property.\n\t/// The condition group.\n\tpublic IfAttribute(string propertyName, string? value, object? group)\n\t{\n\t\tPropertyName = propertyName;\n\t\tValue = value;\n\t\tConditionGroup = group;\n\t}\n}", + "snippet": "/// \n\t/// Creates a new instance.\n\t/// \n\t/// The name of the property.\n\t/// The expected value for the property." + }, + { + "title": "src/JsonSchema.Generation/Attributes/IfEnumAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/IfEnumAttribute.cs#L1-L40", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/IfEnumAttribute.cs", + "startLine": 1, + "endLine": 40, + "content": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Creates multiple condition groups based on the value of an enum property, one group for each defined enum value.\n/// \n/// \n/// The enum type is inferred from the property.\n/// \n[AttributeUsage(AttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class IfEnumAttribute : ConditionalAttribute, INestableAttribute, IConditionalAttribute\n{\n\t/// \n\t/// The property name.\n\t/// \n\tpublic string PropertyName { get; set; }\n\n\t/// \n\t/// Gets or sets whether to use numbers or names in the condition. Default is to use names.\n\t/// \n\tpublic bool UseNumbers { get; set; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The property name.\n\t/// (optional) Whether to use numbers or names in the condition. Default is to use names.\n\tpublic IfEnumAttribute(string propertyName, bool useNumbers = false)\n\t{\n\t\tPropertyName = propertyName;\n\t\tUseNumbers = useNumbers;\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Creates multiple condition groups based on the value of an enum property, one group for each defined enum value.\n/// \n/// \n/// The en" + }, + { + "title": "src/JsonSchema.Generation/Attributes/IfMaxAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/IfMaxAttribute.cs#L1-L82", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/IfMaxAttribute.cs", + "startLine": 1, + "endLine": 82, + "content": "using System;\nusing System.Collections;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Creates or amends a condition group by defining an expected maximum value in a property.\n/// \n/// \n/// The specific keywords which are added depend on the type of the targeted property.\n/// \n[AttributeUsage(AttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = true)]\npublic class IfMaxAttribute : ConditionalAttribute, INestableAttribute, IConditionalAttribute\n{\n\t/// \n\t/// The property name.\n\t/// \n\tpublic string PropertyName { get; set; }\n\t\n\t/// \n\t/// The expected maximum value.\n\t/// \n\tpublic double Value { get; set; }\n\t\n\t/// \n\t/// Gets or sets whether the value should be exclusive.\n\t/// \n\tpublic bool IsExclusive { get; set; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\tinternal Type? PropertyType { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The name of the property.\n\t/// The expected maximum value for the property.\n\t/// The condition group.\n\t/// \n\t/// The parameter is provided as a `double` but stored as a `decimal`\n\t/// because `decimal` is not a valid attribute parameter type.\n\t/// As such, to prevent overflows, the value is clamped to the `decimal` range prior to being converted\n\t/// when applied as the `maximum` or `exclusiveMaximum` keywords.\n\t/// \n\tpublic IfMaxAttribute(string propertyName, double value, object? group)\n\t{\n\t\tPropertyName = propertyName;\n\t\tValue = value;\n\t\tConditionGroup = group;\n\t}\n\n\tinternal ISchemaKeywordIntent? GetIntent()\n\t{\n\t\tif (PropertyType == null) return null;\n\n\t\tif (PropertyType.IsNumber() || PropertyType.IsNullableNumber())\n\t\t{\n\t\t\tif (IsExclusive) return new ExclusiveMaximumIntent(Value.ClampToDecimal());\n\t\t\treturn new MaximumIntent(Value.ClampToDecimal());\n\t\t}\n\n\t\t// ReSharper disable once CompareOfFloatsByEqualityOperator\n\t\tif (Value < 0 && Value != Math.Floor(Value)) return null;\n\n\t\tif (PropertyType == typeof(string))\n\t\t{\n\t\t\treturn new MaxLengthIntent((uint)Value);\n\t\t}\n\n\t\tif (typeof(IEnumerable).IsAssignableFrom(PropertyType) &&\n\t\t !typeof(IDictionary).IsAssignableFrom(PropertyType))\n\t\t\treturn new MaxItemsIntent((uint)Value);\n\n\t\treturn new MaxPropertiesIntent((uint)Value);\n\t}\n}", + "snippet": "using System;\nusing System.Collections;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Creates or amends a condition group by defining an expected maximum val" + }, + { + "title": "src/JsonSchema.Generation/Attributes/IfMinAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/IfMinAttribute.cs#L1-L82", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/IfMinAttribute.cs", + "startLine": 1, + "endLine": 82, + "content": "using System;\nusing System.Collections;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Creates or amends a condition group by defining an expected minimum value in a property.\n/// \n/// \n/// The specific keywords which are added depend on the type of the targeted property.\n/// \n[AttributeUsage(AttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = true)]\npublic class IfMinAttribute : ConditionalAttribute, INestableAttribute, IConditionalAttribute\n{\n\t/// \n\t/// The property name.\n\t/// \n\tpublic string PropertyName { get; set; }\n\n\t/// \n\t/// The expected minimum value.\n\t/// \n\tpublic double Value { get; set; }\n\n\t/// \n\t/// Gets or sets whether the value should be exclusive.\n\t/// \n\tpublic bool IsExclusive { get; set; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\tinternal Type? PropertyType { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The name of the property.\n\t/// The expected minimum value for the property.\n\t/// The condition group.\n\t/// \n\t/// The parameter is provided as a `double` but stored as a `decimal`\n\t/// because `decimal` is not a valid attribute parameter type.\n\t/// As such, to prevent overflows, the value is clamped to the `decimal` range prior to being converted\n\t/// when applied as the `minimum` or `exclusiveMinimum` keywords.\n\t/// \n\tpublic IfMinAttribute(string propertyName, double value, object? group)\n\t{\n\t\tPropertyName = propertyName;\n\t\tValue = value;\n\t\tConditionGroup = group;\n\t}\n\n\tinternal ISchemaKeywordIntent? GetIntent()\n\t{\n\t\tif (PropertyType == null) return null;\n\n\t\tif (PropertyType.IsNumber() || PropertyType.IsNullableNumber())\n\t\t{\n\t\t\tif (IsExclusive) return new ExclusiveMinimumIntent(Value.ClampToDecimal());\n\t\t\treturn new MinimumIntent(Value.ClampToDecimal());\n\t\t}\n\n\t\t// ReSharper disable once CompareOfFloatsByEqualityOperator\n\t\tif (Value < 0 && Value != Math.Floor(Value)) return null;\n\n\t\tif (PropertyType == typeof(string))\n\t\t{\n\t\t\treturn new MinLengthIntent((uint)Value);\n\t\t}\n\n\t\tif (typeof(IEnumerable).IsAssignableFrom(PropertyType) &&\n\t\t !typeof(IDictionary).IsAssignableFrom(PropertyType))\n\t\t\treturn new MinItemsIntent((uint)Value);\n\n\t\treturn new MinPropertiesIntent((uint)Value);\n\t}\n}", + "snippet": "using System;\nusing System.Collections;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Creates or amends a condition group by defining an expected minimum val" + }, + { + "title": "src/JsonSchema.Generation/Attributes/INestableAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/INestableAttribute.cs#L1-L14", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/INestableAttribute.cs", + "startLine": 1, + "endLine": 14, + "content": "namespace Json.Schema.Generation;\n\n/// \n/// Indicates an attribute can support being applied to generic parameters.\n/// \npublic interface INestableAttribute\n{\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// Default MUST be -1, which indicates the root type.\n\t/// For example, `Person` in `Dictionary<string, Person>` would have a parameter of 1.\n\t/// \n\tint GenericParameter { get; set; }\n}", + "snippet": "namespace Json.Schema.Generation;\n\n/// \n/// Indicates an attribute can support being applied to generic parameters.\n/// \npublic interface INestableAttribute\n{\n\t/// \n\t/// The index of the param" + }, + { + "title": "src/JsonSchema.Generation/Attributes/JsonExcludeAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/JsonExcludeAttribute.cs#L1-L22", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/JsonExcludeAttribute.cs", + "startLine": 1, + "endLine": 22, + "content": "using System;\nusing System.Text.Json.Serialization;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Indicates that the property should be excluded from generation.\n/// \n/// \n/// This attribute functions exactly the same as the . It\n/// is included separately to support the case where the model should be serialized with\n/// a property or enum member but schema generation should ignore it.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]\npublic sealed class JsonExcludeAttribute : JsonAttribute\n{\n\t/// \n\t/// Initializes a new instance of .\n\t/// \n\t// ReSharper disable once EmptyConstructor (it's not redundant if it defines new comments ;)\n\tpublic JsonExcludeAttribute() { }\n}", + "snippet": "using System;\nusing System.Text.Json.Serialization;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Indicates that the property should be excluded from generation.\n/// \n/// \n/// This attribute fu" + }, + { + "title": "src/JsonSchema.Generation/Attributes/JsonNumberHandlingAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/JsonNumberHandlingAttributeHandler.cs#L1-L44", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/JsonNumberHandlingAttributeHandler.cs", + "startLine": 1, + "endLine": 44, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Handler for the .\n/// \npublic class JsonNumberHandlingAttributeHandler : IAttributeHandler\n{\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\t/// \n\tpublic void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tvar handlingAttribute = attribute as JsonNumberHandlingAttribute;\n\t\tif (handlingAttribute == null) return;\n\n\t\tif (!context.Type.IsNumber() && !context.Type.IsNullableNumber()) return;\n\n\t\tvar typeIntent = context.Intents.OfType().FirstOrDefault();\n\n\t\tvar existingType = typeIntent?.Type ?? default;\n\n\t\tif (handlingAttribute.Handling.HasFlag(JsonNumberHandling.AllowReadingFromString))\n\t\t{\n\t\t\tcontext.Intents.Remove(typeIntent!);\n\t\t\tcontext.Intents.Add(new TypeIntent(existingType | SchemaValueType.String));\n\t\t}\n\n\t\tif (handlingAttribute.Handling.HasFlag(JsonNumberHandling.AllowNamedFloatingPointLiterals))\n\t\t{\n\t\t\tvar currentSchema = context.Intents.ToList();\n\t\t\tcontext.Intents.Clear();\n\t\t\tcontext.Intents.Add(new AnyOfIntent(currentSchema, [new EnumIntent(\"NaN\", \"Infinity\", \"-Infinity\")]));\n\t\t}\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Handler for the \n/// Applies a `maximum` keyword.\n/// \n/// \n/// The `value` parameter is provided in the constructor as a `double` but stored as a `decimal`\n/// because `decimal` is not a valid attribute parameter type.\n/// As such, to prevent overflows, the value is clamped to the `decimal` range prior to being converted.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.GenericParameter |\n AttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class MaximumAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The maximum.\n\t/// \n\tpublic decimal Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\t/// \n\t/// The parameter is provided as a `double` but stored as a `decimal`\n\t/// because `decimal` is not a valid attribute parameter type.\n\t/// As such, to prevent overflows, the value is clamped to the `decimal` range prior to being converted.\n\t/// \n\tpublic MaximumAttribute(double value)\n\t{\n\t\tValue = value.ClampToDecimal();\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (!context.Type.IsNumber() && !context.Type.IsNullableNumber()) return;\n\n\t\tcontext.Intents.Add(new MaximumIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `maximum` keyword.\n/// \n/// \n/// The `value` parameter is provided i" + }, + { + "title": "src/JsonSchema.Generation/Attributes/MaxItemsAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/MaxItemsAttribute.cs#L1-L40", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/MaxItemsAttribute.cs", + "startLine": 1, + "endLine": 40, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies an `maxItems` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class MaxItemsAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The maximum number of items.\n\t/// \n\tpublic uint Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MaxItemsAttribute(uint value)\n\t{\n\t\tValue = value;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (!context.Type.IsArray()) return;\n\n\t\tcontext.Intents.Add(new MaxItemsIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies an `maxItems` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |" + }, + { + "title": "src/JsonSchema.Generation/Attributes/MaxLengthAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/MaxLengthAttribute.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/MaxLengthAttribute.cs", + "startLine": 1, + "endLine": 39, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `maxLength` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class MaxLengthAttribute : ConditionalAttribute,INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The maximum length.\n\t/// \n\tpublic uint Length { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MaxLengthAttribute(uint length)\n\t{\n\t\tLength = length;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (context.Type != typeof(string)) return;\n\n\t\tcontext.Intents.Add(new MaxLengthIntent(Length));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `maxLength` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |" + }, + { + "title": "src/JsonSchema.Generation/Attributes/MinimumAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/MinimumAttribute.cs#L1-L50", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/MinimumAttribute.cs", + "startLine": 1, + "endLine": 50, + "content": "using System;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `minimum` keyword.\n/// \n/// \n/// The `value` parameter is provided in the constructor as a `double` but stored as a `decimal`\n/// because `decimal` is not a valid attribute parameter type.\n/// As such, to prevent overflows, the value is clamped to the `decimal` range prior to being converted.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n AttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class MinimumAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The minimum.\n\t/// \n\tpublic decimal Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\t/// \n\t/// The parameter is provided as a `double` but stored as a `decimal`\n\t/// because `decimal` is not a valid attribute parameter type.\n\t/// As such, to prevent overflows, the value is clamped to the `decimal` range prior to being converted.\n\t/// \n\tpublic MinimumAttribute(double value)\n\t{\n\t\tValue = value.ClampToDecimal();\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (!context.Type.IsNumber() && !context.Type.IsNullableNumber()) return;\n\n\t\tcontext.Intents.Add(new MinimumIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `minimum` keyword.\n/// \n/// \n/// The `value` parameter is provided i" + }, + { + "title": "src/JsonSchema.Generation/Attributes/MinItemsAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/MinItemsAttribute.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/MinItemsAttribute.cs", + "startLine": 1, + "endLine": 39, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `minItems` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class MinItemsAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The minimum number of items.\n\t/// \n\tpublic uint Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MinItemsAttribute(uint value)\n\t{\n\t\tValue = value;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (!context.Type.IsArray()) return;\n\n\t\tcontext.Intents.Add(new MinItemsIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `minItems` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n" + }, + { + "title": "src/JsonSchema.Generation/Attributes/MinLengthAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/MinLengthAttribute.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/MinLengthAttribute.cs", + "startLine": 1, + "endLine": 39, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `minimum` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class MinLengthAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The minimum length.\n\t/// \n\tpublic uint Length { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MinLengthAttribute(uint length)\n\t{\n\t\tLength = length;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (context.Type != typeof(string)) return;\n\n\t\tcontext.Intents.Add(new MinLengthIntent(Length));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `minimum` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t" + }, + { + "title": "src/JsonSchema.Generation/Attributes/MultipleOfAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/MultipleOfAttribute.cs#L1-L40", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/MultipleOfAttribute.cs", + "startLine": 1, + "endLine": 40, + "content": "using System;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `multipleOf` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class MultipleOfAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The divisor.\n\t/// \n\tpublic decimal Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MultipleOfAttribute(double value)\n\t{\n\t\tValue = (decimal)value;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (!context.Type.IsNumber() && !context.Type.IsNullableNumber()) return;\n\n\t\tcontext.Intents.Add(new MultipleOfIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing Json.More;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `multipleOf` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | Attrib" + }, + { + "title": "src/JsonSchema.Generation/Attributes/NullableAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/NullableAttribute.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/NullableAttribute.cs", + "startLine": 1, + "endLine": 33, + "content": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Overrides the nullability declared in code and either adds or removes `null` in the `type` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]\npublic class NullableAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// Gets whether `null` should be included in the `type` keyword.\n\t/// \n\tpublic bool IsNullable { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// Whether `null` should be included in the `type` keyword.\n\tpublic NullableAttribute(bool isNullable)\n\t{\n\t\tIsNullable = isNullable;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Overrides the nullability declared in code and either adds or removes `null` in the `type` keyword.\n/// \n[AttributeUsage(AttributeTargets.Prop" + }, + { + "title": "src/JsonSchema.Generation/Attributes/PatternAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/PatternAttribute.cs#L1-L40", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/PatternAttribute.cs", + "startLine": 1, + "endLine": 40, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `pattern` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class PatternAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The regular expression pattern.\n\t/// \n\tpublic string Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic PatternAttribute([StringSyntax(StringSyntaxAttribute.Regex)] string value)\n\t{\n\t\tValue = value;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (context.Type != typeof(string)) return;\n\n\t\tcontext.Intents.Add(new PatternIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `pattern` keyword.\n/// \n[AttributeUsage(AttributeTarget" + }, + { + "title": "src/JsonSchema.Generation/Attributes/ReadOnlyAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/ReadOnlyAttribute.cs#L1-L46", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/ReadOnlyAttribute.cs", + "startLine": 1, + "endLine": 46, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `readOnly` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class ReadOnlyAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// Whether the property should be read-only.\n\t/// \n\tpublic bool Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance with a value of `true`.\n\t/// \n\tpublic ReadOnlyAttribute()\n\t\t: this(true)\n\t{\n\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ReadOnlyAttribute(bool value)\n\t{\n\t\tValue = value;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tcontext.Intents.Add(new ReadOnlyIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `readOnly` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n" + }, + { + "title": "src/JsonSchema.Generation/Attributes/RequiredAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/RequiredAttribute.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/RequiredAttribute.cs", + "startLine": 1, + "endLine": 15, + "content": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Indicates a property is required and should be listed in the\n/// `required` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]\npublic class RequiredAttribute : ConditionalAttribute\n{\n#pragma warning disable CS8618\n\tinternal string PropertyName { get; set; }\n#pragma warning restore CS8618\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Indicates a property is required and should be listed in the\n/// `required` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | Attribut" + }, + { + "title": "src/JsonSchema.Generation/Attributes/SchemaHandlerAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/SchemaHandlerAttribute.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/SchemaHandlerAttribute.cs", + "startLine": 1, + "endLine": 25, + "content": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Registers a source generation schema handler for a target type.\n/// \n[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]\npublic sealed class SchemaHandlerAttribute : Attribute\n{\n\t/// \n\t/// The target type handled by the attributed handler.\n\t/// \n\tpublic Type TargetType { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The target type handled by the schema handler.\n\tpublic SchemaHandlerAttribute(Type targetType)\n\t{\n\t\tTargetType = targetType;\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Registers a source generation schema handler for a target type.\n/// \n[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]\npublic sea" + }, + { + "title": "src/JsonSchema.Generation/Attributes/TitleAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/TitleAttribute.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/TitleAttribute.cs", + "startLine": 1, + "endLine": 37, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `title` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class TitleAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// The title.\n\t/// \n\tpublic string Title { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic TitleAttribute(string title)\n\t{\n\t\tTitle = title;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tcontext.Intents.Add(new TitleIntent(Title));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `title` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t" + }, + { + "title": "src/JsonSchema.Generation/Attributes/UniqueItemsAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/UniqueItemsAttribute.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/UniqueItemsAttribute.cs", + "startLine": 1, + "endLine": 39, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `uniqueItems` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class UniqueItemsAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// Whether the items should be unique.\n\t/// \n\tpublic bool Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic UniqueItemsAttribute(bool value)\n\t{\n\t\tValue = value;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tif (!context.Type.IsArray() || context.Type == typeof(string)) return;\n\n\t\tcontext.Intents.Add(new UniqueItemsIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `uniqueItems` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field" + }, + { + "title": "src/JsonSchema.Generation/Attributes/WriteOnlyAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Attributes/WriteOnlyAttribute.cs#L1-L45", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Attributes/WriteOnlyAttribute.cs", + "startLine": 1, + "endLine": 45, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `writeOnly` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |\n\t\t\t\tAttributeTargets.Enum | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface,\n\tAllowMultiple = true)]\npublic class WriteOnlyAttribute : ConditionalAttribute, INestableAttribute, IAttributeHandler\n{\n\t/// \n\t/// Whether the property should be write-only.\n\t/// \n\tpublic bool Value { get; }\n\n\t/// \n\t/// The index of the parameter to which the attribute should apply. Default is -1 to indicate the root.\n\t/// \n\tpublic int GenericParameter { get; set; } = -1;\n\n\t/// \n\t/// Creates a new instance with a value of `true`.\n\t/// \n\tpublic WriteOnlyAttribute()\n\t\t: this(true)\n\t{\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic WriteOnlyAttribute(bool value)\n\t{\n\t\tValue = value;\n\t}\n\n\tvoid IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute)\n\t{\n\t\tcontext.Intents.Add(new WriteOnlyIntent(Value));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Applies a `writeOnly` keyword.\n/// \n[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |" + }, + { + "title": "src/JsonSchema.Generation/ContextExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/ContextExtensions.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/ContextExtensions.cs", + "startLine": 1, + "endLine": 28, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Extension methods for context objects.\n/// \npublic static class ContextExtensions\n{\n\t/// \n\t/// Gets the attribute set. Type contexts get type attributes; member context\n\t/// get member attributes.\n\t/// \n\t/// The context.\n\t/// The attribute set.\n\t/// Thrown for other context types.\n\tpublic static IEnumerable GetAttributes(this SchemaGenerationContextBase context) =>\n\t\tcontext switch\n\t\t{\n\t\t\tMemberGenerationContext memberContext => memberContext.Attributes.Where(x => x is not INestableAttribute nestable ||\n\t\t\t nestable.GenericParameter == memberContext.Parameter),\n\t\t\tTypeGenerationContext typeContext => typeContext.Type.GetCustomAttributes(),\n\t\t\t_ => throw new InvalidOperationException($\"Unknown context type: {context.GetType().Name}\")\n\t\t};\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Extension methods for context objects.\n/// \npublic static class " + }, + { + "title": "src/JsonSchema.Generation/DotnetCompatibility.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/DotnetCompatibility.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/DotnetCompatibility.cs", + "startLine": 1, + "endLine": 23, + "content": "#if !NET9_0_OR_GREATER\n\nusing System;\nusing System.Collections.Generic;\n\nnamespace Json.Schema.Generation;\n\ninternal static class DotnetCompatibility\n{\n\tpublic static IEnumerable DistinctBy(this IEnumerable items, Func selector)\n\t{\n\t\tvar found = new HashSet();\n\t\tforeach (var item in items)\n\t\t{\n\t\t\tvar target = selector(item);\n\t\t\tif (!found.Add(target)) continue;\n\n\t\t\tyield return item;\n\t\t}\n\t}\n}\n\n#endif", + "snippet": "#if !NET9_0_OR_GREATER\n\nusing System;\nusing System.Collections.Generic;\n\nnamespace Json.Schema.Generation;\n\ninternal static class DotnetCompatibility\n{\n\tpublic static IEnumerable DistinctBy(this IE" + }, + { + "title": "src/JsonSchema.Generation/GeneralExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/GeneralExtensions.cs#L1-L42", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/GeneralExtensions.cs", + "startLine": 1, + "endLine": 42, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\ninternal static class GeneralExtensions\n{\n\tpublic static decimal ClampToDecimal(this double value)\n\t{\n\t\treturn value <= (double)decimal.MinValue\n\t\t\t? decimal.MinValue\n\t\t\t: (double)decimal.MaxValue <= value\n\t\t\t\t? decimal.MaxValue\n\t\t\t\t: Convert.ToDecimal(value);\n\t}\n\n\tpublic static List AsNullable(this List source)\n\t{\n\t\tvar newList = new List(source);\n\t\t\n\t\tvar enumIntent = newList.OfType().FirstOrDefault();\n\t\tif (enumIntent is not null)\n\t\t{\n\t\t\tvar index = newList.IndexOf(enumIntent);\n\t\t\tvar newIntent = new EnumIntent([..enumIntent.Names, (JsonNode?)null]);\n\t\t\tnewList[index] = newIntent;\n\t\t}\n\n\t\tvar typeIntent = newList.OfType().FirstOrDefault();\n\t\tif (typeIntent is not null)\n\t\t{\n\t\t\tvar index = newList.IndexOf(typeIntent);\n\t\t\tvar newIntent = new TypeIntent(typeIntent.Type | SchemaValueType.Null);\n\t\t\tnewList[index] = newIntent;\n\t\t}\n\n\t\treturn newList;\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\ninternal static class GeneralExtensions\n{\n\tpublic" + }, + { + "title": "src/JsonSchema.Generation/GeneratorRegistry.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/GeneratorRegistry.cs#L1-L54", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/GeneratorRegistry.cs", + "startLine": 1, + "endLine": 54, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Json.Schema.Generation.Generators;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Tracks the available generators.\n/// \npublic static class GeneratorRegistry\n{\n\tprivate static readonly List _generators =\n\t\t[\n\t\t\tnew NullableValueTypeSchemaGenerator(),\n\t\t\tnew BooleanSchemaGenerator(),\n\t\t\tnew IntegerSchemaGenerator(),\n\t\t\tnew NumberSchemaGenerator(),\n\t\t\tnew StringSchemaGenerator(),\n\t\t\tnew EnumGenerator(),\n\t\t\tnew DateTimeSchemaGenerator(),\n\t\t\tnew GuidSchemaGenerator(),\n\t\t\tnew JsonPointerSchemaGenerator(),\n\t\t\tnew JsonNodeSchemaGenerator(),\n\t\t\tnew JsonArraySchemaGenerator(),\n\t\t\tnew JsonObjectSchemaGenerator(),\n\t\t\tnew JsonValueSchemaGenerator(),\n\t\t\tnew UriSchemaGenerator(),\n\t\t\t// the dictionary ones are enumerable, so they need to come before the array one\n\t\t\tnew StringDictionarySchemaGenerator(),\n\t\t\tnew EnumDictionarySchemaGenerator(),\n\t\t\tnew ArraySchemaGenerator(),\n\t\t\t// this must always be last because it thinks it can do everything\n\t\t\tnew ObjectSchemaGenerator()\n\t\t];\n\n\t/// \n\t/// Registers a new generator.\n\t/// \n\t/// The generator.\n\t/// \n\t/// Registration is order dependent: last one wins. If you have multiple generators which\n\t/// can handle a given type, the last one registered will be used.\n\t/// \n\tpublic static void Register(ISchemaGenerator generator)\n\t{\n\t\t_generators.Insert(0, generator);\n\t}\n\n\tinternal static ISchemaGenerator? Get(Type type)\n\t{\n\t\treturn _generators.FirstOrDefault(g => g.Handles(type));\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Json.Schema.Generation.Generators;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Tracks the available generators.\n/// \npublic sta" + }, + { + "title": "src/JsonSchema.Generation/Generators/ArraySchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/ArraySchemaGenerator.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/ArraySchemaGenerator.cs", + "startLine": 1, + "endLine": 39, + "content": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class ArraySchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type.IsArray();\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.Array));\n\n\t\tType? itemType = null;\n\n\t\tif (context.Type.IsGenericType)\n\t\t\titemType = context.Type.GetGenericArguments().First();\n\t\telse if (context.Type.IsArray)\n\t\t\titemType = context.Type.GetElementType();\n\t\telse if (typeof(IEnumerable).IsAssignableFrom(context.Type))\n\t\t\titemType = context.Type.GetInterfaces()\n\t\t\t\t.FirstOrDefault(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IEnumerable<>))\n\t\t\t\t?.GetGenericArguments().First();\n\n\t\tif (itemType == null) return;\n\n\t\tvar itemTypeContext = SchemaGenerationContextCache.Get(itemType);\n\t\tvar itemMemberContext = new MemberGenerationContext(itemTypeContext, []) { Parameter = 0 };\n\t\tcontext.Intents.Add(new ItemsIntent(itemMemberContext));\n\n\t\titemMemberContext.GenerateIntents();\n\t}\n}", + "snippet": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class ArraySchemaGenerator : ISch" + }, + { + "title": "src/JsonSchema.Generation/Generators/BooleanSchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/BooleanSchemaGenerator.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/BooleanSchemaGenerator.cs", + "startLine": 1, + "endLine": 17, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class BooleanSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(bool);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.Boolean));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class BooleanSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(boo" + }, + { + "title": "src/JsonSchema.Generation/Generators/DateTimeSchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/DateTimeSchemaGenerator.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/DateTimeSchemaGenerator.cs", + "startLine": 1, + "endLine": 18, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class DateTimeSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(DateTime);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.String));\n\t\tcontext.Intents.Add(new FormatIntent(Formats.DateTime));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class DateTimeSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(Da" + }, + { + "title": "src/JsonSchema.Generation/Generators/EnumDictionarySchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/EnumDictionarySchemaGenerator.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/EnumDictionarySchemaGenerator.cs", + "startLine": 1, + "endLine": 39, + "content": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class EnumDictionarySchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\tif (!type.IsGenericType) return false;\n\n\t\tvar generic = type.GetGenericTypeDefinition();\n\t\tif (generic != typeof(IDictionary<,>) &&\n\t\t\tgeneric != typeof(Dictionary<,>) &&\n\t\t\tgeneric != typeof(ConcurrentDictionary<,>))\n\t\t\treturn false;\n\n\t\tvar keyType = type.GenericTypeArguments[0];\n\t\treturn keyType.IsEnum;\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.Object));\n\n\t\tvar keyType = context.Type.GenericTypeArguments[0];\n\t\tvar keyContext = SchemaGenerationContextCache.Get(keyType);\n\t\tcontext.Intents.Add(new PropertyNamesIntent(keyContext));\n\n\t\tvar valueType = context.Type.GenericTypeArguments[1];\n\t\tvar valueTypeContext = SchemaGenerationContextCache.Get(valueType);\n\t\tvar valueMemberContext = new MemberGenerationContext(valueTypeContext, []) { Parameter = 1 };\n\t\tcontext.Intents.Add(new AdditionalPropertiesIntent(valueMemberContext));\n\n\t\tvalueMemberContext.GenerateIntents();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class EnumDictionarySchemaGenerator : ISc" + }, + { + "title": "src/JsonSchema.Generation/Generators/EnumGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/EnumGenerator.cs#L1-L54", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/EnumGenerator.cs", + "startLine": 1, + "endLine": 54, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Generation.Intents;\n#pragma warning disable IL2075\n#pragma warning disable IL3050\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class EnumGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type.IsEnum;\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tbool ShouldIncludeMember(object enumMember)\n\t\t{\n\t\t\tvar fieldInfo = context.Type.GetField(enumMember.ToString()!);\n\t\t\tvar fieldAttributes = fieldInfo?.GetCustomAttributes(true).ToList();\n\n\t\t\t// JsonIgnoreCondition values other than Never and Always don't make sense in the context of JSON schema generation,\n\t\t\t// so we only ignore members if they are marked as \"always ignored.\"\n\t\t\tvar ignoreAttribute =\n\t\t\t\t(Attribute?)fieldAttributes?.OfType().FirstOrDefault(a => a.Condition == JsonIgnoreCondition.Always) ??\n\t\t\t\tfieldAttributes?.OfType().FirstOrDefault();\n\n\t\t\treturn ignoreAttribute == null;\n\t\t};\n\n\t\tstring GetName(object enumMember)\n\t\t{\n#if NET9_0_OR_GREATER\n\t\t\tvar fieldInfo = context.Type.GetField(enumMember.ToString()!);\n\t\t\tvar fieldAttributes = fieldInfo?.GetCustomAttributes(true).ToList();\n\n\t\t\tvar enumNameAttribute = fieldAttributes?.OfType().FirstOrDefault();\n\n\t\t\treturn enumNameAttribute?.Name ?? enumMember.ToString()!;\n#else\n\t\t\treturn enumMember.ToString()!;\n#endif\n\t\t}\n\n\t\tvar includedValues = Enum.GetValues(context.Type)\n\t\t\t.Cast()\n\t\t\t.Where(ShouldIncludeMember)\n\t\t\t.Select(GetName)\n\t\t\t.ToList();\n\t\tcontext.Intents.Add(new EnumIntent(includedValues));\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Generation.Intents;\n#pragma warning disable IL2075\n#pragma warning disable IL3050\n\nnamespace Json.Schema.Generation.Generators;\n\nin" + }, + { + "title": "src/JsonSchema.Generation/Generators/GuidSchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/GuidSchemaGenerator.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/GuidSchemaGenerator.cs", + "startLine": 1, + "endLine": 18, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class GuidSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(Guid);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.String));\n\t\tcontext.Intents.Add(new FormatIntent(Formats.Uuid));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class GuidSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(Guid);" + }, + { + "title": "src/JsonSchema.Generation/Generators/IntegerSchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/IntegerSchemaGenerator.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/IntegerSchemaGenerator.cs", + "startLine": 1, + "endLine": 23, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class IntegerSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(byte) ||\n\t\t\t type == typeof(short) ||\n\t\t\t type == typeof(ushort) ||\n\t\t\t type == typeof(int) ||\n\t\t\t type == typeof(uint) ||\n\t\t\t type == typeof(long) ||\n\t\t\t type == typeof(ulong);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.Integer));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class IntegerSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(byt" + }, + { + "title": "src/JsonSchema.Generation/Generators/ISchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/ISchemaGenerator.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/ISchemaGenerator.cs", + "startLine": 1, + "endLine": 30, + "content": "using System;\n\nnamespace Json.Schema.Generation.Generators;\n\n/// \n/// Defines a generator.\n/// \n/// \n///\tGenerators are the first stage of schema generation. These will add keyword intents\n/// to the context, which then are translated into keywords after optimization.\n///\n/// Implementations MUST also override \n/// \npublic interface ISchemaGenerator\n{\n\t/// \n\t/// Determines whether the generator can be used to generate a schema for this type.\n\t/// \n\t/// The type.\n\t/// `true` if the generator can be used; `false` otherwise.\n\tbool Handles(Type type);\n\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\tvoid AddConstraints(SchemaGenerationContextBase context);\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation.Generators;\n\n/// \n/// Defines a generator.\n/// \n/// \n///\tGenerators are the first stage of schema generation. These will add keyword intents\n//" + }, + { + "title": "src/JsonSchema.Generation/Generators/JsonArraySchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/JsonArraySchemaGenerator.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/JsonArraySchemaGenerator.cs", + "startLine": 1, + "endLine": 18, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class JsonArraySchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(JsonArray);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.Array));\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class JsonArraySchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type" + }, + { + "title": "src/JsonSchema.Generation/Generators/JsonNodeSchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/JsonNodeSchemaGenerator.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/JsonNodeSchemaGenerator.cs", + "startLine": 1, + "endLine": 17, + "content": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class JsonNodeSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(JsonNode);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\t// don't add anything. really, we want a true schema here.\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class JsonNodeSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(JsonNode);" + }, + { + "title": "src/JsonSchema.Generation/Generators/JsonObjectSchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/JsonObjectSchemaGenerator.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/JsonObjectSchemaGenerator.cs", + "startLine": 1, + "endLine": 18, + "content": "using System;\nusing System.Text.Json.Nodes;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class JsonObjectSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(JsonObject);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.Object));\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class JsonObjectSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type typ" + }, + { + "title": "src/JsonSchema.Generation/Generators/JsonPointerSchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/JsonPointerSchemaGenerator.cs#L1-L19", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/JsonPointerSchemaGenerator.cs", + "startLine": 1, + "endLine": 19, + "content": "using System;\nusing Json.Pointer;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class JsonPointerSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(JsonPointer);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.String));\n\t\tcontext.Intents.Add(new FormatIntent(Formats.JsonPointer));\n\t}\n}", + "snippet": "using System;\nusing Json.Pointer;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class JsonPointerSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\tr" + }, + { + "title": "src/JsonSchema.Generation/Generators/JsonValueSchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/JsonValueSchemaGenerator.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/JsonValueSchemaGenerator.cs", + "startLine": 1, + "endLine": 17, + "content": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class JsonValueSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(JsonValue);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\t// don't add constraints; any JSON value is fine here\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class JsonValueSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(JsonValue" + }, + { + "title": "src/JsonSchema.Generation/Generators/NullableValueTypeSchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/NullableValueTypeSchemaGenerator.cs#L1-L21", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/NullableValueTypeSchemaGenerator.cs", + "startLine": 1, + "endLine": 21, + "content": "using System;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class NullableValueTypeSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type.IsNullableValueType();\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tvar underlyingType = Nullable.GetUnderlyingType(context.Type);\n\n\t\tif (underlyingType == null) return;\n\t\tvar underlyingContext = SchemaGenerationContextCache.Get(underlyingType);\n\n\t\tcontext.Intents.AddRange(underlyingContext.Intents);\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class NullableValueTypeSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type.IsNullableValueType();\n\t}\n\n\tpublic void A" + }, + { + "title": "src/JsonSchema.Generation/Generators/NumberSchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/NumberSchemaGenerator.cs#L1-L19", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/NumberSchemaGenerator.cs", + "startLine": 1, + "endLine": 19, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class NumberSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(float) ||\n\t\t\t type == typeof(double) ||\n\t\t\t type == typeof(decimal);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.Number));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class NumberSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(floa" + }, + { + "title": "src/JsonSchema.Generation/Generators/ObjectSchemaGenerator.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/ObjectSchemaGenerator.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/ObjectSchemaGenerator.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class ObjectSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn true;\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tif (context is not TypeGenerationContext typeContext) return;\n\n\t\tif (typeContext.Type == typeof(object)) return;\n\n\t\ttypeContext.Intents.Add(new TypeIntent(SchemaValueType.Object));\n\n\t\tvar props = new Dictionary();\n\t\tvar required = new List();\n\t\tvar propertiesToGenerate = typeContext.Type.GetProperties(BindingFlags.Public | BindingFlags.Instance)\n\t\t\t.Where(x => x.GetMethod is null || x.GetMethod.GetParameters().Length == 0)\n\t\t\t.Where(x => x.SetMethod is null || x.SetMethod.GetParameters().Length == 1); // value\n\t\tvar fieldsToGenerate = typeContext.Type.GetFields(BindingFlags.Public | BindingFlags.Instance);\n\t\tvar hiddenPropertiesToGenerate = typeContext.Type.GetProperties(BindingFlags.NonPublic | BindingFlags.Instance)\n\t\t\t.Where(p => p.GetCustomAttribute() != null);\n\t\tvar hiddenFieldsToGenerate = typeContext.Type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)\n\t\t\t.Where(p => p.GetCustomAttribute() != null);\n\t\tvar membersToGenerate = propertiesToGenerate.Cast()\n\t\t\t.Concat(fieldsToGenerate)\n\t\t\t.Concat(hiddenPropertiesToGenerate)\n\t\t\t.Concat(hiddenFieldsToGenerate)\n\t\t\t.GroupBy(p=> p.Name)\n\t\t\t.Select(g=> g.First())\n\t\t\t.ToList();\n\n\t\tmembersToGenerate = SchemaGeneratorConfiguration.Current.PropertyOrder switch\n\t\t{\n\t\t\tPropertyOrder.AsDeclared => [.. membersToGenerate.OrderBy(m => m, typeContext.DeclarationOrderComparer)],\n\t\t\tPropertyOrder.ByName => [.. membersToGenerate.OrderBy(m => m.Name)],\n\t\t\t_ => membersToGenerate\n\t\t};\n\n\t\tvar conditionalAttributes = new Dictionary>();\n\t\tvar strictPropertyDefinitions = new Dictionary<(object, string), MemberGenerationContext>();\n\t\tvar addUnevaluatedProperties = false;\n\n\t\tforeach (var member in membersToGenerate)\n\t\t{\n\t\t\tvar memberAttributes = member.GetCustomAttributes().ToList();\n\t\t\tvar ignoreAttribute = (Attribute?)memberAttributes.OfType().FirstOrDefault(a => a.Condition == JsonIgnoreCondition.Always) ??\n\t\t\t\t\t\t\t\t memberAttributes.OfType().FirstOrDefault();\n\t\t\tif (ignoreAttribute != null) continue;\n\n\t\t\tif (!memberAttributes.OfType().Any())\n\t\t\t{\n\t\t\t\tvar comments = SchemaGeneratorConfiguration.Current.XmlReader.GetMemberComments(member);\n\t\t\t\tif (!string.IsNullOrWhiteSpace(comments.Summary))\n\t\t\t\t\tmemberAttributes.Add(new DescriptionAttribute(comments.Summary!));\n\t\t\t}\n\n\t\t\tvar unconditionalAttributes = memberAttributes.Where(x => x is not ConditionalAttribute sga || sga.ConditionGroup == null).ToList();\n\t\t\tvar localConditionalAttributes = memberAttributes.Except(unconditionalAttributes).OfType().ToList();\n\t\t\tforeach (var conditions in localConditionalAttributes.GroupBy(x => x.ConditionGroup))\n\t\t\t{\n\t\t\t\tif (!conditionalAttributes.TryGetValue(conditions.Key!, out var list))\n\t\t\t\t\tconditionalAttributes[conditions.Key!] = list = [];\n\n\t\t\t\tlist.AddRange(conditions.Select(x => (member, x)));\n\t\t\t}\n\n\t\t\tif (member.IsReadOnly() && !unconditionalAttributes.OfType().Any())\n\t\t\t\tunconditionalAttributes.Add(new ReadOnlyAttribute(true));\n\n\t\t\tif (member.IsWriteOnly() && !unconditionalAttributes.OfType().Any())\n\t\t\t\tunconditionalAttributes.Add(new WriteOnlyAttribute(true));\n\n\t\t\tvar memberTypeContext = SchemaGenerationContextCache.Get(member.GetMemberType());\n\t\t\tvar memberContext = new MemberGenerationContext(memberTypeContext, unconditionalAttributes, member.IsMarkedAsNullable());\n\t\t\tmemberContext.GenerateIntents();\n\n\t\t\tvar name = SchemaGeneratorConfiguration.Current.PropertyNameResolver!(member);\n\t\t\tvar nameAttribute = unconditionalAttributes.OfType().FirstOrDefault();\n\t\t\tif (nameAttribute != null)\n\t\t\t\tname = nameAttribute.Name;\n\n\t\t\tif (unconditionalAttributes.OfType().Any())\n\t\t\t{\n\t\t\t\tmemberContext.Intents.Add(new DeprecatedIntent(true));\n\t\t\t}\n\n\t\t\tif (SchemaGeneratorConfiguration.Current.StrictConditionals &&\n\t\t\t\tlocalConditionalAttributes.Count != 0)\n\t\t\t{\n\t\t\t\taddUnevaluatedProperties = true;\n\t\t\t\tvar applicableConditionGroups = localConditionalAttributes.Select(x => x.ConditionGroup).Distinct();\n\t\t\t\tforeach (var conditionGroup in applicableConditionGroups)\n\t\t\t\t{\n\t\t\t\t\tstrictPropertyDefinitions.Add((conditionGroup!, name), memberContext);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t\tprops.Add(name, memberContext);\n\n\t\t\tif (unconditionalAttributes.OfType().Any()\n#if NET7_0_OR_GREATER\n\t\t\t || unconditionalAttributes.OfType().Any()\n#endif\n\t\t\t || unconditionalAttributes.OfType().Any()\n\t\t\t )\n\t\t\t\trequired.Add(name);", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Gen" + }, + { + "title": "src/JsonSchema.Generation/Generators/ObjectSchemaGenerator.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/ObjectSchemaGenerator.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/ObjectSchemaGenerator.cs", + "startLine": 121, + "endLine": 240, + "content": "foreach (var conditionalRequiredAttribute in localConditionalAttributes.OfType())\n\t\t\t{\n\t\t\t\tconditionalRequiredAttribute.PropertyName = name;\n\t\t\t}\n\t\t}\n\n\t\tif (props.Count > 0)\n\t\t{\n\t\t\tcontext.Intents.Add(new PropertiesIntent(props.ToDictionary(x => x.Key, SchemaGenerationContextBase (x) => x.Value)));\n\n\t\t\tif (required.Count > 0)\n\t\t\t\tcontext.Intents.Add(new RequiredIntent(required));\n\t\t}\n\n\t\tvar conditionGroups = context.Type.GetCustomAttributes()\n\t\t\t.OfType()\n\t\t\t.SelectMany(x => ExpandEnumConditions(x, membersToGenerate))\n\t\t\t.GroupBy(x => x.Attribute.ConditionGroup)\n\t\t\t.ToList();\n\n\t\tif (conditionGroups.Count == 0) return;\n\n\t\tif (conditionGroups.Count == 1)\n\t\t{\n\t\t\t// add directly to schema\n\t\t\tvar conditionKey = conditionGroups[0].Key!;\n\t\t\tif (conditionalAttributes.TryGetValue(conditionKey, out var consequences))\n\t\t\t{\n\t\t\t\tvar strictProperties = strictPropertyDefinitions.Where(x => Equals(x.Key.Item1, conditionKey))\n\t\t\t\t\t.ToDictionary(x => x.Key.Item2, x => x.Value);\n\t\t\t\tvar thenSubschema = GenerateThen(consequences, strictProperties);\n\n\t\t\t\tif (thenSubschema != null)\n\t\t\t\t{\n\t\t\t\t\tcontext.Intents.Add(GenerateIf(conditionGroups[0]));\n\t\t\t\t\tcontext.Intents.Add(thenSubschema);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// wrap in allOf\n\t\t\tvar allOf = new AllOfIntent();\n\t\t\tforeach (var conditionGroup in conditionGroups)\n\t\t\t{\n\t\t\t\tvar conditionKey = conditionGroup.Key!;\n\t\t\t\tif (conditionalAttributes.TryGetValue(conditionKey, out var consequences))\n\t\t\t\t{\n\t\t\t\t\tvar strictProperties = strictPropertyDefinitions.Where(x => Equals(x.Key.Item1, conditionKey))\n\t\t\t\t\t\t.ToDictionary(x => x.Key.Item2, x => x.Value);\n\t\t\t\t\tvar thenSubschema = GenerateThen(consequences, strictProperties);\n\n\t\t\t\t\tif (thenSubschema != null)\n\t\t\t\t\t\tallOf.Subschemas.Add(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tGenerateIf(conditionGroup),\n\t\t\t\t\t\t\tthenSubschema\n\t\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (allOf.Subschemas.Count != 0)\n\t\t\t\tcontext.Intents.Add(allOf);\n\t\t}\n\n\t\tif (addUnevaluatedProperties)\n\t\t\tcontext.Intents.Add(new UnevaluatedPropertiesIntent());\n\t}\n\n\tprivate static IEnumerable<(IConditionalAttribute Attribute, MemberInfo Member)> ExpandEnumConditions(IConditionalAttribute condition, IEnumerable members)\n\t{\n\t\tvar member = members.FirstOrDefault(x => x.Name == condition.PropertyName);\n\t\tif (member == null) yield break;\n\n\t\tvar memberType = member.GetMemberType();\n\t\tswitch (condition)\n\t\t{\n\t\t\tcase IfMinAttribute min:\n\t\t\t\tmin.PropertyType = memberType;\n\t\t\t\tbreak;\n\t\t\tcase IfMaxAttribute max:\n\t\t\t\tmax.PropertyType = memberType;\n\t\t\t\tbreak;\n\t\t\tcase IfEnumAttribute when !memberType.IsEnum:\n\t\t\t\tyield break;\n\t\t\tcase IfEnumAttribute ifEnumAttribute:\n\t\t\t\tvar fields = memberType.GetFields(BindingFlags.Public | BindingFlags.Static);\n\t\t\t\tvar values = fields.Select(f => f.GetRawConstantValue()); \n\t\t\t\t//var values = Enum.GetValues(memberType);\n\t\t\t\tforeach (var value in values)\n\t\t\t\t{\n\t\t\t\t\tif (ifEnumAttribute.UseNumbers)\n\t\t\t\t\t\tyield return (new IfAttribute(ifEnumAttribute.PropertyName, (int)value!, value), member);\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tvar enumValue = Enum.ToObject(memberType, (int)value!);\n\t\t\t\t\t\tyield return (new IfAttribute(ifEnumAttribute.PropertyName, enumValue!.ToString(), enumValue), member);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tyield break;\n\t\t}\n\t\tyield return (condition, member);\n\t}\n\n\tprivate static IfIntent GenerateIf(IEnumerable<(IConditionalAttribute Attribute, MemberInfo Member)> conditions)\n\t{\n\t\tstatic void AddPotentialValue(SchemaGenerationContextBase context, JsonNode? newValue)\n\t\t{\n\t\t\tvar existingConst = context.Intents.OfType().SingleOrDefault();\n\t\t\tif (existingConst is not null)\n\t\t\t{\n\t\t\t\tcontext.Intents.Remove(existingConst);\n\t\t\t\tcontext.Intents.Add(new EnumIntent(existingConst.Value, newValue));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar existingEnum = context.Intents.OfType().SingleOrDefault();\n\t\t\tif (existingEnum is not null)\n\t\t\t{\n\t\t\t\texistingEnum.AddValue(newValue);", + "snippet": "foreach (var conditionalRequiredAttribute in localConditionalAttributes.OfType())\n\t\t\t{\n\t\t\t\tconditionalRequiredAttribute.PropertyName = name;\n\t\t\t}\n\t\t}\n\n\t\tif (props.Count > 0)\n\t\t{\n\t\t\tcontext.Intents.Add(" + }, + { + "title": "src/JsonSchema.Generation/Generators/ObjectSchemaGenerator.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/ObjectSchemaGenerator.cs#L241-L323", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/ObjectSchemaGenerator.cs", + "startLine": 241, + "endLine": 323, + "content": "return;\n\t\t\t}\n\n\t\t\tcontext.Intents.Add(new ConstIntent(newValue));\n\t\t}\n\n\t\tvar properties = new Dictionary();\n\t\tvar required = new List();\n\t\tforeach (var condition in conditions)\n\t\t{\n\t\t\tvar name = SchemaGeneratorConfiguration.Current.PropertyNameResolver!(condition.Member);\n\t\t\tif (!properties.TryGetValue(name, out var context))\n\t\t\t\tproperties[name] = context = new AdHocGenerationContext();\n\t\t\tswitch (condition.Attribute)\n\t\t\t{\n\t\t\t\tcase IfAttribute ifAtt:\n\t\t\t\t\tAddPotentialValue(context, ifAtt.Value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase IfMinAttribute ifMin:\n\t\t\t\t\tvar minIntent = ifMin.GetIntent();\n\t\t\t\t\tif (minIntent == null) continue;\n\t\t\t\t\tcontext.Intents.Add(minIntent);\n\t\t\t\t\tbreak;\n\t\t\t\tcase IfMaxAttribute ifMax:\n\t\t\t\t\tvar maxIntent = ifMax.GetIntent();\n\t\t\t\t\tif (maxIntent == null) continue;\n\t\t\t\t\tcontext.Intents.Add(maxIntent);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!required.Contains(name))\n\t\t\t\trequired.Add(name);\n\t\t}\n\n\t\tvar ifIntent = new IfIntent([\n\t\t\tnew PropertiesIntent(properties),\n\t\t\tnew RequiredIntent(required)\n\t\t]);\n\n\t\treturn ifIntent;\n\t}\n\n\tprivate static ThenIntent? GenerateThen(List<(MemberInfo member, ConditionalAttribute attribute)> consequences,\n\t\tDictionary prebuiltMemberContexts)\n\t{\n\t\tvar applicable = consequences.Where(x => x.attribute is IAttributeHandler); // should be all\n\t\tvar required = consequences.Where(x => x.attribute is RequiredAttribute)\n\t\t\t.Select(x => ((RequiredAttribute)x.attribute).PropertyName)\n\t\t\t.ToList();\n\t\tvar properties = prebuiltMemberContexts;\n\t\tforeach (var consequence in applicable.GroupBy(x => x.member))\n\t\t{\n\t\t\tvar name = SchemaGeneratorConfiguration.Current.PropertyNameResolver!(consequence.Key);\n\t\t\tif (properties.TryGetValue(name, out var localContext))\n\t\t\t\tlocalContext = new MemberGenerationContext(localContext);\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar type = consequence.Key.GetMemberType();\n\t\t\t\tlocalContext = new MemberGenerationContext(SchemaGenerationContextCache.Get(type), []);\n\t\t\t\tlocalContext.GenerateIntents();\n\t\t\t}\n\t\t\tforeach (var (_, attribute) in consequence)\n\t\t\t{\n\t\t\t\t((IAttributeHandler)attribute).AddConstraints(localContext, attribute);\n\t\t\t}\n\n\t\t\tproperties[name] = localContext;\n\t\t}\n\n\t\tvar thenIntents = new List();\n\n\t\tif (properties.Count != 0)\n\t\t\tthenIntents.Add(new PropertiesIntent(properties.ToDictionary(x => x.Key, SchemaGenerationContextBase (x) => x.Value)));\n\n\t\tif (required.Count != 0)\n\t\t\tthenIntents.Add(new RequiredIntent(required));\n\n\t\tif (thenIntents.Count == 0) return null;\n\n\t\tvar thenIntent = new ThenIntent(thenIntents);\n\n\t\treturn thenIntent;\n\t}\n}", + "snippet": "return;\n\t\t\t}\n\n\t\t\tcontext.Intents.Add(new ConstIntent(newValue));\n\t\t}\n\n\t\tvar properties = new Dictionary();\n\t\tvar required = new List();\n\t\tforeach (var condition in conditions)" + }, + { + "title": "src/JsonSchema.Generation/Generators/StringDictionarySchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/StringDictionarySchemaGenerator.cs#L1-L35", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/StringDictionarySchemaGenerator.cs", + "startLine": 1, + "endLine": 35, + "content": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class StringDictionarySchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\tif (!type.IsGenericType) return false;\n\n\t\tvar generic = type.GetGenericTypeDefinition();\n\t\tif (generic != typeof(IDictionary<,>) &&\n\t\t\tgeneric != typeof(Dictionary<,>) &&\n\t\t\tgeneric != typeof(ConcurrentDictionary<,>))\n\t\t\treturn false;\n\n\t\tvar keyType = type.GenericTypeArguments[0];\n\t\treturn keyType == typeof(string);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.Object));\n\n\t\tvar valueType = context.Type.GenericTypeArguments[1];\n\t\tvar valueTypeContext = SchemaGenerationContextCache.Get(valueType);\n\t\tvar valueMemberContext = new MemberGenerationContext(valueTypeContext, []) { Parameter = 1 };\n\t\tcontext.Intents.Add(new AdditionalPropertiesIntent(valueMemberContext));\n\n\t\tvalueMemberContext.GenerateIntents();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class StringDictionarySchemaGenerator : I" + }, + { + "title": "src/JsonSchema.Generation/Generators/StringSchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/StringSchemaGenerator.cs#L1-L17", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/StringSchemaGenerator.cs", + "startLine": 1, + "endLine": 17, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class StringSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(string);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.String));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class StringSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(stri" + }, + { + "title": "src/JsonSchema.Generation/Generators/UriSchemaGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Generators/UriSchemaGenerator.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Generators/UriSchemaGenerator.cs", + "startLine": 1, + "endLine": 18, + "content": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class UriSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(Uri);\n\t}\n\n\tpublic void AddConstraints(SchemaGenerationContextBase context)\n\t{\n\t\tcontext.Intents.Add(new TypeIntent(SchemaValueType.String));\n\t\tcontext.Intents.Add(new FormatIntent(Formats.Uri));\n\t}\n}", + "snippet": "using System;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Generators;\n\ninternal class UriSchemaGenerator : ISchemaGenerator\n{\n\tpublic bool Handles(Type type)\n\t{\n\t\treturn type == typeof(Uri);\n\t" + }, + { + "title": "src/JsonSchema.Generation/GlobalSuppressions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/GlobalSuppressions.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/GlobalSuppressions.cs", + "startLine": 1, + "endLine": 18, + "content": "// This file is used by Code Analysis to maintain SuppressMessage\n// attributes that are applied to this project.\n// Project-level suppressions either have no target or are given\n// a specific target and scoped to a namespace, type, member, etc.\n\nusing System.Diagnostics.CodeAnalysis;\n\n[assembly: SuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\", Scope = \"member\", Target = \"~M:Json.Schema.Generation.SchemaGenerationContextBase.GetComparer(System.Type)~System.Collections.Generic.IComparer{System.Reflection.MemberInfo}\")]\n[assembly: SuppressMessage(\"Trimming\", \"IL2075:'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations.\", Justification = \"\", Scope = \"member\", Target = \"~M:Json.Schema.Generation.Generators.ArraySchemaGenerator.AddConstraints(Json.Schema.Generation.SchemaGenerationContextBase)\")]\n[assembly: SuppressMessage(\"Trimming\", \"IL2075:'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations.\", Justification = \"\", Scope = \"member\", Target = \"~M:Json.Schema.Generation.Generators.ObjectSchemaGenerator.AddConstraints(Json.Schema.Generation.SchemaGenerationContextBase)\")]\n[assembly: SuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\", Scope = \"member\", Target = \"~M:Json.Schema.Generation.Generators.ObjectSchemaGenerator.ExpandEnumConditions(Json.Schema.Generation.IConditionAttribute,System.Collections.Generic.IEnumerable{System.Reflection.MemberInfo})~System.Collections.Generic.IEnumerable{System.ValueTuple{Json.Schema.Generation.IConditionAttribute,System.Reflection.MemberInfo}}\")]\n[assembly: SuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\", Scope = \"member\", Target = \"~M:Json.Schema.Generation.Intents.ConstIntent.Apply(Json.Schema.JsonSchemaBuilder)\")]\n[assembly: SuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\", Scope = \"member\", Target = \"~M:Json.Schema.Generation.Intents.ConstIntent.Apply(Json.Schema.JsonSchemaBuilder)\")]\n[assembly: SuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\", Scope = \"member\", Target = \"~M:Json.Schema.Generation.Intents.DefaultIntent.Apply(Json.Schema.JsonSchemaBuilder)\")]\n[assembly: SuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\", Scope = \"member\", Target = \"~M:Json.Schema.Generation.Intents.DefaultIntent.Apply(Json.Schema.JsonSchemaBuilder)\")]\n[assembly: SuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"\", Scope = \"member\", Target = \"~F:Json.Schema.Generation.AttributeHandler._externalHandlers\")]\n[assembly: SuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"\", Scope = \"member\", Target = \"~M:Json.Schema.Generation.AttributeHandler.WhereHandled(System.Collections.Generic.IEnumerable{System.Attribute})~System.Collections.Generic.IEnumerable{System.Attribute}\")]", + "snippet": "// This file is used by Code Analysis to maintain SuppressMessage\n// attributes that are applied to this project.\n// Project-level suppressions either have no target or are given\n// a specific target and scoped to a name" + }, + { + "title": "src/JsonSchema.Generation/IAttributeHandler.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/IAttributeHandler.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/IAttributeHandler.cs", + "startLine": 1, + "endLine": 32, + "content": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Defines requirements to handle converting an attribute to a keyword intent.\n/// \npublic interface IAttributeHandler\n{\n\t/// \n\t/// Processes the type and any attributes (present on the context), and adds\n\t/// intents to the context.\n\t/// \n\t/// The generation context.\n\t/// The attribute.\n\t/// \n\t/// A common pattern is to implement on the\n\t/// attribute itself. In this case, the parameter\n\t/// will be the same instance as the handler and can likely be ignored.\n\t/// \n\tvoid AddConstraints(SchemaGenerationContextBase context, Attribute attribute);\n}\n\n/// \n/// Processes attributes of type that are present on a\n/// type or member and adds intents to the context.\n/// \n/// The type of the attribute that is handled.\npublic interface IAttributeHandler : IAttributeHandler\n\twhere T : Attribute\n{\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Defines requirements to handle converting an attribute to a keyword intent.\n/// \npublic interface IAttributeHandler\n{\n\t/// \n\t/// Proc" + }, + { + "title": "src/JsonSchema.Generation/Intents/AdditionalItemsIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/AdditionalItemsIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/AdditionalItemsIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `additionalItems` keyword.\n/// \npublic class AdditionalItemsIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The context that represents the inner requirements.\n\t/// \n\tpublic SchemaGenerationContextBase Context { get; private set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The context.\n\tpublic AdditionalItemsIntent(SchemaGenerationContextBase context)\n\t{\n\t\tContext = context;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.AdditionalItems(Context.Apply());\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `additionalItems` keyword.\n/// \npublic class AdditionalItemsIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The cont" + }, + { + "title": "src/JsonSchema.Generation/Intents/AdditionalPropertiesIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/AdditionalPropertiesIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/AdditionalPropertiesIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `additionalProperties` keyword.\n/// \npublic class AdditionalPropertiesIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The context that represents the inner requirements.\n\t/// \n\tpublic SchemaGenerationContextBase Context { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The context.\n\tpublic AdditionalPropertiesIntent(SchemaGenerationContextBase context)\n\t{\n\t\tContext = context;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.AdditionalProperties(Context.Apply());\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `additionalProperties` keyword.\n/// \npublic class AdditionalPropertiesIntent : ISchemaKeywordIntent\n{\n\t/// \n\t//" + }, + { + "title": "src/JsonSchema.Generation/Intents/AllOfIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/AllOfIntent.cs#L1-L54", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/AllOfIntent.cs", + "startLine": 1, + "endLine": 54, + "content": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `allOf` keyword.\n/// \npublic class AllOfIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// Gets the subschemas to include.\n\t/// \n\tpublic List> Subschemas { get; }\n\n\t/// \n\t/// Creates a new instance of the class.\n\t/// \n\t/// The subschemas to include.\n\tpublic AllOfIntent(IEnumerable> subschemas)\n\t{\n\t\tSubschemas = subschemas.ToList();\n\t}\n\n\t/// \n\t/// Creates a new instance of the class.\n\t/// \n\t/// The subschemas to include.\n\tpublic AllOfIntent(params IEnumerable[] subschemas)\n\t{\n\t\tSubschemas = [.. subschemas];\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.AllOf(Subschemas.Select(Build));\n\t}\n\n\tprivate static JsonSchemaBuilder Build(IEnumerable subschema)\n\t{\n\t\tvar builder = new JsonSchemaBuilder();\n\n\t\tforeach (var intent in subschema)\n\t\t{\n\t\t\tintent.Apply(builder);\n\t\t}\n\n\t\treturn builder;\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `allOf` keyword.\n/// \npublic class AllOfIntent : ISchemaKeywordInte" + }, + { + "title": "src/JsonSchema.Generation/Intents/AnyOfIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/AnyOfIntent.cs#L1-L54", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/AnyOfIntent.cs", + "startLine": 1, + "endLine": 54, + "content": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `anyOf` keyword.\n/// \npublic class AnyOfIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// Gets the subschemas to include.\n\t/// \n\tpublic List> Subschemas { get; }\n\n\t/// \n\t/// Creates a new instance of the class.\n\t/// \n\t/// The subschemas to include.\n\tpublic AnyOfIntent(IEnumerable> subschemas)\n\t{\n\t\tSubschemas = subschemas.ToList();\n\t}\n\n\t/// \n\t/// Creates a new instance of the class.\n\t/// \n\t/// The subschemas to include.\n\tpublic AnyOfIntent(params IEnumerable[] subschemas)\n\t{\n\t\tSubschemas = [.. subschemas];\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.AnyOf(Subschemas.Select(Build));\n\t}\n\n\tprivate static JsonSchemaBuilder Build(IEnumerable subschema)\n\t{\n\t\tvar builder = new JsonSchemaBuilder();\n\n\t\tforeach (var intent in subschema)\n\t\t{\n\t\t\tintent.Apply(builder);\n\t\t}\n\n\t\treturn builder;\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `anyOf` keyword.\n/// \npublic class AnyOfIntent : ISchemaKeywordInte" + }, + { + "title": "src/JsonSchema.Generation/Intents/ConstIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/ConstIntent.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/ConstIntent.cs", + "startLine": 1, + "endLine": 32, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `const` keyword.\n/// \npublic class ConstIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The expected value.\n\t/// \n\tpublic JsonNode? Value { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ConstIntent(JsonNode? value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Const(Value);\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `const` keyword.\n/// \npublic class ConstIntent : ISchemaKeywordIntent\n{\n\t/// \n\t//" + }, + { + "title": "src/JsonSchema.Generation/Intents/DefaultIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/DefaultIntent.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/DefaultIntent.cs", + "startLine": 1, + "endLine": 32, + "content": "using System.Text.Json.Nodes;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `default` keyword.\n/// \npublic class DefaultIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The expected value.\n\t/// \n\tpublic JsonNode? Value { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic DefaultIntent(JsonNode? value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Default(Value);\n\t}\n}", + "snippet": "using System.Text.Json.Nodes;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `default` keyword.\n/// \npublic class DefaultIntent : ISchemaKeywordIntent\n{\n\t/// " + }, + { + "title": "src/JsonSchema.Generation/Intents/DefsIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/DefsIntent.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/DefsIntent.cs", + "startLine": 1, + "endLine": 33, + "content": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `$defs` keyword.\n/// \npublic class DefsIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The contexts that represent the definitions.\n\t/// \n\tpublic Dictionary Definitions { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The contexts.\n\tpublic DefsIntent(Dictionary definitions)\n\t{\n\t\tDefinitions = definitions;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Defs(Definitions.ToDictionary(p => p.Key, p => p.Value.Apply()));\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `$defs` keyword.\n/// \npublic class DefsIntent : ISchemaKeywordInten" + }, + { + "title": "src/JsonSchema.Generation/Intents/DeprecatedIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/DeprecatedIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/DeprecatedIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `deprecated` keyword.\n/// \npublic class DeprecatedIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic bool Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic DeprecatedIntent(bool value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Deprecated(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `deprecated` keyword.\n/// \npublic class DeprecatedIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n/// Provides intent to create a `description` keyword.\n/// \npublic class DescriptionIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic string Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic DescriptionIntent(string value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Description(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `description` keyword.\n/// \npublic class DescriptionIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// <" + }, + { + "title": "src/JsonSchema.Generation/Intents/ElseIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/ElseIntent.cs#L1-L43", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/ElseIntent.cs", + "startLine": 1, + "endLine": 43, + "content": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `else` keyword.\n/// \npublic class ElseIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// A set of intents used to define the subschema.\n\t/// \n\tpublic IEnumerable Subschema { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\tpublic ElseIntent(IEnumerable subschema)\n\t{\n\t\tSubschema = subschema;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Else(Build(Subschema));\n\t}\n\n\tprivate static JsonSchemaBuilder Build(IEnumerable subschema)\n\t{\n\t\tvar builder = new JsonSchemaBuilder();\n\n\t\tforeach (var intent in subschema)\n\t\t{\n\t\t\tintent.Apply(builder);\n\t\t}\n\n\t\treturn builder;\n\t}\n}", + "snippet": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `else` keyword.\n/// \npublic class ElseIntent : ISchemaKeywordIntent\n{\n\t/// \n" + }, + { + "title": "src/JsonSchema.Generation/Intents/EnumIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/EnumIntent.cs#L1-L70", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/EnumIntent.cs", + "startLine": 1, + "endLine": 70, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `enum` keyword.\n/// \npublic class EnumIntent : ISchemaKeywordIntent\n{\n\tprivate readonly List? _values;\n\n\t/// \n\t/// The names defined by the enumeration.\n\t/// \n\tpublic List Names { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The names defined by the enumeration.\n\tpublic EnumIntent(IEnumerable names)\n\t{\n\t\tNames = [.. names];\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The names defined by the enumeration.\n\tpublic EnumIntent(params string[] names)\n\t{\n\t\tNames = [.. names];\n\t}\n\n#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The values defined by the enumeration.\n\tpublic EnumIntent(IEnumerable values)\n\t{\n\t\t_values = [.. values];\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The values defined by the enumeration.\n\tpublic EnumIntent(params JsonNode?[] values)\n\t{\n\t\t_values = [.. values];\n\t}\n#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Enum(_values ?? Names.Select(n => (JsonNode?)n));\n\t}\n\n\tinternal void AddValue(JsonNode? value)\n\t{\n\t\t_values?.Add(value);\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `enum` keyword.\n/// \npublic class En" + }, + { + "title": "src/JsonSchema.Generation/Intents/ExclusiveMaximumIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/ExclusiveMaximumIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/ExclusiveMaximumIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `exclusiveMaximum` keyword.\n/// \npublic class ExclusiveMaximumIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic decimal Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ExclusiveMaximumIntent(decimal value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.ExclusiveMaximum(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `exclusiveMaximum` keyword.\n/// \npublic class ExclusiveMaximumIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The va" + }, + { + "title": "src/JsonSchema.Generation/Intents/ExclusiveMinimumIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/ExclusiveMinimumIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/ExclusiveMinimumIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `exclusiveMinimum` keyword.\n/// \npublic class ExclusiveMinimumIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic decimal Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ExclusiveMinimumIntent(decimal value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.ExclusiveMinimum(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `exclusiveMinimum` keyword.\n/// \npublic class ExclusiveMinimumIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The va" + }, + { + "title": "src/JsonSchema.Generation/Intents/FormatIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/FormatIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/FormatIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `format` keyword.\n/// \npublic class FormatIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The format.\n\t/// \n\tpublic Format Format { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The format.\n\tpublic FormatIntent(Format format)\n\t{\n\t\tFormat = format;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Format(Format);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `format` keyword.\n/// \npublic class FormatIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The format.\n\t/// " + }, + { + "title": "src/JsonSchema.Generation/Intents/IdIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/IdIntent.cs#L1-L31", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/IdIntent.cs", + "startLine": 1, + "endLine": 31, + "content": "using System;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `$id` keyword.\n/// \npublic class IdIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The URI to use as the schema's ID.\n\t/// \n\tpublic Uri Id { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\tpublic IdIntent(Uri uri)\n\t{\n\t\tId = uri;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Id(Id);\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `$id` keyword.\n/// \npublic class IdIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The URI to use as " + }, + { + "title": "src/JsonSchema.Generation/Intents/IfIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/IfIntent.cs#L1-L43", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/IfIntent.cs", + "startLine": 1, + "endLine": 43, + "content": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `if` keyword.\n/// \npublic class IfIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// A set of intents used to define the subschema.\n\t/// \n\tpublic IEnumerable Subschema { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\tpublic IfIntent(IEnumerable subschema)\n\t{\n\t\tSubschema = subschema;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.If(Build(Subschema));\n\t}\n\n\tprivate static JsonSchemaBuilder Build(IEnumerable subschema)\n\t{\n\t\tvar builder = new JsonSchemaBuilder();\n\n\t\tforeach (var intent in subschema)\n\t\t{\n\t\t\tintent.Apply(builder);\n\t\t}\n\n\t\treturn builder;\n\t}\n}", + "snippet": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `if` keyword.\n/// \npublic class IfIntent : ISchemaKeywordIntent\n{\n\t/// \n\t///" + }, + { + "title": "src/JsonSchema.Generation/Intents/ItemsIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/ItemsIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/ItemsIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `items` keyword.\n/// \npublic class ItemsIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The context that represents the inner requirements.\n\t/// \n\tpublic SchemaGenerationContextBase Context { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The context.\n\tpublic ItemsIntent(SchemaGenerationContextBase context)\n\t{\n\t\tContext = context;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Items(Context.Apply());\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `items` keyword.\n/// \npublic class ItemsIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The context that represents " + }, + { + "title": "src/JsonSchema.Generation/Intents/MaximumIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/MaximumIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/MaximumIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `maximum` keyword.\n/// \npublic class MaximumIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic decimal Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MaximumIntent(decimal value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Maximum(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `maximum` keyword.\n/// \npublic class MaximumIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n/// Provides intent to create a `maxItems` keyword.\n/// \npublic class MaxItemsIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic uint Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MaxItemsIntent(uint value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.MaxItems(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `maxItems` keyword.\n/// \npublic class MaxItemsIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n/// Provides intent to create a `maxLength` keyword.\n/// \npublic class MaxLengthIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic uint Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MaxLengthIntent(uint value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.MaxLength(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `maxLength` keyword.\n/// \npublic class MaxLengthIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n/// Provides intent to create a `maxProperties` keyword.\n/// \npublic class MaxPropertiesIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic uint Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MaxPropertiesIntent(uint value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.MaxProperties(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `maxProperties` keyword.\n/// \npublic class MaxPropertiesIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/" + }, + { + "title": "src/JsonSchema.Generation/Intents/MinimumIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/MinimumIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/MinimumIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `minimum` keyword.\n/// \npublic class MinimumIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic decimal Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MinimumIntent(decimal value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Minimum(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `minimum` keyword.\n/// \npublic class MinimumIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n/// Provides intent to create a `minItems` keyword.\n/// \npublic class MinItemsIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic uint Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MinItemsIntent(uint value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.MinItems(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `minItems` keyword.\n/// \npublic class MinItemsIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n/// Provides intent to create a `minLength` keyword.\n/// \npublic class MinLengthIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic uint Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MinLengthIntent(uint value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.MinLength(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `minLength` keyword.\n/// \npublic class MinLengthIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n/// Provides intent to create a `minProperties` keyword.\n/// \npublic class MinPropertiesIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic uint Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MinPropertiesIntent(uint value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.MinProperties(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `minProperties` keyword.\n/// \npublic class MinPropertiesIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/" + }, + { + "title": "src/JsonSchema.Generation/Intents/MultipleOfIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/MultipleOfIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/MultipleOfIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `multipleOf` keyword.\n/// \npublic class MultipleOfIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic decimal Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic MultipleOfIntent(decimal value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.MultipleOf(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `multipleOf` keyword.\n/// \npublic class MultipleOfIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n/// Provides intent to create an `if` keyword.\n/// \npublic class NotIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// A set of intents used to define the subschema.\n\t/// \n\tpublic IEnumerable Subschema { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\tpublic NotIntent(IEnumerable subschema)\n\t{\n\t\tSubschema = subschema;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Not(Build(Subschema));\n\t}\n\n\tprivate static JsonSchemaBuilder Build(IEnumerable subschema)\n\t{\n\t\tvar builder = new JsonSchemaBuilder();\n\n\t\tforeach (var intent in subschema)\n\t\t{\n\t\t\tintent.Apply(builder);\n\t\t}\n\n\t\treturn builder;\n\t}\n}", + "snippet": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `if` keyword.\n/// \npublic class NotIntent : ISchemaKeywordIntent\n{\n\t/// \n\t//" + }, + { + "title": "src/JsonSchema.Generation/Intents/PatternIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/PatternIntent.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/PatternIntent.cs", + "startLine": 1, + "endLine": 32, + "content": "using System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `pattern` keyword.\n/// \npublic class PatternIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic string Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic PatternIntent([StringSyntax(StringSyntaxAttribute.Regex)] string value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Pattern(Value);\n\t}\n}", + "snippet": "using System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `pattern` keyword.\n/// \npublic class PatternIntent : ISchemaKeywordIntent\n{\n\t/// " + }, + { + "title": "src/JsonSchema.Generation/Intents/PropertiesIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/PropertiesIntent.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/PropertiesIntent.cs", + "startLine": 1, + "endLine": 33, + "content": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `additionalProperties` keyword.\n/// \npublic class PropertiesIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The contexts that represent the properties.\n\t/// \n\tpublic Dictionary Properties { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The contexts.\n\tpublic PropertiesIntent(Dictionary properties)\n\t{\n\t\tProperties = properties;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Properties(Properties.ToDictionary(p => p.Key, p => p.Value.Apply()));\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `additionalProperties` keyword.\n/// \npublic class PropertiesIntent" + }, + { + "title": "src/JsonSchema.Generation/Intents/PropertyNamesIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/PropertyNamesIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/PropertyNamesIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `propertyNames` keyword.\n/// \npublic class PropertyNamesIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The context that represents the inner requirements.\n\t/// \n\tpublic SchemaGenerationContextBase Context { get; private set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The context.\n\tpublic PropertyNamesIntent(SchemaGenerationContextBase context)\n\t{\n\t\tContext = context;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.PropertyNames(Context.Apply());\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `propertyNames` keyword.\n/// \npublic class PropertyNamesIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The context t" + }, + { + "title": "src/JsonSchema.Generation/Intents/ReadOnlyIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/ReadOnlyIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/ReadOnlyIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `readOnly` keyword.\n/// \npublic class ReadOnlyIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic bool Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic ReadOnlyIntent(bool value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.ReadOnly(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `readOnly` keyword.\n/// \npublic class ReadOnlyIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n/// Provides intent to create a `$ref` keyword.\n/// \npublic class RefIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The reference.\n\t/// \n\tpublic Uri Reference { get; set; }\n\n\tinternal MemberGenerationContext? Context { get; }\n\tinternal bool IsExternalRef { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The reference.\n\tpublic RefIntent(Uri reference)\n\t{\n\t\tReference = reference;\n\t}\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The context that holds this reference.\n\t/// The reference.\n\tpublic RefIntent(MemberGenerationContext context, Uri reference)\n\t{\n\t\tContext = context;\n\t\tReference = reference;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Ref(Reference);\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `$ref` keyword.\n/// \npublic class RefIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The reference.\n\t/" + }, + { + "title": "src/JsonSchema.Generation/Intents/RequiredIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/RequiredIntent.cs#L1-L32", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/RequiredIntent.cs", + "startLine": 1, + "endLine": 32, + "content": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `required` keyword.\n/// \npublic class RequiredIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The required property names.\n\t/// \n\tpublic List RequiredProperties { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The required property names.\n\tpublic RequiredIntent(List requiredProperties)\n\t{\n\t\tRequiredProperties = requiredProperties;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Required(RequiredProperties);\n\t}\n}", + "snippet": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `required` keyword.\n/// \npublic class RequiredIntent : ISchemaKeywordIntent\n{\n\t/// \n/// Provides intent to create a `then` keyword.\n/// \npublic class ThenIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// A set of intents used to define the subschema.\n\t/// \n\tpublic IEnumerable Subschema { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\tpublic ThenIntent(IEnumerable subschema)\n\t{\n\t\tSubschema = subschema;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Then(Build(Subschema));\n\t}\n\n\tprivate static JsonSchemaBuilder Build(IEnumerable subschema)\n\t{\n\t\tvar builder = new JsonSchemaBuilder();\n\n\t\tforeach (var intent in subschema)\n\t\t{\n\t\t\tintent.Apply(builder);\n\t\t}\n\n\t\treturn builder;\n\t}\n}", + "snippet": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `then` keyword.\n/// \npublic class ThenIntent : ISchemaKeywordIntent\n{\n\t/// \n\t" + }, + { + "title": "src/JsonSchema.Generation/Intents/TitleIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/TitleIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/TitleIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `title` keyword.\n/// \npublic class TitleIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic string Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic TitleIntent(string value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Title(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `title` keyword.\n/// \npublic class TitleIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tp" + }, + { + "title": "src/JsonSchema.Generation/Intents/TypeIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/TypeIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/TypeIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `type` keyword.\n/// \npublic class TypeIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The type.\n\t/// \n\tpublic SchemaValueType Type { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The type.\n\tpublic TypeIntent(SchemaValueType type)\n\t{\n\t\tType = type;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.Type(Type);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `type` keyword.\n/// \npublic class TypeIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The type.\n\t/// \n\tpubl" + }, + { + "title": "src/JsonSchema.Generation/Intents/UnevaluatedPropertiesIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/UnevaluatedPropertiesIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/UnevaluatedPropertiesIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `unevaluatedProperties` keyword.\n/// \npublic class UnevaluatedPropertiesIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The context that represents the inner requirements.\n\t/// \n\tpublic SchemaGenerationContextBase? Context { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The context, or null to apply the false schema.\n\tpublic UnevaluatedPropertiesIntent(SchemaGenerationContextBase? context = null)\n\t{\n\t\tContext = context;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.UnevaluatedProperties(Context?.Apply() ?? false);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create an `unevaluatedProperties` keyword.\n/// \npublic class UnevaluatedPropertiesIntent : ISchemaKeywordIntent\n{\n\t/// \n\t" + }, + { + "title": "src/JsonSchema.Generation/Intents/UniqueItemsIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/UniqueItemsIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/UniqueItemsIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `uniqueItems` keyword.\n/// \npublic class UniqueItemsIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic bool Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic UniqueItemsIntent(bool value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.UniqueItems(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `uniqueItems` keyword.\n/// \npublic class UniqueItemsIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// <" + }, + { + "title": "src/JsonSchema.Generation/Intents/WriteOnlyIntent.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Intents/WriteOnlyIntent.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Intents/WriteOnlyIntent.cs", + "startLine": 1, + "endLine": 30, + "content": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `writeOnly` keyword.\n/// \npublic class WriteOnlyIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n\tpublic bool Value { get; set; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The value.\n\tpublic WriteOnlyIntent(bool value)\n\t{\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tpublic void Apply(JsonSchemaBuilder builder)\n\t{\n\t\tbuilder.WriteOnly(Value);\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.Intents;\n\n/// \n/// Provides intent to create a `writeOnly` keyword.\n/// \npublic class WriteOnlyIntent : ISchemaKeywordIntent\n{\n\t/// \n\t/// The value.\n\t/// \n/// Describes the intent to create a keyword.\n/// \n/// \n/// Because is immutable, the system cannot\n/// generate the schema directly as it needs to do some optimization\n/// first. Keyword intents allow this. They record all of the data\n/// needed by the keyword. Application involves translating the\n/// intent into an actual keyword on the \n/// using one of the fluent extension methods provided by\n/// . Custom intents\n/// will need to be applied from within custom \n/// implementations.\n///\n/// Implementations MUST also override \n/// \npublic interface ISchemaKeywordIntent\n{\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The builder.\n\tvoid Apply(JsonSchemaBuilder builder);\n}", + "snippet": "using Json.Schema.Generation.Generators;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Describes the intent to create a keyword.\n/// \n/// \n/// Because is immutable, the" + }, + { + "title": "src/JsonSchema.Generation/ISchemaRefiner.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/ISchemaRefiner.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/ISchemaRefiner.cs", + "startLine": 1, + "endLine": 25, + "content": "namespace Json.Schema.Generation;\n\n/// \n/// Describes a schema generation refiner.\n/// \n/// \n/// Refiners run after attributes have been processed, before the\n/// schema itself is created. This is used to add customization\n/// logic.\n/// \npublic interface ISchemaRefiner\n{\n\t/// \n\t/// Determines if the refiner should run.\n\t/// \n\t/// \n\t/// \n\tbool ShouldRun(SchemaGenerationContextBase context);\n\n\t/// \n\t/// Runs the refiner.\n\t/// \n\t/// \n\tvoid Run(SchemaGenerationContextBase context);\n}", + "snippet": "namespace Json.Schema.Generation;\n\n/// \n/// Describes a schema generation refiner.\n/// \n/// \n/// Refiners run after attributes have been processed, before the\n/// schema itself is created. Th" + }, + { + "title": "src/JsonSchema.Generation/ITypeNameGenerator.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/ITypeNameGenerator.cs#L1-L16", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/ITypeNameGenerator.cs", + "startLine": 1, + "endLine": 16, + "content": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Allows custom `$defs` key naming functionality.\n/// \npublic interface ITypeNameGenerator\n{\n\t/// \n\t/// Generates a `$defs` key for a type.\n\t/// \n\t/// The type.\n\t/// A string to use for the type; null to use the library-provided behavior.\n\tstring? GenerateName(Type type);\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Allows custom `$defs` key naming functionality.\n/// \npublic interface ITypeNameGenerator\n{\n\t/// \n\t/// Generates a `$defs` key for a t" + }, + { + "title": "src/JsonSchema.Generation/JsonSchemaBuilderExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/JsonSchemaBuilderExtensions.cs#L1-L51", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/JsonSchemaBuilderExtensions.cs", + "startLine": 1, + "endLine": 51, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Provides extension methods for schema generation.\n/// \npublic static class JsonSchemaBuilderExtensions\n{\n\t/// \n\t/// Generates a schema from a CLR type.\n\t/// \n\t/// The type to generate.\n\t/// The schema builder.\n\t/// The generator configuration.\n\t/// The schema builder (for fluent syntax support).\n\tpublic static JsonSchemaBuilder FromType(\n\t\tthis JsonSchemaBuilder builder,\n\t\tSchemaGeneratorConfiguration? configuration = null) =>\n\t\tFromType(builder, typeof(T), configuration);\n\n\t/// \n\t/// Generates a schema from a CLR type.\n\t/// \n\t/// The schema builder.\n\t/// The type to generate.\n\t/// The generator configuration.\n\t/// The schema builder (for fluent syntax support).\n\tpublic static JsonSchemaBuilder FromType(\n\t\tthis JsonSchemaBuilder builder,\n\t\t[DynamicallyAccessedMembers(\n\t\t\tDynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicFields |\n\t\t\tDynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicProperties |\n\t\t\tDynamicallyAccessedMemberTypes.Interfaces)]\n\t\tType type,\n\t\tSchemaGeneratorConfiguration? configuration = null)\n\t{\n\t\tSchemaGeneratorConfiguration.Current = configuration ?? SchemaGeneratorConfiguration.Default;\n\n\t\tSchemaGenerationContextCache.Clear();\n\t\tvar context = SchemaGenerationContextCache.GetRoot(type);\n\n\t\tif (SchemaGeneratorConfiguration.Current.DefaultDialect is not null)\n\t\t\tbuilder.Schema(SchemaGeneratorConfiguration.Current.DefaultDialect);\n\n\t\tcontext.Apply(builder);\n\n\t\treturn builder;\n\t}\n}", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Provides extension methods for schema generation.\n/// \npublic static class JsonSchemaBuilderExtensions\n" + }, + { + "title": "src/JsonSchema.Generation/MemberGenerationContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/MemberGenerationContext.cs#L1-L86", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/MemberGenerationContext.cs", + "startLine": 1, + "endLine": 86, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Provides context for object members to include those attributes.\n/// \n[DebuggerDisplay(\"{DebuggerDisplay}\")]\npublic class MemberGenerationContext : SchemaGenerationContextBase\n{\n\t/// \n\t/// The type.\n\t/// \n\tpublic override Type Type => BasedOn.Type;\n\n\t/// \n\t/// Gets the context this is based on.\n\t/// \n\tpublic TypeGenerationContext BasedOn { get; }\n\n\t/// \n\t/// Gets the set of member attributes.\n\t/// \n\tpublic List Attributes { get; }\n\n\t/// \n\t/// Indicates whether the member is marked as a nullable reference type.\n\t/// \n\tpublic bool NullableRef { get; }\n\n\t/// \n\t/// Gets or sets the generic parameter that this context represents.\n\t/// A null value (default) represents the root type.\n\t/// \n\tpublic int Parameter { get; set; } = -1;\n\n\tinternal MemberGenerationContext(TypeGenerationContext basedOn, List attributes, bool markedAsNullableRef = false)\n\t{\n\t\tBasedOn = basedOn;\n\t\tAttributes = attributes;\n\t\tNullableRef = markedAsNullableRef;\n\n\t\tDebuggerDisplay = BasedOn.Type.CSharpName() + $\" + [{string.Join(\",\", attributes.Select(x => x.GetType().CSharpName().Replace(\"Attribute\", string.Empty)))}]\";\n\t}\n\n\tinternal MemberGenerationContext(MemberGenerationContext source)\n\t{\n\t\tBasedOn = source.BasedOn;\n\t\tAttributes = [..source.Attributes];\n\t\tIntents.AddRange(source.Intents);\n\n\t\tDebuggerDisplay = BasedOn.Type.CSharpName() + $\"[{string.Join(\",\", Attributes.Select(x => x.GetType().CSharpName().Replace(\"Attribute\", string.Empty)))}]\";\n\t}\n\n\tinternal sealed override void GenerateIntents()\n\t{\n\t\tif (ReferenceEquals(this, True) || ReferenceEquals(this, False)) return;\n\n\t\tvar nullableAttribute = Attributes.OfType().FirstOrDefault();\n\t\tvar nullable = nullableAttribute?.IsNullable ?? NullableRef;\n\t\tList baseIntents;\n\t\tif (BasedOn.IsRoot)\n\t\t\tbaseIntents = [new RefIntent(this, new Uri(\"#\", UriKind.Relative))];\n\t\telse if (nullable || !Type.CanBeReferenced() || BasedOn.IsSimpleRef())\n\t\t\tbaseIntents = BasedOn.Intents;\n\t\telse\n\t\t{\n\t\t\tbaseIntents = [new RefIntent(this, new Uri($\"#/$defs/{BasedOn.DefinitionName}\", UriKind.Relative))];\n\t\t\tBasedOn.References.Add(this);\n\t\t}\n\n\t\tIntents.AddRange(nullable ? baseIntents.AsNullable() : baseIntents);\n\n\t\tAttributeHandler.HandleAttributes(this);\n\n\t\tvar refiners = SchemaGeneratorConfiguration.Current.Refiners.ToList();\n\t\tforeach (var refiner in refiners.Where(x => x.ShouldRun(this)))\n\t\t{\n\t\t\trefiner.Run(this);\n\t\t}\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Provides context for object members" + }, + { + "title": "src/JsonSchema.Generation/MemberInfoMetadataComparer.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/MemberInfoMetadataComparer.cs#L1-L90", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/MemberInfoMetadataComparer.cs", + "startLine": 1, + "endLine": 90, + "content": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Reflection;\n\nnamespace Json.Schema.Generation;\n\ninternal class MemberInfoMetadataTokenComparer : Comparer\n{\n\tprivate static ConcurrentDictionary Cache { get; } = new();\n\tprivate readonly Type[] _typeOrder;\n\n\tpublic Type Type { get; }\n\n\tprivate MemberInfoMetadataTokenComparer(Type type)\n\t{\n\t\tType = type;\n\n\t\tvar typeStack = new Stack();\n\n\t\tdo\n\t\t{\n\t\t\ttypeStack.Push(type);\n\t\t\ttype = type.BaseType!;\n\n\t\t} while (type != null!);\n\n\t\t_typeOrder = [.. typeStack];\n\t}\n\n\tpublic static MemberInfoMetadataTokenComparer Get(Type type) =>\n\t\tCache.GetOrAdd(type, new MemberInfoMetadataTokenComparer(type));\n\n\tpublic override int Compare(MemberInfo? x, MemberInfo? y)\n\t{\n\t\tif (x == y) return 0;\n\t\tif (x == null) return 1;\n\t\tif (y == null) return -1;\n\n\t\t// Get metadata tokens for the types that declared the members.\n\t\tvar xOwnerType = x.DeclaringType;\n\t\tvar yOwnerType = y.DeclaringType;\n\n\t\tif (xOwnerType != yOwnerType)\n\t\t{\n\t\t\t// Members were declared in different types. Find the _typeOrder indices for\n\t\t\t// the types so that we can identify which one we consider to be the\n\t\t\t// least-derived type.\n\t\t\tvar xIndex = Array.IndexOf(_typeOrder, xOwnerType);\n\t\t\tvar yIndex = Array.IndexOf(_typeOrder, yOwnerType);\n\n\t\t\t// one of the types wasn't found (shouldn't happen)\n\t\t\tif (xIndex < 0 || yIndex < 0) return int.MaxValue;\n\n\t\t\treturn Comparer.Default.Compare(xIndex, yIndex);\n\t\t}\n\n\t\t// Members were declared in the same type. Use the metadata tokens for the members\n\t\t// to determine the sort order.\n\t\tvar xToken = GetMetadataToken(x);\n\t\tvar yToken = GetMetadataToken(y);\n\n\t\treturn Comparer.Default.Compare(xToken, yToken);\n\t}\n\n\tprivate static bool HasMetadataToken(MemberInfo? member)\n\t{\n\t\tif (member == null) return false;\n\n#if NETSTANDARD2_0\n\t\ttry\n\t\t{\n\t\t\t// ReSharper disable once UnusedVariable\n\t\t\tvar token = member.MetadataToken;\n\t\t\treturn true;\n\t\t}\n\t\tcatch (InvalidOperationException)\n\t\t{\n\t\t\treturn false;\n\t\t}\n#else\n\t\treturn member.HasMetadataToken();\n#endif\n\t}\n\n\tprivate static int GetMetadataToken(MemberInfo? member)\n\t{\n\t\treturn HasMetadataToken(member) ? member!.MetadataToken : int.MaxValue;\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Reflection;\n\nnamespace Json.Schema.Generation;\n\ninternal class MemberInfoMetadataTokenComparer : Comparer\n{\n\tp" + }, + { + "title": "src/JsonSchema.Generation/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Generation/obj/Debug/net10.0/JsonSchema.Generation.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Debug/net10.0/JsonSchema.Generation.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Debug/net10.0/JsonSchema.Generation.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide schema generation functionality\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.3.10\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.3.10+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Generation/obj/Debug/net8.0/JsonSchema.Generation.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Debug/net8.0/JsonSchema.Generation.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Debug/net8.0/JsonSchema.Generation.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide schema generation functionality\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.3.10\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.3.10+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Generation/obj/Debug/net9.0/JsonSchema.Generation.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Debug/net9.0/JsonSchema.Generation.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Debug/net9.0/JsonSchema.Generation.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide schema generation functionality\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.3.10\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.3.10+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.Generation/obj/Debug/netstandard2.0/JsonSchema.Generation.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Debug/netstandard2.0/JsonSchema.Generation.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Debug/netstandard2.0/JsonSchema.Generation.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide schema generation functionality\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.3.10\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.3.10+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs#L1-L4", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs", + "startLine": 1, + "endLine": 4, + "content": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.IsExternalInit))]", + "snippet": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.IsExternalInit))]" + }, + { + "title": "src/JsonSchema.Generation/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.RequiresLocationAttribute.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.RequiresLocationAttribute.g.cs#L1-L4", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.RequiresLocationAttribute.g.cs", + "startLine": 1, + "endLine": 4, + "content": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.RequiresLocationAttribute))]", + "snippet": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.RequiresLocationAttribute))]" + }, + { + "title": "src/JsonSchema.Generation/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Generation/obj/Release/net10.0/JsonSchema.Generation.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Release/net10.0/JsonSchema.Generation.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Release/net10.0/JsonSchema.Generation.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide schema generation functionality\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.3.6\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.3.6+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Generation/obj/Release/net8.0/JsonSchema.Generation.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Release/net8.0/JsonSchema.Generation.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Release/net8.0/JsonSchema.Generation.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide schema generation functionality\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.3.6\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.3.6+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Generation/obj/Release/net9.0/JsonSchema.Generation.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Release/net9.0/JsonSchema.Generation.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Release/net9.0/JsonSchema.Generation.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide schema generation functionality\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.3.6\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.3.6+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.Generation/obj/Release/netstandard2.0/JsonSchema.Generation.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/obj/Release/netstandard2.0/JsonSchema.Generation.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/obj/Release/netstandard2.0/JsonSchema.Generation.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to provide schema generation functionality\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"7.3.6\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"7.3.6+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.Generation\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"7.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Generation/PropertyNameResolvers.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/PropertyNameResolvers.cs#L1-L50", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/PropertyNameResolvers.cs", + "startLine": 1, + "endLine": 50, + "content": "using System.Reflection;\nusing Humanizer;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Declares a property name resolution which is used to provide a property name.\n/// \n/// The property.\n/// The property name\npublic delegate string PropertyNameResolver(MemberInfo input);\n\n/// \n/// Defines a set of predefined property name resolution methods.\n/// \npublic static class PropertyNameResolvers\n{\n\t/// \n\t/// Makes no changes. Properties are generated with the name of the property in code.\n\t/// \n\tpublic static readonly PropertyNameResolver AsDeclared = x => x.Name;\n\t/// \n\t/// Property names to camel case (e.g. `camelCase`).\n\t/// \n\tpublic static readonly PropertyNameResolver CamelCase = x => x.Name.Camelize();\n\t/// \n\t/// Property names to pascal case (e.g. `PascalCase`).\n\t/// \n\tpublic static readonly PropertyNameResolver PascalCase = x => x.Name.Pascalize();\n\t/// \n\t/// Property names to snake case (e.g. `Snake_Case`).\n\t/// \n\tpublic static readonly PropertyNameResolver SnakeCase = x => x.Name.Underscore();\n\t/// \n\t/// Property names to lower snake case (e.g. `lower_snake_case`).\n\t/// \n\tpublic static readonly PropertyNameResolver LowerSnakeCase = x => x.Name.Underscore().ToLowerInvariant();\n\t/// \n\t/// Property names to upper snake case (e.g. `UPPER_SNAKE_CASE`).\n\t/// \n\tpublic static readonly PropertyNameResolver UpperSnakeCase = x => x.Name.Underscore().ToUpperInvariant();\n\t/// \n\t/// Property names to kebab case (e.g. `Kebab-Case`).\n\t/// \n\tpublic static readonly PropertyNameResolver KebabCase = x => x.Name.Kebaberize();\n\t/// \n\t/// Property names to upper kebab case (e.g. `UPPER-KEBAB-CASE`).\n\t/// \n\tpublic static readonly PropertyNameResolver UpperKebabCase = x => x.Name.Kebaberize().ToUpperInvariant();\n}", + "snippet": "using System.Reflection;\nusing Humanizer;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Declares a property name resolution which is used to provide a property name.\n/// \n/// The pro" + }, + { + "title": "src/JsonSchema.Generation/PropertyOrder.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/PropertyOrder.cs#L1-L16", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/PropertyOrder.cs", + "startLine": 1, + "endLine": 16, + "content": "namespace Json.Schema.Generation;\n\n/// \n/// Indicates the sequence in which properties will be listed in the schema.\n/// \npublic enum PropertyOrder\n{\n\t/// \n\t/// Properties will be listed in the order they're declared in code.\n\t/// \n\tAsDeclared,\n\t/// \n\t/// Properties will be sorted by name, case-insensitive.\n\t/// \n\tByName\n}", + "snippet": "namespace Json.Schema.Generation;\n\n/// \n/// Indicates the sequence in which properties will be listed in the schema.\n/// \npublic enum PropertyOrder\n{\n\t/// \n\t/// Properties will be listed in th" + }, + { + "title": "src/JsonSchema.Generation/Refiners/ObjectValuesRefiner.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Refiners/ObjectValuesRefiner.cs#L1-L52", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Refiners/ObjectValuesRefiner.cs", + "startLine": 1, + "endLine": 52, + "content": "using System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Refiners;\n\ninternal class ObjectValuesRefiner : ISchemaRefiner\n{\n\tpublic bool ShouldRun(SchemaGenerationContextBase context)\n\t{\n\t\tif (!context.Type.IsGenericType) return false;\n\t\tif (context is not MemberGenerationContext memberContext ||\n\t\t memberContext.Attributes.Count == 0) return false;\n\t\tif (!context.Intents.OfType().Any() &&\n\t\t !context.Intents.OfType().Any()) return false;\n\n\t\tvar generic = context.Type.GetGenericTypeDefinition();\n\t\treturn generic == typeof(IDictionary<,>) ||\n\t\t generic == typeof(Dictionary<,>) ||\n\t\t generic == typeof(ConcurrentDictionary<,>);\n\t}\n\n\tpublic void Run(SchemaGenerationContextBase context)\n\t{\n\t\tvar memberContext = (MemberGenerationContext)context;\n\n\t\tvar additionalPropertiesIntent = memberContext.Intents.OfType().FirstOrDefault();\n\t\tif (additionalPropertiesIntent is not null)\n\t\t{\n\t\t\tvar additionalPropertiesTypeContext = additionalPropertiesIntent.Context as TypeGenerationContext ??\n\t\t\t ((MemberGenerationContext)additionalPropertiesIntent.Context).BasedOn;\n\n\t\t\tadditionalPropertiesIntent.Context = new MemberGenerationContext(additionalPropertiesTypeContext, memberContext.Attributes);\n\n\t\t\tadditionalPropertiesIntent.Context.GenerateIntents();\n\t\t}\n\n\t\tvar unevaluatedPropertiesIntent = memberContext.Intents.OfType().FirstOrDefault();\n\t\tif (unevaluatedPropertiesIntent is not null)\n\t\t{\n\t\t\tvar unevaluatedPropertiesTypeContext = unevaluatedPropertiesIntent.Context as TypeGenerationContext ??\n\t\t\t ((MemberGenerationContext?)unevaluatedPropertiesIntent.Context)?.BasedOn;\n\t\t\tif (unevaluatedPropertiesTypeContext is not null)\n\t\t\t{\n\t\t\t\tunevaluatedPropertiesIntent.Context = new MemberGenerationContext(unevaluatedPropertiesTypeContext, memberContext.Attributes);\n\n\t\t\t\tunevaluatedPropertiesIntent.Context.GenerateIntents();\n\t\t\t}\n\t\t}\n\t}\n}", + "snippet": "using System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Refiners;\n\ninternal class ObjectValuesRefiner : ISchemaRef" + }, + { + "title": "src/JsonSchema.Generation/Refiners/TypedArrayRefiner.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Refiners/TypedArrayRefiner.cs#L1-L41", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Refiners/TypedArrayRefiner.cs", + "startLine": 1, + "endLine": 41, + "content": "using System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Refiners;\n\ninternal class ArrayItemsRefiner : ISchemaRefiner\n{\n\tpublic bool ShouldRun(SchemaGenerationContextBase context)\n\t{\n\t\treturn context is MemberGenerationContext memberContext && memberContext.Attributes.Count != 0 && \n\t\t context.Type.IsArray();\n\t}\n\n\tpublic void Run(SchemaGenerationContextBase context)\n\t{\n\t\tvar memberContext = (MemberGenerationContext)context;\n\t\t// check if any attributes apply to item\n\t\t// if not, no adjustment needed\n\t\tif (memberContext.Attributes.OfType().All(x => x.GenericParameter == -1)) return;\n\n\t\tvar refIntent = context.Intents.OfType().FirstOrDefault();\n\t\tif (refIntent is not null)\n\t\t{\n\t\t\tcontext.Intents.Remove(refIntent);\n\t\t\tcontext.Intents.AddRange(memberContext.BasedOn.Intents);\n\t\t\tmemberContext.BasedOn.References.Remove(memberContext);\n\t\t}\n\n\t\tvar itemsIntent = memberContext.Intents.OfType().FirstOrDefault();\n\t\tif (itemsIntent is null) return;\n\n\t\tvar itemsTypeContext = itemsIntent.Context as TypeGenerationContext ??\n\t\t ((MemberGenerationContext)itemsIntent.Context).BasedOn;\n\n\t\tvar index = memberContext.Intents.IndexOf(itemsIntent);\n\t\tvar itemsMemberContext = new MemberGenerationContext(itemsTypeContext, memberContext.Attributes) { Parameter = 0 };\n\t\tmemberContext.Intents[index] = new ItemsIntent(itemsMemberContext);\n\n\t\titemsMemberContext.GenerateIntents();\n\t}\n}", + "snippet": "using System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation.Refiners;\n\ninternal class ArrayItemsRefiner : ISchemaRefiner\n{\n\tpublic bool ShouldRun(SchemaGenerationContextBase context)\n\t{\n\t\tr" + }, + { + "title": "src/JsonSchema.Generation/SchemaGenerationContextBase.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SchemaGenerationContextBase.cs#L1-L68", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SchemaGenerationContextBase.cs", + "startLine": 1, + "endLine": 68, + "content": "using System;\nusing System.Collections.Generic;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Provides base functionality and data for generation contexts.\n/// \npublic abstract class SchemaGenerationContextBase\n{\n\tinternal class TrueType;\n\n\tinternal class FalseType;\n\n\t/// \n\t/// Represents a true schema.\n\t/// \n\tpublic static readonly SchemaGenerationContextBase True = new TypeGenerationContext(typeof(TrueType));\n\t/// \n\t/// Represents a false schema.\n\t/// \n\tpublic static readonly SchemaGenerationContextBase False = new TypeGenerationContext(typeof(FalseType));\n\n\t/// \n\t/// The type.\n\t/// \n\tpublic abstract Type Type { get; }\n\n\t/// \n\t/// The keyword intents required for this type.\n\t/// \n\tpublic List Intents { get; } = [];\n\n\tinternal bool IsRoot { get; init; }\n\n#pragma warning disable CS8618\n\tprivate protected SchemaGenerationContextBase()\n\t{\n\t\tDebuggerDisplay = \"ad-hoc\";\n\t}\n#pragma warning restore CS8618\n\n\t/// \n\t/// Applies the keyword to the .\n\t/// \n\t/// The schema builder.\n\t/// The schema builder (for fluent syntax support).\n\tpublic JsonSchemaBuilder Apply(JsonSchemaBuilder? builder = null)\n\t{\n\t\tif (ReferenceEquals(this, True)) return true;\n\t\tif (ReferenceEquals(this, False)) return false;\n\n\t\tif (Intents.Count == 0) return true;\n\n\t\tbuilder ??= new JsonSchemaBuilder();\n\n\t\tforeach (var intent in Intents)\n\t\t{\n\t\t\tintent.Apply(builder);\n\t\t}\n\n\t\treturn builder;\n\t}\n\n\tinternal abstract void GenerateIntents();\n\t\n\tinternal string DebuggerDisplay { get; init; }\n}", + "snippet": "using System;\nusing System.Collections.Generic;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Provides base functionality and data for generation contexts.\n/// \npublic abstract class SchemaGenerationCon" + }, + { + "title": "src/JsonSchema.Generation/SchemaGenerationContextCache.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SchemaGenerationContextCache.cs#L1-L98", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SchemaGenerationContextCache.cs", + "startLine": 1, + "endLine": 98, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Gets the contexts for the current run.\n/// \npublic static class SchemaGenerationContextCache\n{\n\t[ThreadStatic]\n\tprivate static Dictionary? _cache;\n\n\tinternal static Dictionary Cache => _cache ??= [];\n\n\t/// \n\t/// Gets or creates a based on the given\n\t/// type and attribute set.\n\t/// \n\t/// The type to generate.\n\t/// \n\t/// A generation context, from the cache if one exists with the specified\n\t/// type and attribute set; otherwise a new one. New contexts are automatically\n\t/// cached.\n\t/// \n\t/// \n\t/// Use this in your generator if it needs to create keywords with subschemas.\n\t/// \n\tpublic static TypeGenerationContext Get(\n\t\t[DynamicallyAccessedMembers(\n\t\t\tDynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicFields |\n\t\t\tDynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicProperties |\n\t\t\tDynamicallyAccessedMemberTypes.Interfaces)]\n\t\tType type) =>\n\t\tGet(type, false);\n\n\tinternal static TypeGenerationContext GetRoot(Type type)\n\t{\n\t\tvar baseContext = Get(type, true);\n\t\tvar toReintegrate = Cache\n\t\t\t.Where(x => ((x.Value.References.Count == 1 &&\n\t\t\t x.Key != type &&\n\t\t\t x.Key.CanBeReferenced()) ||\n\t\t\t x.Value.Intents is [RefIntent]) &&\n\t\t\t !x.Value.IsSimpleRef())\n\t\t\t.Select(x => x.Value)\n\t\t\t.ToList();\n\n\t\tforeach (var schema in toReintegrate)\n\t\t{\n\t\t\tvar context = schema.References[0];\n\t\t\tvar contextKeywords = context.Intents.Select(x => x.GetType());\n\t\t\tvar schemaKeywords = schema.Intents.Select(x => x.GetType());\n\t\t\tif (contextKeywords.Intersect(schemaKeywords).Except([typeof(RefIntent)]).Any()) continue;\n\n\t\t\tvar refIntent = context.Intents.OfType().First();\n\t\t\tcontext.Intents.Remove(refIntent);\n\t\t\tcontext.Intents.AddRange(schema.Intents);\n\n\t\t\tschema.References.Clear();\n\t\t}\n\n\t\tvar definitions = Cache\n\t\t\t.Where(x => x.Value.References.Count > 0 &&\n\t\t\t x.Key != type && \n\t\t\t x.Key.CanBeReferenced())\n\t\t\t.DistinctBy(x => x.Value.DefinitionName)\n\t\t\t.ToDictionary(x => x.Value.DefinitionName, SchemaGenerationContextBase (x) => x.Value);\n\t\tif (definitions.Count != 0)\n\t\t\tbaseContext.Intents.Add(new DefsIntent(definitions));\n\t\treturn baseContext;\n\t}\n\n\tprivate static TypeGenerationContext Get(Type type, bool isRoot)\n\t{\n\t\tif (!Cache.TryGetValue(type, out var context))\n\t\t{\n\t\t\tcontext = new TypeGenerationContext(type) { IsRoot = isRoot };\n\t\t\tvar comments = SchemaGeneratorConfiguration.Current.XmlReader.GetTypeComments(type);\n\t\t\tif (!string.IsNullOrWhiteSpace(comments.Summary))\n\t\t\t\tcontext.Intents.Add(new DescriptionIntent(comments.Summary!));\n\n\t\t\tCache[type] = context;\n\n\t\t\tcontext.GenerateIntents();\n\t\t}\n\n\t\treturn context;\n\t}\n\n\tinternal static void Clear()\n\t{\n\t\tCache.Clear();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Gets the contexts for " + }, + { + "title": "src/JsonSchema.Generation/SchemaGeneratorConfiguration.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SchemaGeneratorConfiguration.cs#L1-L116", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SchemaGeneratorConfiguration.cs", + "startLine": 1, + "endLine": 116, + "content": "using System;\nusing System.Collections.Generic;\nusing Json.Schema.Generation.Generators;\nusing Json.Schema.Generation.Refiners;\nusing Json.Schema.Generation.XmlComments;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Provides additional configuration for the generator.\n/// \npublic class SchemaGeneratorConfiguration\n{\n\tprivate static readonly ISchemaRefiner[] _defaultRefiners =\n\t[\n\t\tnew ArrayItemsRefiner(),\n\t\tnew ObjectValuesRefiner()\n\t];\n\n\tprivate readonly Dictionary _xmlCommentsFiles = [];\n\n\t/// \n\t/// Thread-static storage of the current configuration. Only to be used for reading\n\t/// the configuration. Setting values on this object will be overwritten when starting\n\t/// generation.\n\t/// \n\t[field: ThreadStatic]\n#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.\n\tpublic static SchemaGeneratorConfiguration Current { get; internal set; }\n#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.\n\n\t/// \n\t/// Gets the default configuration instance for the schema generator.\n\t/// \n\t/// \n\t/// Use this property to access a pre-configured, standard set of options for schema generation. This\n\t/// instance is intended for general use when custom configuration is not required.\n\t/// \n\tpublic static SchemaGeneratorConfiguration Default { get; } = new();\n\n\tinternal DocXmlReader XmlReader { get; }\n\n\t/// \n\t/// A collection of refiners.\n\t/// \n\tpublic List Refiners { get; } = [.._defaultRefiners];\n\t/// \n\t/// A collection of generators in addition to the global set.\n\t/// \n\t// ReSharper disable once CollectionNeverUpdated.Global\n\tpublic List Generators { get; } = [];\n\t/// \n\t/// Gets or sets the order in which properties will be listed in the schema.\n\t/// \n\tpublic PropertyOrder PropertyOrder { get; set; }\n\n\t/// \n\t/// Gets or sets the property name resolving method. Default is .\n\t/// \n\t/// \n\t/// This can be replaced with any `Func<MemberInfo, string>`.\n\t/// \n\tpublic PropertyNameResolver? PropertyNameResolver\n\t{\n\t\tget => field ??= PropertyNameResolvers.AsDeclared;\n\t\tset;\n\t}\n\n\t/// \n\t/// Gets or sets whether properties that are affected by conditionals are defined\n\t/// globally or only within their respective `then` subschemas. True restricts\n\t/// those property definitions to `then` subschemas and adds a top-level\n\t/// `unevaluatedProperties: false`; false (default) defines them globally.\n\t/// \n\tpublic bool StrictConditionals { get; set; }\n\n\t/// \n\t/// Allows mapping of types to external schema `$id`s. When encountering one\n\t/// of these types, a `$ref` keyword will be generated instead of a full schema.\n\t/// \n\tpublic Dictionary ExternalReferences { get; } = [];\n\n\t/// \n\t/// Provides custom naming functionality.\n\t/// \n\tpublic ITypeNameGenerator? TypeNameGenerator { get; set; }\n\n\t/// \n\t/// Gets or sets the default dialect included in generated schemas.\n\t/// \n\t/// \n\t/// For compatibility, this property defaults to null, which does not add a `$schema`\n\t/// keyword. In future major versions, this will be set and `$schema` will be\n\t/// included by default.\n\t/// \n\tpublic Uri? DefaultDialect { get; set; }\n\n\t/// \n\t/// Creates a new .\n\t/// \n\tpublic SchemaGeneratorConfiguration()\n\t{\n\t\tXmlReader = new DocXmlReader(assembly => _xmlCommentsFiles.GetValueOrDefault(assembly.FullName!));\n\t}\n\n\t/// \n\t/// Registers an assembly's XML comment file.\n\t/// \n\t/// Any type in the assembly.\n\t/// The file name of the XML file.\n\tpublic void RegisterXmlCommentFile(string filename)\n\t{\n\t\tvar assembly = typeof(T).Assembly;\n\t\t_xmlCommentsFiles[assembly.FullName!] = filename;\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing Json.Schema.Generation.Generators;\nusing Json.Schema.Generation.Refiners;\nusing Json.Schema.Generation.XmlComments;\n\nnamespace Json.Schema.Generation;\n\n/// \n" + }, + { + "title": "src/JsonSchema.Generation/Serialization/GenerateJsonSchemaAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/Serialization/GenerateJsonSchemaAttribute.cs#L1-L42", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/Serialization/GenerateJsonSchemaAttribute.cs", + "startLine": 1, + "endLine": 42, + "content": "using System;\n\nnamespace Json.Schema.Generation.Serialization;\n\n/// \n/// Apply to a type to generate a schema for validation during deserialization\n/// by .\n/// \n/// \n/// When applied, source generation will create a static property containing a pre-built\n/// for the decorated type at compile time.\n/// \n[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct)]\npublic class GenerateJsonSchemaAttribute : Attribute\n{\n\t/// \n\t/// Gets or sets the naming convention to use for property names in the generated schema.\n\t/// \n\t/// \n\t/// Defaults to if not specified.\n\t/// \n\tpublic NamingConvention PropertyNaming { get; set; } = NamingConvention.CamelCase;\n\n\t/// \n\t/// Gets or sets the order in which properties will be listed in the schema.\n\t/// \n\t/// \n\t/// Defaults to if not specified.\n\t/// \n\tpublic PropertyOrder PropertyOrder { get; set; } = PropertyOrder.AsDeclared;\n\n\t/// \n\t/// Gets or sets whether properties affected by conditionals are defined globally\n\t/// or only within their respective then subschemas.\n\t/// \n\t/// \n\t/// When true, restricts conditional property definitions to `then` subschemas and adds\n\t/// a top-level `unevaluatedProperties: false`. When false (default), defines them globally.\n\t/// \n\tpublic bool StrictConditionals { get; set; }\n}", + "snippet": "using System;\n\nnamespace Json.Schema.Generation.Serialization;\n\n/// \n/// Apply to a type to generate a schema for validation during deserialization\n/// by .\n/// \n/// Extends to also allow for\n/// schema generation using .\n/// \n[RequiresDynamicCode(\"JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.\")]\npublic class GenerativeValidatingJsonConverter : ValidatingJsonConverter\n{\n\t/// \n\t/// Gets the build options used for the schema build step.\n\t/// \n\tpublic BuildOptions BuildOptions { get; } = new();\n\n\t/// \n\t/// Provides options for the generator.\n\t/// \n\tpublic SchemaGeneratorConfiguration GeneratorConfiguration { get; } = new();\n\n\t/// When overridden in a derived class, determines whether the converter instance can convert the specified object type.\n\t/// The type of the object to check whether it can be converted by this converter instance.\n\t/// \n\t/// if the instance can convert the specified object type; otherwise, .\n\tpublic override bool CanConvert(Type typeToConvert)\n\t{\n\t\tvar canConvert = typeToConvert.GetCustomAttributes().SingleOrDefault() != null;\n\n\t\treturn canConvert || base.CanConvert(typeToConvert);\n\t}\n\n\t/// \n\t/// Gets the schema for a type.\n\t/// \n\tprotected override JsonSchema GetSchema(Type type)\n\t{\n\t\tvar generateAttribute = type.GetCustomAttributes().SingleOrDefault();\n\t\tif (generateAttribute is not null)\n\t\t{\n\t\t\tvar schema = new JsonSchemaBuilder(BuildOptions).FromType(type, GeneratorConfiguration);\n\t\t\treturn schema;\n\t\t}\n\n\t\treturn base.GetSchema(type);\n\t}\n}", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Reflection;\nusing Json.Schema.Serialization;\n\nnamespace Json.Schema.Generation.Serialization;\n\n/// \n/// Extends \n/// Indicates the naming convention to use for property names in generated schemas.\n/// \npublic enum NamingConvention\n{\n\t/// \n\t/// Properties are generated with the name as declared in code.\n\t/// \n\tAsDeclared,\n\t/// \n\t/// Property names are converted to camelCase (e.g. `camelCase`).\n\t/// \n\tCamelCase,\n\t/// \n\t/// Property names are converted to PascalCase (e.g. `PascalCase`).\n\t/// \n\tPascalCase,\n\t/// \n\t/// Property names are converted to lower_snake_case (e.g. `lower_snake_case`).\n\t/// \n\tLowerSnakeCase,\n\t/// \n\t/// Property names are converted to UPPER_SNAKE_CASE (e.g. `UPPER_SNAKE_CASE`).\n\t/// \n\tUpperSnakeCase,\n\t/// \n\t/// Property names are converted to kebab-case (e.g. `kebab-case`).\n\t/// \n\tKebabCase,\n\t/// \n\t/// Property names are converted to UPPER-KEBAB-CASE (e.g. `UPPER-KEBAB-CASE`).\n\t/// \n\tUpperKebabCase\n}", + "snippet": "namespace Json.Schema.Generation.Serialization;\n\n/// \n/// Indicates the naming convention to use for property names in generated schemas.\n/// \npublic enum NamingConvention\n{\n\t/// \n\t/// Propert" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/ClassDeclarationInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/ClassDeclarationInfo.cs#L1-L49", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/ClassDeclarationInfo.cs", + "startLine": 1, + "endLine": 49, + "content": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.SourceGeneration;\n\n/// \n/// Holds information about the GeneratedJsonSchemas class declaration.\n/// \ninternal sealed class ClassDeclarationInfo\n{\n\tpublic bool IsPublic { get; init; }\n\tpublic bool IsInternal { get; init; }\n\tpublic bool IsStatic { get; init; }\n\tpublic bool IsPartial { get; init; }\n\n\t/// \n\t/// Default declaration: public static partial class GeneratedJsonSchemas\n\t/// \n\tpublic static ClassDeclarationInfo Default => new()\n\t{\n\t\tIsPublic = true,\n\t\tIsStatic = true,\n\t\tIsPartial = true\n\t};\n\n\t/// \n\t/// Gets the declaration string for the class.\n\t/// \n\tpublic string GetDeclarationString()\n\t{\n\t\tvar parts = new List();\n\n\t\tif (IsPublic)\n\t\t\tparts.Add(\"public\");\n\t\telse if (IsInternal)\n\t\t\tparts.Add(\"internal\");\n\t\telse\n\t\t\tparts.Add(\"private\");\n\n\t\tif (IsStatic)\n\t\t\tparts.Add(\"static\");\n\n\t\tparts.Add(\"partial\");\n\t\tparts.Add(\"class\");\n\t\tparts.Add(\"GeneratedJsonSchemas\");\n\n\t\treturn string.Join(\" \", parts);\n\t}\n}", + "snippet": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.SourceGeneration;\n\n/// \n/// Holds information about the GeneratedJsonSchemas class declaration.\n/// \ninternal sealed class ClassDecla" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Diagnostics.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Diagnostics.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Diagnostics.cs", + "startLine": 1, + "endLine": 33, + "content": "using Microsoft.CodeAnalysis;\n\nnamespace Json.Schema.Generation.SourceGeneration;\n\ninternal static class Diagnostics\n{\n\tprivate const string _category = \"JsonSchemaGeneration\";\n\n\tpublic static readonly DiagnosticDescriptor OpenGenericTypeNotSupported = new(\n\t\tid: \"JSGEN001\",\n\t\ttitle: \"Open generic types are not supported\",\n\t\tmessageFormat: \"The type '{0}' is an open generic type. Source generation only supports concrete types.\",\n\t\tcategory: _category,\n\t\tdefaultSeverity: DiagnosticSeverity.Error,\n\t\tisEnabledByDefault: true);\n\n\tpublic static readonly DiagnosticDescriptor GeneratedJsonSchemasClassMustBePartial = new(\n\t\tid: \"JSGEN002\",\n\t\ttitle: \"GeneratedJsonSchemas class must be partial\",\n\t\tmessageFormat: \"The class 'GeneratedJsonSchemas' in {0} must be declared as partial to allow source generation\",\n\t\tcategory: _category,\n\t\tdefaultSeverity: DiagnosticSeverity.Error,\n\t\tisEnabledByDefault: true);\n\n\tpublic static readonly DiagnosticDescriptor DuplicateSchemaPropertyName = new(\n\t\tid: \"JSGEN003\",\n\t\ttitle: \"Duplicate schema property name\",\n\t\tmessageFormat: \"Type '{0}' contains multiple members that map to schema property name '{1}'. Only the first member is emitted.\",\n\t\tcategory: _category,\n\t\tdefaultSeverity: DiagnosticSeverity.Warning,\n\t\tisEnabledByDefault: true);\n}", + "snippet": "using Microsoft.CodeAnalysis;\n\nnamespace Json.Schema.Generation.SourceGeneration;\n\ninternal static class Diagnostics\n{\n\tprivate const string _category = \"JsonSchemaGeneration\";\n\n\tpublic static readonly DiagnosticDescript" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/AnySchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/AnySchemaEmitter.cs#L1-L14", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/AnySchemaEmitter.cs", + "startLine": 1, + "endLine": 14, + "content": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class AnySchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Any;\n\n\tpublic void EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\t// Intentionally empty: no constraints means true schema.\n\t}\n}", + "snippet": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class AnySchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Any;\n\n\tpublic void EmitSche" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/ArraySchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/ArraySchemaEmitter.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/ArraySchemaEmitter.cs", + "startLine": 1, + "endLine": 30, + "content": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class ArraySchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Array;\n\n\tpublic void EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indent}.Type(SchemaValueType.Array)\");\n\t\t\n\t\tvar elementType = CodeEmitterHelpers.GetElementType(type.TypeSymbol);\n\t\tif (elementType != null)\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}.Items(\");\n\t\t\tsb.Append(\"new JsonSchemaBuilder()\");\n\t\t\t\n\t\t\tSchemaCodeEmitter.EmitSchemaForType(sb, elementType, type.IsNullable, indent + \"\\t\", context);\n\t\t\t\n\t\t\tif (type.ItemAttributes is { Count: > 0 })\n\t\t\t\tSchemaCodeEmitter.EmitAttributes(sb, type.ItemAttributes, indent + \"\\t\");\n\t\t\t\n\t\t\tsb.Append(\")\");\n\t\t}\n\t}\n}", + "snippet": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class ArraySchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Array;\n\n\tpublic void Emit" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/BooleanSchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/BooleanSchemaEmitter.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/BooleanSchemaEmitter.cs", + "startLine": 1, + "endLine": 18, + "content": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class BooleanSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Boolean;\n\n\tpublic void EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tsb.AppendLine();\n\t\tif (type.IsNullable)\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Boolean, SchemaValueType.Null)\");\n\t\telse\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Boolean)\");\n\t}\n}", + "snippet": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class BooleanSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Boolean;\n\n\tpublic void " + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/CodeEmitterHelpers.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/CodeEmitterHelpers.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/CodeEmitterHelpers.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Linq;\nusing Microsoft.CodeAnalysis;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\n/// \n/// Helper methods for code emission.\n/// \ninternal static class CodeEmitterHelpers\n{\n\tpublic static string FormatValue(object? value)\n\t{\n\t\treturn value switch\n\t\t{\n\t\t\tnull => \"null\",\n\t\t\tstring s => $\"\\\"{EscapeString(s)}\\\"\",\n\t\t\tbool b => b ? \"true\" : \"false\",\n\t\t\tdecimal d => d.ToString(System.Globalization.CultureInfo.InvariantCulture) + \"m\",\n\t\t\tdouble d => d.ToString(System.Globalization.CultureInfo.InvariantCulture) + \"m\",\n\t\t\tfloat f => f.ToString(System.Globalization.CultureInfo.InvariantCulture) + \"m\",\n\t\t\t_ => value.ToString() ?? \"null\"\n\t\t};\n\t}\n\n\tpublic static string EscapeString(string str)\n\t{\n\t\treturn str\n\t\t\t.Replace(\"\\\\\", \"\\\\\\\\\")\n\t\t\t.Replace(\"\\\"\", \"\\\\\\\"\")\n\t\t\t.Replace(\"\\n\", \"\\\\n\")\n\t\t\t.Replace(\"\\r\", \"\\\\r\")\n\t\t\t.Replace(\"\\t\", \"\\\\t\");\n\t}\n\n\tpublic static string EscapeXmlDoc(string str)\n\t{\n\t\treturn str\n\t\t\t.Replace(\"&\", \"&\")\n\t\t\t.Replace(\"<\", \"<\")\n\t\t\t.Replace(\">\", \">\");\n\t}\n\n\tpublic static ITypeSymbol UnwrapNullable(ITypeSymbol typeSymbol)\n\t{\n\t\tif (typeSymbol.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T &&\n\t\t typeSymbol is INamedTypeSymbol namedType)\n\t\t{\n\t\t\treturn namedType.TypeArguments[0];\n\t\t}\n\t\treturn typeSymbol;\n\t}\n\n\tpublic static bool IsCollectionType(ITypeSymbol typeSymbol)\n\t{\n\t\tif (typeSymbol is not INamedTypeSymbol namedType) return false;\n\t\tif (namedType.SpecialType == SpecialType.System_String) return false;\n\t\tif (IsDictionaryType(namedType)) return false;\n\n\t\tif (TryGetEnumerableElementType(namedType, out _))\n\t\t\treturn true;\n\n\t\treturn false;\n\t}\n\n\tpublic static bool IsDictionaryType(ITypeSymbol typeSymbol)\n\t{\n\t\tif (typeSymbol is not INamedTypeSymbol { IsGenericType: true } namedType) return false;\n\n\t\tvar typeString = namedType.ConstructedFrom\n\t\t\t.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)\n\t\t\t.Replace(\" \", string.Empty);\n\n\t\treturn typeString is\n\t\t\t\"global::System.Collections.Generic.IDictionary\" or\n\t\t\t\"global::System.Collections.Generic.Dictionary\" or\n\t\t\t\"global::System.Collections.Concurrent.ConcurrentDictionary\";\n\t}\n\n\tpublic static bool IsStringKeyDictionaryType(ITypeSymbol typeSymbol)\n\t{\n\t\tif (!IsDictionaryType(typeSymbol)) return false;\n\t\tif (typeSymbol is not INamedTypeSymbol namedType) return false;\n\n\t\treturn namedType.TypeArguments[0].SpecialType == SpecialType.System_String;\n\t}\n\n\tpublic static bool IsEnumKeyDictionaryType(ITypeSymbol typeSymbol)\n\t{\n\t\tif (!IsDictionaryType(typeSymbol)) return false;\n\t\tif (typeSymbol is not INamedTypeSymbol namedType) return false;\n\n\t\treturn namedType.TypeArguments[0].TypeKind == Microsoft.CodeAnalysis.TypeKind.Enum;\n\t}\n\n\tpublic static ITypeSymbol? GetDictionaryValueType(ITypeSymbol typeSymbol)\n\t{\n\t\tif (!IsDictionaryType(typeSymbol)) return null;\n\t\tif (typeSymbol is not INamedTypeSymbol namedType) return null;\n\n\t\treturn namedType.TypeArguments[1];\n\t}\n\n\tpublic static ITypeSymbol? GetDictionaryKeyType(ITypeSymbol typeSymbol)\n\t{\n\t\tif (!IsDictionaryType(typeSymbol)) return null;\n\t\tif (typeSymbol is not INamedTypeSymbol namedType) return null;\n\n\t\treturn namedType.TypeArguments[0];\n\t}\n\n\tpublic static ITypeSymbol? GetElementType(ITypeSymbol typeSymbol)\n\t{\n\t\tvar fullyQualifiedTypeName = typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n\t\tif (fullyQualifiedTypeName == \"global::System.Text.Json.Nodes.JsonArray\")\n\t\t\treturn null;\n\n\t\tswitch (typeSymbol)\n\t\t{\n\t\t\tcase IArrayTypeSymbol arrayType:\n\t\t\t\treturn arrayType.ElementType;", + "snippet": "using System.Linq;\nusing Microsoft.CodeAnalysis;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\n/// \n/// Helper methods for code emission.\n/// \ninternal static class CodeEmitterHelpers\n{" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/CodeEmitterHelpers.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/CodeEmitterHelpers.cs#L121-L184", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/CodeEmitterHelpers.cs", + "startLine": 121, + "endLine": 184, + "content": "case INamedTypeSymbol namedType:\n\t\t\t{\n\t\t\t\tif (namedType.SpecialType == SpecialType.System_String) break;\n\t\t\t\tif (IsDictionaryType(namedType)) break;\n\n\t\t\t\tif (TryGetEnumerableElementType(namedType, out var elementType))\n\t\t\t\t\treturn elementType;\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate static bool TryGetEnumerableElementType(INamedTypeSymbol typeSymbol, out ITypeSymbol? elementType)\n\t{\n\t\telementType = null;\n\n\t\tif (typeSymbol is { IsGenericType: true } && IsGenericIEnumerable(typeSymbol.ConstructedFrom))\n\t\t{\n\t\t\telementType = typeSymbol.TypeArguments[0];\n\t\t\treturn true;\n\t\t}\n\n\t\tforeach (var iface in typeSymbol.AllInterfaces)\n\t\t{\n\t\t\tif (!iface.IsGenericType) continue;\n\t\t\tif (!IsGenericIEnumerable(iface.ConstructedFrom)) continue;\n\n\t\t\telementType = iface.TypeArguments[0];\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate static bool IsGenericIEnumerable(INamedTypeSymbol typeSymbol)\n\t{\n\t\treturn typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat).Replace(\" \", string.Empty)\n\t\t\t== \"global::System.Collections.Generic.IEnumerable\";\n\t}\n\n\tpublic static bool ShouldIncludeEnumMember(IFieldSymbol field)\n\t{\n\t\tif (field.GetAttributes().Any(a => a.AttributeClass?.Name == \"JsonExcludeAttribute\"))\n\t\t\treturn false;\n\t\t\n\t\tvar jsonIgnoreAttr = field.GetAttributes()\n\t\t\t.FirstOrDefault(a => a.AttributeClass?.Name == \"JsonIgnoreAttribute\");\n\t\t\n\t\tif (jsonIgnoreAttr != null)\n\t\t{\n\t\t\tvar conditionArg = jsonIgnoreAttr.NamedArguments\n\t\t\t\t.FirstOrDefault(arg => arg.Key == \"Condition\");\n\t\t\t\n\t\t\tif (conditionArg.Value.Value == null || (int)conditionArg.Value.Value == 1)\n\t\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n}", + "snippet": "case INamedTypeSymbol namedType:\n\t\t\t{\n\t\t\t\tif (namedType.SpecialType == SpecialType.System_String) break;\n\t\t\t\tif (IsDictionaryType(namedType)) break;\n\n\t\t\t\tif (TryGetEnumerableElementType(namedType, out var elementType))\n\t" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/ConditionalSchemaEmitter.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/ConditionalSchemaEmitter.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/ConditionalSchemaEmitter.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal static class ConditionalSchemaEmitter\n{\n\tpublic static void EmitConditionals(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tvar conditionalsWithConsequences = type.Conditionals\n\t\t\t.Where(c => c.PropertyConsequences.Count > 0)\n\t\t\t.ToList();\n\t\t\n\t\tif (conditionalsWithConsequences.Count == 0) return;\n\t\tif (conditionalsWithConsequences.Count == 1)\n\t\t{\n\t\t\tvar conditional = conditionalsWithConsequences[0];\n\t\t\tEmitIfClause(sb, conditional, indent);\n\t\t\tEmitThenClause(sb, conditional, type, indent, context);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}.AllOf(\");\n\t\t\t\n\t\t\tfor (int i = 0; i < conditionalsWithConsequences.Count; i++)\n\t\t\t{\n\t\t\t\tvar conditional = conditionalsWithConsequences[i];\n\t\t\t\tsb.AppendLine();\n\t\t\t\tsb.Append($\"{indent}\\tnew JsonSchemaBuilder()\");\n\t\t\t\t\n\t\t\t\tEmitIfClause(sb, conditional, indent + \"\\t\");\n\t\t\t\tEmitThenClause(sb, conditional, type, indent + \"\\t\", context);\n\t\t\t\t\n\t\t\t\tif (i < conditionalsWithConsequences.Count - 1)\n\t\t\t\t\tsb.Append(\",\");\n\t\t\t}\n\t\t\t\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent})\");\n\t\t}\n\t}\n\n\tprivate static void EmitIfClause(StringBuilder sb, ConditionalInfo conditional, string indent)\n\t{\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indent}.If(new JsonSchemaBuilder()\");\n\n\t\tif (conditional.Triggers.Count > 0)\n\t\t{\n\t\t\tvar triggerGroups = conditional.Triggers\n\t\t\t\t.GroupBy(t => t.PropertySchemaName)\n\t\t\t\t.ToList();\n\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}\\t.Properties(\");\n\t\t\tsb.AppendLine();\n\t\t\t\n\t\t\tfor (int i = 0; i < triggerGroups.Count; i++)\n\t\t\t{\n\t\t\t\tvar triggerGroup = triggerGroups[i];\n\t\t\t\tsb.Append($\"{indent}\\t\\t(\\\"{CodeEmitterHelpers.EscapeString(triggerGroup.Key)}\\\", \");\n\t\t\t\tEmitTriggerSchema(sb, triggerGroup.ToList());\n\t\t\t\tsb.Append(\")\");\n\t\t\t\t\n\t\t\t\tif (i < triggerGroups.Count - 1)\n\t\t\t\t\tsb.Append(\",\");\n\t\t\t\tsb.AppendLine();\n\t\t\t}\n\t\t\t\n\t\t\tsb.Append($\"{indent}\\t)\");\n\t\t\t\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}\\t.Required(\");\n\t\t\tfor (int i = 0; i < triggerGroups.Count; i++)\n\t\t\t{\n\t\t\t\tif (i > 0)\n\t\t\t\t\tsb.Append(\", \");\n\t\t\t\tsb.Append($\"\\\"{CodeEmitterHelpers.EscapeString(triggerGroups[i].Key)}\\\"\");\n\t\t\t}\n\t\t\tsb.Append(\")\");\n\t\t}\n\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indent})\");\n\t}\n\n\tprivate static void EmitTriggerSchema(StringBuilder sb, IReadOnlyList triggers)\n\t{\n\t\tsb.Append(\"new JsonSchemaBuilder()\");\n\n\t\tvar equalityValues = triggers\n\t\t\t.Where(t => t.Type is ConditionalTriggerType.Equality or ConditionalTriggerType.Enum)\n\t\t\t.Select(t => t.ExpectedValue)\n\t\t\t.Where(v => v != null)\n\t\t\t.Distinct()\n\t\t\t.ToList();\n\n\t\tif (equalityValues.Count == 1)\n\t\t\tsb.Append($\".Const({equalityValues[0]})\");\n\t\telse if (equalityValues.Count > 1)\n\t\t\tsb.Append($\".Enum({string.Join(\", \", equalityValues)})\");\n\n\t\tforeach (var trigger in triggers.Where(t => t.Type is ConditionalTriggerType.Minimum or ConditionalTriggerType.Maximum))\n\t\t{\n\t\t\tswitch (trigger.Type)\n\t\t\t{\n\t\t\t\tcase ConditionalTriggerType.Minimum:\n\t\t\t\t\tvar minKeyword = trigger.IsExclusive ? \"ExclusiveMinimum\" : \"Minimum\";\n\t\t\t\t\tsb.Append($\".{minKeyword}({trigger.NumericValue})\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase ConditionalTriggerType.Maximum:\n\t\t\t\t\tvar maxKeyword = trigger.IsExclusive ? \"ExclusiveMaximum\" : \"Maximum\";\n\t\t\t\t\tsb.Append($\".{maxKeyword}({trigger.NumericValue})\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal static class ConditionalSchemaEmitter\n{\n\tpublic static void EmitConditionals(" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/ConditionalSchemaEmitter.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/ConditionalSchemaEmitter.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/ConditionalSchemaEmitter.cs", + "startLine": 121, + "endLine": 240, + "content": "private static void EmitThenClause(StringBuilder sb, ConditionalInfo conditional, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tif (conditional.PropertyConsequences.Count == 0) return;\n\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indent}.Then(new JsonSchemaBuilder()\");\n\n\t\tvar propertiesWithAttributes = conditional.PropertyConsequences\n\t\t\t.Where(c => c.ConditionalAttributes.Count > 0 || c.IsConditionallyReadOnly || c.IsConditionallyWriteOnly)\n\t\t\t.ToList();\n\n\t\tif (propertiesWithAttributes.Count > 0)\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}\\t.Properties(\");\n\t\t\tsb.AppendLine();\n\n\t\t\tfor (int i = 0; i < propertiesWithAttributes.Count; i++)\n\t\t\t{\n\t\t\t\tvar prop = propertiesWithAttributes[i];\n\t\t\t\tsb.Append($\"{indent}\\t\\t(\\\"{CodeEmitterHelpers.EscapeString(prop.PropertySchemaName)}\\\", \");\n\n\t\t\t\tif (type.StrictConditionals)\n\t\t\t\t{\n\t\t\t\t\tvar fullProp = type.Properties.FirstOrDefault(p => p.SchemaName == prop.PropertySchemaName);\n\t\t\t\t\tif (fullProp != null)\n\t\t\t\t\t{\n\t\t\t\t\t\tPropertySchemaEmitter.EmitPropertySchema(sb, fullProp, indent + \"\\t\\t\", context);\n\t\t\t\t\t\t\n\t\t\t\t\t\tforeach (var attr in prop.ConditionalAttributes)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (SchemaCodeEmitter.ShouldEmitBuiltInAttribute(attr))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\t\t\t\tsb.Append($\"{indent}\\t\\t\\t\");\n\t\t\t\t\t\t\t\tSchemaCodeEmitter.EmitAttributeConstraint(sb, attr);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (prop.IsConditionallyReadOnly)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\t\t\tsb.Append($\"{indent}\\t\\t\\t.ReadOnly(true)\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (prop.IsConditionallyWriteOnly)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\t\t\tsb.Append($\"{indent}\\t\\t\\t.WriteOnly(true)\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tsb.Append(\"new JsonSchemaBuilder()\");\n\t\t\t\t\t\tforeach (var attr in prop.ConditionalAttributes)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (SchemaCodeEmitter.ShouldEmitBuiltInAttribute(attr))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\t\t\t\tsb.Append($\"{indent}\\t\\t\\t\");\n\t\t\t\t\t\t\t\tSchemaCodeEmitter.EmitAttributeConstraint(sb, attr);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsb.Append(\"new JsonSchemaBuilder()\");\n\n\t\t\t\t\tforeach (var attr in prop.ConditionalAttributes)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (SchemaCodeEmitter.ShouldEmitBuiltInAttribute(attr))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\t\t\tsb.Append($\"{indent}\\t\\t\\t\");\n\t\t\t\t\t\t\tSchemaCodeEmitter.EmitAttributeConstraint(sb, attr);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (prop.IsConditionallyReadOnly)\n\t\t\t\t\t{\n\t\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\t\tsb.Append($\"{indent}\\t\\t\\t.ReadOnly(true)\");\n\t\t\t\t\t}\n\t\t\t\t\tif (prop.IsConditionallyWriteOnly)\n\t\t\t\t\t{\n\t\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\t\tsb.Append($\"{indent}\\t\\t\\t.WriteOnly(true)\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsb.Append(\")\");\n\n\t\t\t\tif (i < propertiesWithAttributes.Count - 1)\n\t\t\t\t\tsb.Append(\",\");\n\t\t\t\tsb.AppendLine();\n\t\t\t}\n\n\t\t\tsb.Append($\"{indent}\\t)\");\n\t\t}\n\n\t\tvar requiredProps = conditional.PropertyConsequences\n\t\t\t.Where(c => c.IsConditionallyRequired)\n\t\t\t.ToList();\n\n\t\tif (requiredProps.Count > 0)\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}\\t.Required(\");\n\t\t\t\n\t\t\tfor (int i = 0; i < requiredProps.Count; i++)\n\t\t\t{\n\t\t\t\tif (i > 0)\n\t\t\t\t\tsb.Append(\", \");\n\t\t\t\tsb.Append($\"\\\"{CodeEmitterHelpers.EscapeString(requiredProps[i].PropertySchemaName)}\\\"\");\n\t\t\t}\n\t\t\t\n\t\t\tsb.Append(\")\");\n\t\t}\n\n\t\tsb.AppendLine();", + "snippet": "private static void EmitThenClause(StringBuilder sb, ConditionalInfo conditional, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tif (conditional.PropertyConsequences.Count == 0) return;\n\n\t\tsb.AppendLin" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/ConditionalSchemaEmitter.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/ConditionalSchemaEmitter.cs#L241-L244", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/ConditionalSchemaEmitter.cs", + "startLine": 241, + "endLine": 244, + "content": "sb.Append($\"{indent})\");\n\t}\n}", + "snippet": "sb.Append($\"{indent})\");\n\t}\n}" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/DateTimeSchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/DateTimeSchemaEmitter.cs#L1-L20", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/DateTimeSchemaEmitter.cs", + "startLine": 1, + "endLine": 20, + "content": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class DateTimeSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.DateTime;\n\n\tpublic void EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tsb.AppendLine();\n\t\tif (type.IsNullable)\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.String, SchemaValueType.Null)\");\n\t\telse\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.String)\");\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indent}.Format(global::Json.Schema.Formats.DateTime)\");\n\t}\n}", + "snippet": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class DateTimeSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.DateTime;\n\n\tpublic voi" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/DictionarySchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/DictionarySchemaEmitter.cs#L1-L76", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/DictionarySchemaEmitter.cs", + "startLine": 1, + "endLine": 76, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing Microsoft.CodeAnalysis;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class DictionarySchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Dictionary;\n\n\tpublic void EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indent}.Type(SchemaValueType.Object)\");\n\n\t\tvar keyType = CodeEmitterHelpers.GetDictionaryKeyType(type.TypeSymbol);\n\t\tif (keyType != null)\n\t\t\tEmitPropertyNames(sb, keyType, indent, context);\n\n\t\tvar valueType = CodeEmitterHelpers.GetDictionaryValueType(type.TypeSymbol);\n\t\tif (valueType == null) return;\n\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indent}.AdditionalProperties(new JsonSchemaBuilder()\");\n\n\t\tvar isNullableValue = valueType.NullableAnnotation == NullableAnnotation.Annotated ||\n\t\t valueType.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T;\n\n\t\tSchemaCodeEmitter.EmitSchemaForType(sb, valueType, isNullableValue, indent + \"\\t\", context);\n\t\tsb.Append(\")\");\n\t}\n\n\tprivate static void EmitPropertyNames(StringBuilder sb, ITypeSymbol keyType, string indent, SchemaEmissionContext context)\n\t{\n\t\tvar unwrappedKeyType = CodeEmitterHelpers.UnwrapNullable(keyType);\n\n\t\tif (unwrappedKeyType.TypeKind == Microsoft.CodeAnalysis.TypeKind.Enum && unwrappedKeyType is INamedTypeSymbol enumType)\n\t\t{\n\t\t\tvar refUri = context.GetRefUri(enumType);\n\t\t\tif (!string.IsNullOrEmpty(refUri))\n\t\t\t{\n\t\t\t\tsb.AppendLine();\n\t\t\t\tsb.Append($\"{indent}.PropertyNames(new JsonSchemaBuilder().Ref(\\\"{refUri}\\\"))\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar enumValues = new List();\n\t\t\tforeach (var member in enumType.GetMembers().OfType())\n\t\t\t{\n\t\t\t\tif (member is { IsConst: true, HasConstantValue: true } && CodeEmitterHelpers.ShouldIncludeEnumMember(member))\n\t\t\t\t\tenumValues.Add(member.Name);\n\t\t\t}\n\n\t\t\tif (enumValues.Count > 0)\n\t\t\t{\n\t\t\t\tsb.AppendLine();\n\t\t\t\tsb.Append($\"{indent}.PropertyNames(new JsonSchemaBuilder().Enum(\");\n\t\t\t\tfor (int i = 0; i < enumValues.Count; i++)\n\t\t\t\t{\n\t\t\t\t\tif (i > 0) sb.Append(\", \");\n\t\t\t\t\tsb.Append($\"\\\"{CodeEmitterHelpers.EscapeString(enumValues[i])}\\\"\");\n\t\t\t\t}\n\t\t\t\tsb.Append(\"))\");\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (unwrappedKeyType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) == \"global::System.Guid\")\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}.PropertyNames(new JsonSchemaBuilder().Type(SchemaValueType.String).Format(global::Json.Schema.Formats.Uuid))\");\n\t\t}\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing Microsoft.CodeAnalysis;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class DictionarySchemaEmitter : ISchemaEmitter\n" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/EnumSchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/EnumSchemaEmitter.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/EnumSchemaEmitter.cs", + "startLine": 1, + "endLine": 24, + "content": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class EnumSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Enum;\n\n\tpublic void EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tif (type.EnumValues.Count <= 0) return;\n\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indent}.Enum(\");\n\t\tfor (int i = 0; i < type.EnumValues.Count; i++)\n\t\t{\n\t\t\tif (i > 0)\n\t\t\t\tsb.Append(\", \");\n\t\t\tsb.Append($\"\\\"{CodeEmitterHelpers.EscapeString(type.EnumValues[i])}\\\"\");\n\t\t}\n\t\tsb.Append(')');\n\t}\n}", + "snippet": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class EnumSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Enum;\n\n\tpublic void EmitSc" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/GuidSchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/GuidSchemaEmitter.cs#L1-L20", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/GuidSchemaEmitter.cs", + "startLine": 1, + "endLine": 20, + "content": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class GuidSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Guid;\n\n\tpublic void EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tsb.AppendLine();\n\t\tif (type.IsNullable)\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.String, SchemaValueType.Null)\");\n\t\telse\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.String)\");\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indent}.Format(global::Json.Schema.Formats.Uuid)\");\n\t}\n}", + "snippet": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class GuidSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Guid;\n\n\tpublic void EmitSc" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/IntegerSchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/IntegerSchemaEmitter.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/IntegerSchemaEmitter.cs", + "startLine": 1, + "endLine": 18, + "content": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class IntegerSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Integer;\n\n\tpublic void EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tsb.AppendLine();\n\t\tif (type.IsNullable)\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Integer, SchemaValueType.Null)\");\n\t\telse\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Integer)\");\n\t}\n}", + "snippet": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class IntegerSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Integer;\n\n\tpublic void " + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/ISchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/ISchemaEmitter.cs#L1-L10", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/ISchemaEmitter.cs", + "startLine": 1, + "endLine": 10, + "content": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal interface ISchemaEmitter\n{\n\tbool Handles(TypeInfo type);\n\tvoid EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context);\n}", + "snippet": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal interface ISchemaEmitter\n{\n\tbool Handles(TypeInfo type);\n\tvoid EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEm" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/NumberSchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/NumberSchemaEmitter.cs#L1-L71", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/NumberSchemaEmitter.cs", + "startLine": 1, + "endLine": 71, + "content": "using System.Linq;\nusing System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class NumberSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Number;\n\n\tpublic void EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tvar jsonNumberHandling = type.PropertyAttributes?\n\t\t\t.FirstOrDefault(a => a.AttributeName == \"JsonNumberHandlingAttribute\");\n\t\t\n\t\tvar handling = 0;\n\t\tif (jsonNumberHandling != null && jsonNumberHandling.Parameters.TryGetValue(\"arg0\", out var handlingValue)) \n\t\t\thandling = (int)handlingValue!;\n\t\t\n\t\tvar allowReadingFromString = (handling & 1) != 0;\n\t\tvar allowNamedFloatingPoint = (handling & 4) != 0;\n\t\t\n\t\tif (allowNamedFloatingPoint)\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}.AnyOf(\");\n\t\t\tsb.AppendLine();\n\t\t\t\n\t\t\tsb.Append($\"{indent}\\tnew JsonSchemaBuilder()\");\n\t\t\tsb.AppendLine();\n\t\t\tif (type.IsNullable)\n\t\t\t{\n\t\t\t\tif (allowReadingFromString)\n\t\t\t\t\tsb.Append($\"{indent}\\t\\t.Type(SchemaValueType.Number, SchemaValueType.String, SchemaValueType.Null)\");\n\t\t\t\telse\n\t\t\t\t\tsb.Append($\"{indent}\\t\\t.Type(SchemaValueType.Number, SchemaValueType.Null)\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (allowReadingFromString)\n\t\t\t\t\tsb.Append($\"{indent}\\t\\t.Type(SchemaValueType.Number, SchemaValueType.String)\");\n\t\t\t\telse\n\t\t\t\t\tsb.Append($\"{indent}\\t\\t.Type(SchemaValueType.Number)\");\n\t\t\t}\n\t\t\tsb.Append(\",\");\n\t\t\tsb.AppendLine();\n\t\t\t\n\t\t\tsb.Append($\"{indent}\\tnew JsonSchemaBuilder()\");\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}\\t\\t.Enum(\\\"NaN\\\", \\\"Infinity\\\", \\\"-Infinity\\\")\");\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent})\");\n\t\t}\n\t\telse if (allowReadingFromString)\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tif (type.IsNullable)\n\t\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Number, SchemaValueType.String, SchemaValueType.Null)\");\n\t\t\telse\n\t\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Number, SchemaValueType.String)\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tif (type.IsNullable)\n\t\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Number, SchemaValueType.Null)\");\n\t\t\telse\n\t\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Number)\");\n\t\t}\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class NumberSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Numbe" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/ObjectSchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/ObjectSchemaEmitter.cs#L1-L91", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/ObjectSchemaEmitter.cs", + "startLine": 1, + "endLine": 91, + "content": "using System.Linq;\nusing System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class ObjectSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Object;\n\n\tpublic void EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indent}.Type(SchemaValueType.Object)\");\n\n\t\tvar strictConditionalPropertyNames = new System.Collections.Generic.HashSet();\n\t\tif (type.StrictConditionals)\n\t\t{\n\t\t\tforeach (var conditional in type.Conditionals)\n\t\t\t{\n\t\t\t\tforeach (var consequence in conditional.PropertyConsequences)\n\t\t\t\t{\n\t\t\t\t\tif (consequence.ConditionalAttributes.Count > 0 ||\n\t\t\t\t\t\tconsequence.IsConditionallyReadOnly ||\n\t\t\t\t\t\tconsequence.IsConditionallyWriteOnly)\n\t\t\t\t\t{\n\t\t\t\t\t\tstrictConditionalPropertyNames.Add(consequence.PropertySchemaName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar propertiesToEmit = type.StrictConditionals\n\t\t\t? type.Properties.Where(p => !strictConditionalPropertyNames.Contains(p.SchemaName)).ToList()\n\t\t\t: type.Properties;\n\n\t\tif (propertiesToEmit.Count > 0)\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}.Properties(\");\n\t\t\tsb.AppendLine();\n\n\t\t\tfor (int i = 0; i < propertiesToEmit.Count; i++)\n\t\t\t{\n\t\t\t\tvar prop = propertiesToEmit[i];\n\t\t\t\tsb.Append($\"{indent}\\t(\\\"{CodeEmitterHelpers.EscapeString(prop.SchemaName)}\\\", \");\n\t\t\t\t\n\t\t\t\tPropertySchemaEmitter.EmitPropertySchema(sb, prop, indent + \"\\t\", context);\n\t\t\t\t\n\t\t\t\tsb.Append(\")\");\n\t\t\t\tif (i < propertiesToEmit.Count - 1)\n\t\t\t\t\tsb.Append(\",\");\n\t\t\t\tsb.AppendLine();\n\t\t\t}\n\n\t\t\tsb.Append($\"{indent})\");\n\t\t}\n\n\t\tvar propertiesWithConditionalRequirements = new System.Collections.Generic.HashSet(\n\t\t\ttype.Conditionals\n\t\t\t\t.SelectMany(c => c.PropertyConsequences)\n\t\t\t\t.Where(c => c.IsConditionallyRequired)\n\t\t\t\t.Select(c => c.PropertySchemaName)\n\t\t\t\t.Distinct());\n\n\t\tvar unconditionallyRequiredProps = type.Properties\n\t\t\t.Where(p => p.IsRequired && !propertiesWithConditionalRequirements.Contains(p.SchemaName))\n\t\t\t.ToList();\n\n\t\tif (unconditionallyRequiredProps.Count > 0)\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}.Required(\");\n\t\t\tfor (int i = 0; i < unconditionallyRequiredProps.Count; i++)\n\t\t\t{\n\t\t\t\tif (i > 0)\n\t\t\t\t\tsb.Append(\", \");\n\t\t\t\tsb.Append($\"\\\"{CodeEmitterHelpers.EscapeString(unconditionallyRequiredProps[i].SchemaName)}\\\"\");\n\t\t\t}\n\t\t\tsb.Append(\")\");\n\t\t}\n\n\t\tConditionalSchemaEmitter.EmitConditionals(sb, type, indent, context);\n\n\t\tif (type.StrictConditionals && type.Conditionals.Any(c => c.PropertyConsequences.Count > 0))\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}.UnevaluatedProperties(false)\");\n\t\t}\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class ObjectSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Objec" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/PropertySchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/PropertySchemaEmitter.cs#L1-L45", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/PropertySchemaEmitter.cs", + "startLine": 1, + "endLine": 45, + "content": "using System.Linq;\nusing System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal static class PropertySchemaEmitter\n{\n\tpublic static void EmitPropertySchema(StringBuilder sb, PropertyInfo property, string indent, SchemaEmissionContext context)\n\t{\n\t\tsb.Append(\"new JsonSchemaBuilder()\");\n\n\t\tvar typeAttributes = property.Attributes.Where(a => !a.Parameters.ContainsKey(\"GenericParameter\") || \n\t\t (a.Parameters.TryGetValue(\"GenericParameter\", out var gp) && ((int)gp!) == -1))\n\t\t .ToList();\n\t\tvar itemAttributes = property.Attributes.Where(a => a.Parameters.TryGetValue(\"GenericParameter\", out var gp) && ((int)gp!) == 0)\n\t\t .ToList();\n\n\t\tSchemaCodeEmitter.EmitSchemaForType(sb, property.Type, property.IsNullable, indent, context, \n\t\t itemAttributes.Count > 0 ? itemAttributes : null, \n\t\t property.Attributes);\n\t\t\n\t\tvar attributesToEmit = typeAttributes.Where(a => a.AttributeName != \"JsonNumberHandlingAttribute\").ToList();\n\t\tSchemaCodeEmitter.EmitAttributes(sb, attributesToEmit, indent);\n\n\t\tif (!string.IsNullOrWhiteSpace(property.XmlDocSummary) &&\n\t\t property.Attributes.All(a => a.AttributeName != \"DescriptionAttribute\"))\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}.Description(\\\"{CodeEmitterHelpers.EscapeString(property.XmlDocSummary!)}\\\")\");\n\t\t}\n\n\t\tif (property.IsReadOnly && property.Attributes.All(a => a.AttributeName != \"ReadOnlyAttribute\"))\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}.ReadOnly(true)\");\n\t\t}\n\n\t\tif (property.IsWriteOnly && property.Attributes.All(a => a.AttributeName != \"WriteOnlyAttribute\"))\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}.WriteOnly(true)\");\n\t\t}\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal static class PropertySchemaEmitter\n{\n\tpublic static void EmitPropertySchema(StringBuilder sb, PropertyInfo prop" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/SchemaEmitterRegistry.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/SchemaEmitterRegistry.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/SchemaEmitterRegistry.cs", + "startLine": 1, + "endLine": 29, + "content": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\n/// \n/// Shared registry of schema emitters.\n/// \ninternal static class SchemaEmitterRegistry\n{\n\t/// \n\t/// The shared collection of stateless schema emitters.\n\t/// \n\tinternal static readonly IReadOnlyList Emitters = new List\n\t{\n\t\tnew AnySchemaEmitter(),\n\t\tnew BooleanSchemaEmitter(),\n\t\tnew IntegerSchemaEmitter(),\n\t\tnew NumberSchemaEmitter(),\n\t\tnew StringSchemaEmitter(),\n\t\tnew DateTimeSchemaEmitter(),\n\t\tnew GuidSchemaEmitter(),\n\t\tnew UriSchemaEmitter(),\n\t\tnew EnumSchemaEmitter(),\n\t\tnew DictionarySchemaEmitter(),\n\t\tnew ArraySchemaEmitter(),\n\t\tnew ObjectSchemaEmitter(),\n\t};\n}", + "snippet": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\n/// \n/// Shared registry of schema emitters.\n/// \ninternal static class SchemaEmitterRegistry\n{\n\t/// type.Kind == TypeKind.String;\n\n\tpublic void EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tsb.AppendLine();\n\t\tif (type.IsNullable)\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.String, SchemaValueType.Null)\");\n\t\telse\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.String)\");\n\t}\n}", + "snippet": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class StringSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.String;\n\n\tpublic void Em" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/Emitters/UriSchemaEmitter.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/Emitters/UriSchemaEmitter.cs#L1-L20", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/Emitters/UriSchemaEmitter.cs", + "startLine": 1, + "endLine": 20, + "content": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class UriSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Uri;\n\n\tpublic void EmitSchema(StringBuilder sb, TypeInfo type, string indent, SchemaEmissionContext context)\n\t{\n\t\tsb.AppendLine();\n\t\tif (type.IsNullable)\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.String, SchemaValueType.Null)\");\n\t\telse\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.String)\");\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indent}.Format(global::Json.Schema.Formats.Uri)\");\n\t}\n}", + "snippet": "using System.Text;\n\nnamespace Json.Schema.Generation.SourceGeneration.Emitters;\n\ninternal class UriSchemaEmitter : ISchemaEmitter\n{\n\tpublic bool Handles(TypeInfo type) => type.Kind == TypeKind.Uri;\n\n\tpublic void EmitSche" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs (1/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Linq;\nusing System.Text;\nusing Json.Schema.Generation.Serialization;\nusing Json.Schema.Generation.SourceGeneration.Emitters;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.Text;\n#pragma warning disable RS1041\n\nnamespace Json.Schema.Generation.SourceGeneration;\n\n/// \n/// Source generator that creates static JSON schemas for types decorated with [GenerateJsonSchema].\n/// \n[Generator]\npublic class JsonSchemaSourceGenerator : IIncrementalGenerator\n{\n\tprivate const string _generateJsonSchemaAttributeName = \"Json.Schema.Generation.Serialization.GenerateJsonSchemaAttribute\";\n\tprivate const string _schemaHandlerAttributeName = \"Json.Schema.Generation.SchemaHandlerAttribute\";\n\tprivate const string _idAttributeName = \"Json.Schema.Generation.Serialization.IdAttribute\";\n\n\t/// \n\t/// Initializes the incremental generator.\n\t/// \n\tpublic void Initialize(IncrementalGeneratorInitializationContext context)\n\t{\n\t\tvar generationOptions = context.AnalyzerConfigOptionsProvider\n\t\t\t.Select(static (provider, _) =>\n\t\t\t{\n\t\t\t\tprovider.GlobalOptions.TryGetValue(\"build_property.DisableJsonSchemaSourceGeneration\", out var disabled);\n\t\t\t\tprovider.GlobalOptions.TryGetValue(\"build_property.RootNamespace\", out var rootNamespace);\n\t\t\t\tprovider.GlobalOptions.TryGetValue(\"build_property.JsonSchemaDefaultPropertyNaming\", out var namingRaw);\n\t\t\t\tprovider.GlobalOptions.TryGetValue(\"build_property.JsonSchemaDefaultPropertyOrder\", out var orderRaw);\n\n\t\t\t\tvar defaultNaming = Enum.TryParse(namingRaw, ignoreCase: true, out var parsedNaming)\n\t\t\t\t\t? parsedNaming\n\t\t\t\t\t: NamingConvention.AsDeclared;\n\t\t\t\tvar defaultOrder = Enum.TryParse(orderRaw, ignoreCase: true, out var parsedOrder)\n\t\t\t\t\t? parsedOrder\n\t\t\t\t\t: PropertyOrder.AsDeclared;\n\n\t\t\t\treturn new GenerationOptions\n\t\t\t\t{\n\t\t\t\t\tIsDisabled = disabled?.Equals(\"true\", StringComparison.OrdinalIgnoreCase) == true,\n\t\t\t\t\tRootNamespace = rootNamespace ?? string.Empty,\n\t\t\t\t\tDefaultPropertyNaming = defaultNaming,\n\t\t\t\t\tDefaultPropertyOrder = defaultOrder\n\t\t\t\t};\n\t\t\t});\n\n\t\tvar typesWithAttribute = context.SyntaxProvider\n\t\t\t.ForAttributeWithMetadataName(\n\t\t\t\t_generateJsonSchemaAttributeName,\n\t\t\t\tstatic (node, _) => node is TypeDeclarationSyntax,\n\t\t\t\tstatic (ctx, _) => GetTypeToGenerate(ctx))\n\t\t\t.Where(static type => type is not null);\n\n\t\tvar compilationAndTypesAndOptions = context.CompilationProvider\n\t\t\t.Combine(typesWithAttribute.Collect())\n\t\t\t.Combine(generationOptions);\n\n\t\tcontext.RegisterSourceOutput(compilationAndTypesAndOptions, static (spc, source) =>\n\t\t{\n\t\t\tvar generationOptions = source.Right;\n\t\t\tif (generationOptions.IsDisabled) return;\n\n\t\t\tExecute(source.Left.Left, source.Left.Right, generationOptions, spc);\n\t\t});\n\t}\n\n\tprivate static TypeToGenerate? GetTypeToGenerate(GeneratorAttributeSyntaxContext context)\n\t{\n\t\tif (context.TargetSymbol is not INamedTypeSymbol typeSymbol) return null;\n\n\t\tvar attributeData = context.Attributes.FirstOrDefault();\n\t\tif (attributeData == null) return null;\n\n\t\treturn new TypeToGenerate(typeSymbol, attributeData);\n\t}\n\n\tprivate static void Execute(Compilation compilation, ImmutableArray types, GenerationOptions options, SourceProductionContext context)\n\t{\n\t\tif (types.IsDefaultOrEmpty) return;\n\n\t\tvar validTypes = types.Where(t => t != null).Select(t => t!).ToList();\n\t\tif (validTypes.Count == 0) return;\n\n\t\tvar selfGeneratingAssemblies = FindSelfGeneratingAssemblies(compilation);\n\t\tvar generatedSchemaMembersByAssembly = new Dictionary>(StringComparer.Ordinal);\n\t\tvar analyzedTypes = new List();\n\t\tvar gatheredTypes = new HashSet(SymbolEqualityComparer.Default);\n\t\tvar discoveredTypeOptions = new Dictionary(SymbolEqualityComparer.Default);\n\t\tforeach (var type in validTypes)\n\t\t{\n\t\t\tvar typeInfo = TypeAnalyzer.Analyze(compilation, type.TypeSymbol, type.AttributeData, context.ReportDiagnostic, options.DefaultPropertyNaming, options.DefaultPropertyOrder);\n\t\t\tif (typeInfo != null) \n\t\t\t{\n\t\t\t\tanalyzedTypes.Add(typeInfo);\n\t\t\t\tRegisterTypeOptions(discoveredTypeOptions, typeInfo.TypeSymbol, typeInfo.PropertyNaming, typeInfo.PropertyOrder);\n\t\t\t\tGatherCandidateTypes(compilation, typeInfo, gatheredTypes, context.ReportDiagnostic, discoveredTypeOptions, typeInfo.PropertyNaming, typeInfo.PropertyOrder);\n\t\t\t}\n\t\t}\n\n\t\tif (analyzedTypes.Count == 0) return;\n\n\t\tvar foreignSchemaIdsByType = ResolveForeignCoverage(compilation, gatheredTypes, selfGeneratingAssemblies, generatedSchemaMembersByAssembly);\n\t\tvar localTypes = new HashSet(gatheredTypes, SymbolEqualityComparer.Default);\n\t\tforeach (var foreignType in foreignSchemaIdsByType.Keys)\n\t\t\tlocalTypes.Remove(foreignType);\n\n\t\tvar schemaHandlers = DiscoverSchemaHandlers(compilation);\n\n\t\t// Analyze all encountered types that aren't already analyzed\n\t\tvar allTypeInfos = new List(analyzedTypes);\n\t\tforeach (var typeSymbol in localTypes)\n\t\t{", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Linq;\nusing System.Text;\nusing Json.Schema.Generation.Serialization;\nusing Json.Schema.Generation.SourceGeneration.Emitters" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs (2/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs", + "startLine": 121, + "endLine": 240, + "content": "if (analyzedTypes.Any(t => SymbolEqualityComparer.Default.Equals(t.TypeSymbol, typeSymbol))) continue;\n\n\t\t\tif (typeSymbol is IArrayTypeSymbol arrayTypeSymbol)\n\t\t\t{\n\t\t\t\tif (allTypeInfos.Any(t => SymbolEqualityComparer.Default.Equals(t.TypeSymbol, arrayTypeSymbol))) continue;\n\n\t\t\t\tallTypeInfos.Add(AnalyzeArrayType(arrayTypeSymbol, options.DefaultPropertyNaming, options.DefaultPropertyOrder));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (typeSymbol is INamedTypeSymbol namedTypeSymbol)\n\t\t\t{\n\t\t\t\tvar naming = options.DefaultPropertyNaming;\n\t\t\t\tvar order = options.DefaultPropertyOrder;\n\t\t\t\tif (discoveredTypeOptions.TryGetValue(namedTypeSymbol, out var discovered))\n\t\t\t\t{\n\t\t\t\t\tnaming = discovered.Naming;\n\t\t\t\t\torder = discovered.Order;\n\t\t\t\t}\n\n\t\t\t\tvar typeInfo = TypeAnalyzer.Analyze(compilation, namedTypeSymbol, null, context.ReportDiagnostic, naming, order);\n\t\t\t\tif (typeInfo != null)\n\t\t\t\t\tallTypeInfos.Add(typeInfo);\n\t\t\t}\n\t\t}\n\n\t\tResolvePropertyNameConflicts(allTypeInfos, options.RootNamespace);\n\n\t\tvar foreignTypeEntries = new List<(string TypeName, string SchemaId)>();\n\t\tforeach (var kvp in foreignSchemaIdsByType)\n\t\t{\n\t\t\tforeignTypeEntries.Add((kvp.Key.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), kvp.Value));\n\t\t}\n\n\t\tvar targetNamespace = options.RootNamespace;\n\t\tvar classDeclaration = DetectGeneratedJsonSchemasClass(compilation, targetNamespace, context.ReportDiagnostic);\n\t\tvar generatedCode = SchemaCodeEmitter.EmitGeneratedClass(allTypeInfos, targetNamespace, classDeclaration, schemaHandlers, foreignTypeEntries);\n\n\t\tcontext.AddSource(\"GeneratedJsonSchemas.g.cs\", SourceText.From(generatedCode, Encoding.UTF8));\n\t}\n\n\tprivate static List DiscoverSchemaHandlers(Compilation compilation)\n\t{\n\t\tvar results = new List();\n\t\tvar systemType = compilation.GetTypeByMetadataName(\"System.Type\");\n\t\tCollectSchemaHandlers(compilation.Assembly.GlobalNamespace, results, systemType);\n\t\treturn results;\n\t}\n\n\tprivate static void CollectSchemaHandlers(INamespaceSymbol namespaceSymbol, List results, INamedTypeSymbol? systemType)\n\t{\n\t\tforeach (var type in namespaceSymbol.GetTypeMembers())\n\t\t\tCollectSchemaHandlers(type, results, systemType);\n\n\t\tforeach (var nested in namespaceSymbol.GetNamespaceMembers())\n\t\t\tCollectSchemaHandlers(nested, results, systemType);\n\t}\n\n\tprivate static void CollectSchemaHandlers(INamedTypeSymbol typeSymbol, List results, INamedTypeSymbol? systemType)\n\t{\n\t\tforeach (var attr in typeSymbol.GetAttributes())\n\t\t{\n\t\t\tif (attr.AttributeClass?.ToDisplayString() != _schemaHandlerAttributeName) continue;\n\t\t\tif (attr.ConstructorArguments.Length == 0) continue;\n\t\t\tif (attr.ConstructorArguments[0].Value is not INamedTypeSymbol targetTypeSymbol) continue;\n\n\t\t\tvar applyMethod = typeSymbol.GetMembers(\"Apply\")\n\t\t\t\t.OfType()\n\t\t\t\t.FirstOrDefault(m => m is { IsStatic: true } &&\n\t\t\t\t m.Parameters.Length == 2 &&\n\t\t\t\t m.Parameters[0].Type.Name == \"JsonSchemaBuilder\" &&\n\t\t\t\t SymbolEqualityComparer.Default.Equals(m.Parameters[1].Type, systemType) &&\n\t\t\t\t (m.ReturnsVoid || m.ReturnType.Name == \"JsonSchemaBuilder\"));\n\n\t\t\tif (applyMethod == null) continue;\n\n\t\t\tvar isOpenGenericTarget = targetTypeSymbol.IsUnboundGenericType;\n\n\t\t\tresults.Add(new SchemaHandlerInfo\n\t\t\t{\n\t\t\t\tHandlerTypeName = typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat),\n\t\t\t\tTargetTypeName = targetTypeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat),\n\t\t\t\tIsOpenGenericTarget = isOpenGenericTarget,\n\t\t\t\tReturnsBuilder = !applyMethod.ReturnsVoid\n\t\t\t});\n\t\t}\n\n\t\tforeach (var nested in typeSymbol.GetTypeMembers())\n\t\t\tCollectSchemaHandlers(nested, results, systemType);\n\t}\n\n\tprivate static void GatherCandidateTypes(Compilation compilation, TypeInfo typeInfo, HashSet allTypes, Action reportDiagnostic, Dictionary discoveredTypeOptions, NamingConvention naming, PropertyOrder order)\n\t{\n\t\tCollectTypeRecursive(compilation, typeInfo.TypeSymbol, allTypes, reportDiagnostic, discoveredTypeOptions, naming, order);\n\n\t\tforeach (var prop in typeInfo.Properties)\n\t\t{\n\t\t\tCollectTypeRecursive(compilation, prop.Type, allTypes, reportDiagnostic, discoveredTypeOptions, naming, order);\n\t\t}\n\t}\n\n\tprivate static void CollectTypeRecursive(Compilation compilation, ITypeSymbol typeSymbol, HashSet allTypes, Action reportDiagnostic, Dictionary discoveredTypeOptions, NamingConvention naming, PropertyOrder order)\n\t{\n\t\tvar unwrapped = CodeEmitterHelpers.UnwrapNullable(typeSymbol);\n\t\tif (IsBuiltInJsonDomType(unwrapped)) return;\n\n\t\tvar typeKind = SchemaCodeEmitter.DetermineTypeKind(unwrapped);\n\t\tif (typeKind is TypeKind.Boolean or TypeKind.Integer or \n\t\t TypeKind.Number or TypeKind.String or \n\t\t TypeKind.DateTime or TypeKind.Guid or \n\t\t TypeKind.Uri)\n\t\t\treturn;\n\n\t\tif (typeKind == TypeKind.Enum && unwrapped is INamedTypeSymbol enumType)\n\t\t{\n\t\t\tif (allTypes.Add(enumType))\n\t\t\t\tRegisterTypeOptions(discoveredTypeOptions, enumType, naming, order);\n\t\t\treturn;\n\t\t}", + "snippet": "if (analyzedTypes.Any(t => SymbolEqualityComparer.Default.Equals(t.TypeSymbol, typeSymbol))) continue;\n\n\t\t\tif (typeSymbol is IArrayTypeSymbol arrayTypeSymbol)\n\t\t\t{\n\t\t\t\tif (allTypeInfos.Any(t => SymbolEqualityComparer.Def" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs (3/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs", + "startLine": 241, + "endLine": 360, + "content": "if (typeKind == TypeKind.Array)\n\t\t{\n\t\t\tallTypes.Add(unwrapped);\n\n\t\t\tvar elementType = CodeEmitterHelpers.GetElementType(unwrapped);\n\t\t\tif (elementType != null)\n\t\t\t\tCollectTypeRecursive(compilation, elementType, allTypes, reportDiagnostic, discoveredTypeOptions, naming, order);\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeKind == TypeKind.Dictionary)\n\t\t{\n\t\t\tallTypes.Add(unwrapped);\n\n\t\t\tvar keyType = CodeEmitterHelpers.GetDictionaryKeyType(unwrapped);\n\t\t\tif (keyType != null)\n\t\t\t\tCollectTypeRecursive(compilation, keyType, allTypes, reportDiagnostic, discoveredTypeOptions, naming, order);\n\n\t\t\tvar valueType = CodeEmitterHelpers.GetDictionaryValueType(unwrapped);\n\t\t\tif (valueType != null)\n\t\t\t\tCollectTypeRecursive(compilation, valueType, allTypes, reportDiagnostic, discoveredTypeOptions, naming, order);\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeKind == TypeKind.Object && unwrapped is INamedTypeSymbol namedType)\n\t\t{\n\t\t\tRegisterTypeOptions(discoveredTypeOptions, namedType, naming, order);\n\n\t\t\tif (allTypes.Add(namedType))\n\t\t\t{\n\t\t\t\t// Analyze the type to collect its properties' types\n\t\t\t\tvar tempTypeInfo = TypeAnalyzer.Analyze(compilation, namedType, null, reportDiagnostic, naming, order);\n\t\t\t\tif (tempTypeInfo != null)\n\t\t\t\t{\n\t\t\t\t\tforeach (var prop in tempTypeInfo.Properties)\n\t\t\t\t\t{\n\t\t\t\t\t\tCollectTypeRecursive(compilation, prop.Type, allTypes, reportDiagnostic, discoveredTypeOptions, naming, order);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static Dictionary ResolveForeignCoverage(Compilation compilation, HashSet gatheredTypes, HashSet selfGeneratingAssemblies, Dictionary> generatedSchemaMembersByAssembly)\n\t{\n\t\tvar result = new Dictionary(SymbolEqualityComparer.Default);\n\n\t\tforeach (var typeSymbol in gatheredTypes)\n\t\t{\n\t\t\tif (TryGetCoveredSchemaId(typeSymbol, compilation, selfGeneratingAssemblies, generatedSchemaMembersByAssembly, out var schemaId))\n\t\t\t\tresult[typeSymbol] = schemaId;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprivate static bool IsBuiltInJsonDomType(ITypeSymbol typeSymbol)\n\t{\n\t\tvar typeName = typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n\t\treturn typeName is\n\t\t\t\"global::System.Text.Json.JsonDocument\" or\n\t\t\t\"global::System.Text.Json.JsonElement\" or\n\t\t\t\"global::System.Text.Json.Nodes.JsonNode\" or\n\t\t\t\"global::System.Text.Json.Nodes.JsonValue\" or\n\t\t\t\"global::System.Text.Json.Nodes.JsonObject\" or\n\t\t\t\"global::System.Text.Json.Nodes.JsonArray\";\n\t}\n\n\tprivate static void RegisterTypeOptions(Dictionary discoveredTypeOptions, ITypeSymbol typeSymbol, NamingConvention naming, PropertyOrder order)\n\t{\n\t\tif (discoveredTypeOptions.ContainsKey(typeSymbol)) return;\n\n\t\tdiscoveredTypeOptions[typeSymbol] = (naming, order);\n\t}\n\n\tprivate static TypeInfo AnalyzeArrayType(IArrayTypeSymbol typeSymbol, NamingConvention propertyNaming, PropertyOrder propertyOrder)\n\t{\n\t\treturn new TypeInfo\n\t\t{\n\t\t\tTypeSymbol = typeSymbol,\n\t\t\tFullyQualifiedName = typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat),\n\t\t\tSchemaPropertyName = GetSchemaPropertyName(typeSymbol),\n\t\t\tPropertyNaming = propertyNaming,\n\t\t\tPropertyOrder = propertyOrder,\n\t\t\tStrictConditionals = false,\n\t\t\tKind = TypeKind.Array,\n\t\t\tIsNullable = false\n\t\t};\n\t}\n\n\tprivate static HashSet FindSelfGeneratingAssemblies(Compilation compilation)\n\t{\n\t\tvar result = new HashSet(SymbolEqualityComparer.Default);\n\t\tforeach (var reference in compilation.References)\n\t\t{\n\t\t\tif (compilation.GetAssemblyOrModuleSymbol(reference) is IAssemblySymbol assembly)\n\t\t\t{\n\t\t\t\tif (HasGeneratedJsonSchemasClass(assembly.GlobalNamespace) || ReferencesSchemaGenerationPackage(assembly))\n\t\t\t\t\tresult.Add(assembly);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate static bool TryGetCoveredSchemaId(ITypeSymbol typeSymbol, Compilation compilation, HashSet selfGeneratingAssemblies, Dictionary> generatedSchemaMembersByAssembly, out string schemaId)\n\t{\n\t\tschemaId = string.Empty;\n\t\tvar coverageCandidates = GetCoverageCandidates(compilation, typeSymbol);\n\t\tif (coverageCandidates.Count == 0)\n\t\t\treturn false;\n\n\t\tforeach (var assembly in selfGeneratingAssemblies)\n\t\t{\n\t\t\tvar memberNames = GetGeneratedSchemaMemberNames(assembly, generatedSchemaMembersByAssembly);\n\t\t\tforeach (var candidate in coverageCandidates)\n\t\t\t{\n\t\t\t\tvar isDeclaringAssembly = SymbolEqualityComparer.Default.Equals(assembly, candidate.DeclaringAssembly);\n\t\t\t\tif (!isDeclaringAssembly && candidate.DeclaringAssembly != null && !ReferencesAssembly(assembly, candidate.DeclaringAssembly))\n\t\t\t\t\tcontinue;", + "snippet": "if (typeKind == TypeKind.Array)\n\t\t{\n\t\t\tallTypes.Add(unwrapped);\n\n\t\t\tvar elementType = CodeEmitterHelpers.GetElementType(unwrapped);\n\t\t\tif (elementType != null)\n\t\t\t\tCollectTypeRecursive(compilation, elementType, allTypes," + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs (4/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs", + "startLine": 361, + "endLine": 480, + "content": "if (!memberNames.Contains(candidate.MemberName)) continue;\n\n\t\t\t\tschemaId = candidate.SchemaId;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate static List<(string MemberName, string SchemaId, IAssemblySymbol? DeclaringAssembly)> GetCoverageCandidates(Compilation compilation, ITypeSymbol typeSymbol)\n\t{\n\t\tvar result = new List<(string MemberName, string SchemaId, IAssemblySymbol? DeclaringAssembly)>();\n\t\tvar seenMemberNames = new HashSet(StringComparer.Ordinal);\n\n\t\tvoid AddCandidate(ITypeSymbol candidate)\n\t\t{\n\t\t\tif (!TryGetCoverageCandidate(candidate, out var entry)) return;\n\t\t\tif (!seenMemberNames.Add(entry.MemberName)) return;\n\n\t\t\tresult.Add(entry);\n\t\t}\n\n\t\tvar unwrapped = CodeEmitterHelpers.UnwrapNullable(typeSymbol);\n\t\tAddCandidate(unwrapped);\n\n\t\tif (unwrapped is IArrayTypeSymbol arrayType)\n\t\t{\n\t\t\tvar elementType = CodeEmitterHelpers.GetElementType(arrayType);\n\t\t\tif (elementType == null) return result;\n\n\t\t\tvar canonicalEnumerable = TryConstructGenericType(compilation, \"System.Collections.Generic.IEnumerable`1\", [elementType]);\n\t\t\tif (canonicalEnumerable != null)\n\t\t\t\tAddCandidate(canonicalEnumerable);\n\n\t\t\treturn result;\n\t\t}\n\n\t\tif (unwrapped is not INamedTypeSymbol namedType)\n\t\t\treturn result;\n\n\t\tif (CodeEmitterHelpers.IsCollectionType(namedType))\n\t\t{\n\t\t\tvar elementType = CodeEmitterHelpers.GetElementType(namedType);\n\t\t\tif (elementType != null)\n\t\t\t{\n\t\t\t\tvar canonicalEnumerable = TryConstructGenericType(compilation, \"System.Collections.Generic.IEnumerable`1\", [elementType]);\n\t\t\t\tif (canonicalEnumerable != null)\n\t\t\t\t\tAddCandidate(canonicalEnumerable);\n\n\t\t\t\tAddCandidate(compilation.CreateArrayTypeSymbol(elementType));\n\t\t\t}\n\t\t}\n\n\t\tif (CodeEmitterHelpers.IsDictionaryType(namedType))\n\t\t{\n\t\t\tvar keyType = CodeEmitterHelpers.GetDictionaryKeyType(namedType);\n\t\t\tvar valueType = CodeEmitterHelpers.GetDictionaryValueType(namedType);\n\t\t\tif (keyType != null && valueType != null)\n\t\t\t{\n\t\t\t\tvar canonicalInterface = TryConstructGenericType(compilation, \"System.Collections.Generic.IDictionary`2\", [keyType, valueType]);\n\t\t\t\tif (canonicalInterface != null)\n\t\t\t\t\tAddCandidate(canonicalInterface);\n\n\t\t\t\tvar concreteDictionary = TryConstructGenericType(compilation, \"System.Collections.Generic.Dictionary`2\", [keyType, valueType]);\n\t\t\t\tif (concreteDictionary != null)\n\t\t\t\t\tAddCandidate(concreteDictionary);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprivate static bool TryGetCoverageCandidate(ITypeSymbol typeSymbol, out (string MemberName, string SchemaId, IAssemblySymbol? DeclaringAssembly) result)\n\t{\n\t\tif (typeSymbol is INamedTypeSymbol namedType)\n\t\t{\n\t\t\tresult = (GetSchemaPropertyName(namedType), GetForeignSchemaId(namedType), namedType.ContainingAssembly);\n\t\t\treturn true;\n\t\t}\n\n\t\tif (typeSymbol is IArrayTypeSymbol arrayType)\n\t\t{\n\t\t\tresult = (\n\t\t\t\tGetSchemaPropertyName(arrayType),\n\t\t\t\tSchemaCodeEmitter.ToUrn(arrayType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)),\n\t\t\t\tarrayType.ContainingAssembly\n\t\t\t);\n\t\t\treturn true;\n\t\t}\n\n\t\tresult = default;\n\t\treturn false;\n\t}\n\n\tprivate static INamedTypeSymbol? TryConstructGenericType(Compilation compilation, string metadataName, IReadOnlyList arguments)\n\t{\n\t\tif (compilation.GetTypeByMetadataName(metadataName) is not INamedTypeSymbol genericType)\n\t\t\treturn null;\n\n\t\treturn genericType.Construct(arguments.ToArray());\n\t}\n\n\tprivate static bool ReferencesAssembly(IAssemblySymbol sourceAssembly, IAssemblySymbol targetAssembly)\n\t{\n\t\tforeach (var module in sourceAssembly.Modules)\n\t\t{\n\t\t\tforeach (var referencedAssembly in module.ReferencedAssemblySymbols)\n\t\t\t{\n\t\t\t\tif (SymbolEqualityComparer.Default.Equals(referencedAssembly, targetAssembly))\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate static HashSet GetGeneratedSchemaMemberNames(IAssemblySymbol assembly, Dictionary> generatedSchemaMembersByAssembly)\n\t{\n\t\tvar key = assembly.Identity.ToString();", + "snippet": "if (!memberNames.Contains(candidate.MemberName)) continue;\n\n\t\t\t\tschemaId = candidate.SchemaId;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate static List<(string MemberName, string SchemaId, IAssemblySymbol? Dec" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs (5/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs", + "startLine": 481, + "endLine": 600, + "content": "if (generatedSchemaMembersByAssembly.TryGetValue(key, out var existing))\n\t\t\treturn existing;\n\n\t\tvar names = new HashSet(StringComparer.Ordinal);\n\t\tforeach (var schemaType in GetGeneratedJsonSchemasTypes(assembly.GlobalNamespace))\n\t\t{\n\t\t\tforeach (var member in schemaType.GetMembers())\n\t\t\t{\n\t\t\t\tif (member is IFieldSymbol { IsStatic: true, Type.Name: \"JsonSchema\" } field)\n\t\t\t\t\tnames.Add(field.Name);\n\t\t\t\tif (member is IPropertySymbol { IsStatic: true, Type.Name: \"JsonSchema\" } prop)\n\t\t\t\t\tnames.Add(prop.Name);\n\t\t\t}\n\t\t}\n\n\t\tgeneratedSchemaMembersByAssembly[key] = names;\n\t\treturn names;\n\t}\n\n\tprivate static IEnumerable GetGeneratedJsonSchemasTypes(INamespaceSymbol ns)\n\t{\n\t\tforeach (var type in ns.GetTypeMembers(\"GeneratedJsonSchemas\"))\n\t\t\tyield return type;\n\n\t\tforeach (var nested in ns.GetNamespaceMembers())\n\t\t{\n\t\t\tforeach (var type in GetGeneratedJsonSchemasTypes(nested))\n\t\t\t\tyield return type;\n\t\t}\n\t}\n\n\tprivate static string GetSchemaPropertyName(INamedTypeSymbol typeSymbol)\n\t{\n\t\tvar currentName = typeSymbol.Name;\n\n\t\tif (typeSymbol.IsGenericType && typeSymbol.TypeArguments.Length > 0)\n\t\t{\n\t\t\tvar typeArgNames = typeSymbol.TypeArguments.Select(GetTypeArgumentPropertyName);\n\t\t\tcurrentName = $\"{currentName}Of{string.Join(\"And\", typeArgNames)}\";\n\t\t}\n\n\t\treturn typeSymbol.ContainingType != null\n\t\t\t? $\"{GetSchemaPropertyName(typeSymbol.ContainingType)}_{currentName}\"\n\t\t\t: currentName;\n\t}\n\n\tprivate static string GetSchemaPropertyName(IArrayTypeSymbol typeSymbol)\n\t{\n\t\treturn $\"{GetTypeArgumentPropertyName(typeSymbol.ElementType)}Array\";\n\t}\n\n\tprivate static string GetTypeArgumentPropertyName(ITypeSymbol typeSymbol)\n\t{\n\t\tvar isNullable = typeSymbol.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T ||\n\t\t typeSymbol.NullableAnnotation == NullableAnnotation.Annotated;\n\t\tvar unwrapped = CodeEmitterHelpers.UnwrapNullable(typeSymbol);\n\n\t\tstring name;\n\t\tif (unwrapped is INamedTypeSymbol namedType)\n\t\t\tname = GetSchemaPropertyName(namedType);\n\t\telse if (unwrapped is IArrayTypeSymbol arrayType)\n\t\t\tname = $\"{GetTypeArgumentPropertyName(arrayType.ElementType)}Array\";\n\t\telse\n\t\t\tname = SanitizeSchemaPropertyName(unwrapped.Name);\n\n\t\tif (isNullable)\n\t\t\tname += \"Nullable\";\n\n\t\treturn name;\n\t}\n\n\tprivate static string SanitizeSchemaPropertyName(string name)\n\t{\n\t\tvar sb = new StringBuilder(name.Length);\n\t\tvar lastWasUnderscore = false;\n\n\t\tforeach (var ch in name)\n\t\t{\n\t\t\tif (char.IsLetterOrDigit(ch) || ch == '_')\n\t\t\t{\n\t\t\t\tsb.Append(ch);\n\t\t\t\tlastWasUnderscore = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (lastWasUnderscore) continue;\n\n\t\t\tsb.Append('_');\n\t\t\tlastWasUnderscore = true;\n\t\t}\n\n\t\treturn sb.ToString().Trim('_');\n\t}\n\n\tprivate static bool ReferencesSchemaGenerationPackage(IAssemblySymbol assembly)\n\t{\n\t\tforeach (var module in assembly.Modules)\n\t\t{\n\t\t\tforeach (var referencedAssembly in module.ReferencedAssemblySymbols)\n\t\t\t{\n\t\t\t\tif (referencedAssembly.Name is \"JsonSchema.Net.Generation\" or \"Json.Schema.Generation\")\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate static bool HasGeneratedJsonSchemasClass(INamespaceSymbol ns)\n\t{\n\t\tif (ns.GetTypeMembers(\"GeneratedJsonSchemas\").Length > 0)\n\t\t\treturn true;\n\n\t\tforeach (var nested in ns.GetNamespaceMembers())\n\t\t{\n\t\t\tif (HasGeneratedJsonSchemasClass(nested))\n\t\t\t\treturn true;\n\t\t}\n\n\t\treturn false;", + "snippet": "if (generatedSchemaMembersByAssembly.TryGetValue(key, out var existing))\n\t\t\treturn existing;\n\n\t\tvar names = new HashSet(StringComparer.Ordinal);\n\t\tforeach (var schemaType in GetGeneratedJsonSchemasTypes(assembly." + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs (6/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs", + "startLine": 601, + "endLine": 720, + "content": "}\n\n\tprivate static string GetForeignSchemaId(ITypeSymbol typeSymbol)\n\t{\n\t\tvar idAttr = typeSymbol.GetAttributes()\n\t\t\t.FirstOrDefault(a => a.AttributeClass?.ToDisplayString() == _idAttributeName);\n\t\tif (idAttr != null && idAttr.ConstructorArguments.Length > 0 &&\n\t\t idAttr.ConstructorArguments[0].Value is string idStr)\n\t\t\treturn idStr;\n\t\treturn SchemaCodeEmitter.ToUrn(typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat));\n\t}\n\n\tprivate static ClassDeclarationInfo DetectGeneratedJsonSchemasClass(\n\t\tCompilation compilation, \n\t\tstring namespaceName,\n\t\tAction reportDiagnostic)\n\t{\n\t\t// Search for GeneratedJsonSchemas class in this namespace\n\t\tvar namespaceSymbol = string.IsNullOrEmpty(namespaceName) \n\t\t\t? compilation.GlobalNamespace \n\t\t\t: GetNamespaceSymbol(compilation.GlobalNamespace, namespaceName);\n\n\t\tif (namespaceSymbol == null)\n\t\t\treturn ClassDeclarationInfo.Default;\n\n\t\tvar classSymbol = namespaceSymbol.GetTypeMembers(\"GeneratedJsonSchemas\").FirstOrDefault();\n\t\t\n\t\tif (classSymbol == null)\n\t\t\treturn ClassDeclarationInfo.Default;\n\n\t\t// Check if the class is partial\n\t\tvar isPartial = classSymbol.DeclaringSyntaxReferences\n\t\t\t.Select(r => r.GetSyntax())\n\t\t\t.OfType()\n\t\t\t.Any(c => c.Modifiers.Any(m => m.IsKind(SyntaxKind.PartialKeyword)));\n\n\t\tif (!isPartial)\n\t\t{\n\t\t\tvar namespacePart = string.IsNullOrEmpty(namespaceName) \n\t\t\t\t? \"the global namespace\" \n\t\t\t\t: $\"namespace '{namespaceName}'\";\n\t\t\tvar diagnostic = Diagnostic.Create(\n\t\t\t\tDiagnostics.GeneratedJsonSchemasClassMustBePartial,\n\t\t\t\tclassSymbol.Locations.FirstOrDefault(),\n\t\t\t\tnamespacePart);\n\t\t\treportDiagnostic(diagnostic);\n\t\t\t\n\t\t\t// Still return info but it will cause compilation error\n\t\t\treturn ClassDeclarationInfo.Default;\n\t\t}\n\n\t\t// Extract modifiers\n\t\tvar isPublic = classSymbol.DeclaredAccessibility == Accessibility.Public;\n\t\tvar isInternal = classSymbol.DeclaredAccessibility == Accessibility.Internal;\n\t\tvar isStatic = classSymbol.IsStatic;\n\n\t\treturn new ClassDeclarationInfo\n\t\t{\n\t\t\tIsPublic = isPublic,\n\t\t\tIsInternal = isInternal,\n\t\t\tIsStatic = isStatic,\n\t\t\tIsPartial = true\n\t\t};\n\t}\n\n\tprivate static INamespaceSymbol? GetNamespaceSymbol(INamespaceSymbol rootNamespace, string qualifiedName)\n\t{\n\t\tvar parts = qualifiedName.Split('.');\n\t\tvar current = rootNamespace;\n\n\t\tforeach (var part in parts)\n\t\t{\n\t\t\tvar next = current.GetNamespaceMembers().FirstOrDefault(ns => ns.Name == part);\n\t\t\tif (next == null)\n\t\t\t\treturn null;\n\t\t\tcurrent = next;\n\t\t}\n\n\t\treturn current;\n\t}\n\n\tprivate static void ResolvePropertyNameConflicts(List types, string rootNamespace)\n\t{\n\t\tvar groups = types.GroupBy(t => t.SchemaPropertyName).Where(g => g.Count() > 1);\n\t\tforeach (var group in groups)\n\t\t{\n\t\t\tforeach (var type in group)\n\t\t\t{\n\t\t\t\tvar relNs = GetRelativeNamespace(type.TypeSymbol, rootNamespace);\n\t\t\t\tvar prefix = string.IsNullOrEmpty(relNs) ? string.Empty : relNs + \"_\";\n\t\t\t\ttype.ResolvedPropertyName = prefix + type.SchemaPropertyName;\n\t\t\t}\n\t\t}\n\n\t\tvar usedNames = new HashSet(StringComparer.Ordinal);\n\t\tforeach (var type in types.OrderBy(t => t.FullyQualifiedName, StringComparer.Ordinal))\n\t\t{\n\t\t\tvar baseName = type.ResolvedPropertyName ?? type.SchemaPropertyName;\n\t\t\tvar candidate = baseName;\n\t\t\tvar index = 2;\n\n\t\t\twhile (!usedNames.Add(candidate))\n\t\t\t{\n\t\t\t\tcandidate = $\"{baseName}_{index}\";\n\t\t\t\tindex++;\n\t\t\t}\n\n\t\t\ttype.ResolvedPropertyName = candidate == type.SchemaPropertyName ? null : candidate;\n\t\t}\n\t}\n\n\tprivate static string GetRelativeNamespace(ITypeSymbol typeSymbol, string rootNamespace)\n\t{\n\t\tvar ns = GetContainingNamespace(typeSymbol);\n\t\tif (!string.IsNullOrEmpty(rootNamespace) && ns.StartsWith(rootNamespace))\n\t\t\tns = ns.Length > rootNamespace.Length ? ns[(rootNamespace.Length + 1)..] : string.Empty;\n\t\treturn ns.Replace(\".\", \"_\");\n\t}\n\n\tprivate static string GetContainingNamespace(ITypeSymbol typeSymbol)", + "snippet": "}\n\n\tprivate static string GetForeignSchemaId(ITypeSymbol typeSymbol)\n\t{\n\t\tvar idAttr = typeSymbol.GetAttributes()\n\t\t\t.FirstOrDefault(a => a.AttributeClass?.ToDisplayString() == _idAttributeName);\n\t\tif (idAttr != null && " + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs (7/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs#L721-L754", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/JsonSchemaSourceGenerator.cs", + "startLine": 721, + "endLine": 754, + "content": "{\n\t\tvar ns = typeSymbol.ContainingNamespace;\n\t\tif (ns == null || ns.IsGlobalNamespace) return string.Empty;\n\t\tvar parts = new List();\n\t\twhile (ns is { IsGlobalNamespace: false })\n\t\t{\n\t\t\tparts.Add(ns.Name);\n\t\t\tns = ns.ContainingNamespace;\n\t\t}\n\t\tparts.Reverse();\n\t\treturn string.Join(\".\", parts);\n\t}\n\n\tprivate sealed class TypeToGenerate\n\t{\n\t\tpublic INamedTypeSymbol TypeSymbol { get; }\n\t\tpublic AttributeData AttributeData { get; }\n\n\t\tpublic TypeToGenerate(INamedTypeSymbol typeSymbol, AttributeData attributeData)\n\t\t{\n\t\t\tTypeSymbol = typeSymbol;\n\t\t\tAttributeData = attributeData;\n\t\t}\n\t}\n\n\tprivate sealed class GenerationOptions\n\t{\n\t\tpublic required bool IsDisabled { get; init; }\n\t\tpublic required string RootNamespace { get; init; }\n\t\tpublic required NamingConvention DefaultPropertyNaming { get; init; }\n\t\tpublic required PropertyOrder DefaultPropertyOrder { get; init; }\n\t}\n}", + "snippet": "{\n\t\tvar ns = typeSymbol.ContainingNamespace;\n\t\tif (ns == null || ns.IsGlobalNamespace) return string.Empty;\n\t\tvar parts = new List();\n\t\twhile (ns is { IsGlobalNamespace: false })\n\t\t{\n\t\t\tparts.Add(ns.Name);\n\t\t\tns " + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs (1/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing Json.Schema.Generation.SourceGeneration.Emitters;\nusing Json.Schema.Generation.Serialization;\nusing Microsoft.CodeAnalysis;\n\nnamespace Json.Schema.Generation.SourceGeneration;\n\ninternal static class SchemaCodeEmitter\n{\n\tpublic static void EmitSchemaForType(StringBuilder sb, ITypeSymbol typeSymbol, bool isNullable, string indent, SchemaEmissionContext? context = null, List? itemAttributes = null, List? propertyAttributes = null)\n\t{\n\t\tvar unwrapped = CodeEmitterHelpers.UnwrapNullable(typeSymbol);\n\t\tvar typeKind = DetermineTypeKind(unwrapped);\n\t\tif (typeKind == TypeKind.Object && context != null)\n\t\t{\n\t\t\tif (context.HasSchemaHandler(unwrapped))\n\t\t\t{\n\t\t\t\tsb.AppendLine();\n\n\t\t\t\tif (isNullable)\n\t\t\t\t{\n\t\t\t\t\tsb.Append($\"{indent}.AnyOf(\");\n\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\tsb.Append($\"{indent}\\tnew JsonSchemaBuilder().BuildForType(typeof({unwrapped.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)})),\");\n\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\tsb.Append($\"{indent}\\tnew JsonSchemaBuilder().Type(SchemaValueType.Null)\");\n\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\tsb.Append($\"{indent})\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tsb.Append($\"{indent}.BuildForType(typeof({unwrapped.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}))\");\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (context.RootType != null && SymbolEqualityComparer.Default.Equals(unwrapped, CodeEmitterHelpers.UnwrapNullable(context.RootType)))\n\t\t\t\treturn;\n\n\t\t\tvar refUri = context.GetRefUri(unwrapped);\n\t\t\tif (string.IsNullOrEmpty(refUri))\n\t\t\t{\n\t\t\t\tsb.AppendLine();\n\t\t\t\tif (isNullable)\n\t\t\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Object, SchemaValueType.Null)\");\n\t\t\t\telse\n\t\t\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Object)\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsb.AppendLine();\n\t\t\t\n\t\t\tif (isNullable)\n\t\t\t{\n\t\t\t\tsb.Append($\"{indent}.AnyOf(\");\n\t\t\t\tsb.AppendLine();\n\t\t\t\tsb.Append($\"{indent}\\tnew JsonSchemaBuilder().Ref(\\\"{refUri}\\\"),\");\n\t\t\t\tsb.AppendLine();\n\t\t\t\tsb.Append($\"{indent}\\tnew JsonSchemaBuilder().Type(SchemaValueType.Null)\");\n\t\t\t\tsb.AppendLine();\n\t\t\t\tsb.Append($\"{indent})\");\n\t\t\t}\n\t\t\telse\n\t\t\t\tsb.Append($\"{indent}.Ref(\\\"{refUri}\\\")\");\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeKind == TypeKind.Array)\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tif (isNullable)\n\t\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Array, SchemaValueType.Null)\");\n\t\t\telse\n\t\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Array)\");\n\n\t\t\tvar elementType = CodeEmitterHelpers.GetElementType(unwrapped);\n\t\t\tif (elementType != null)\n\t\t\t{\n\t\t\t\tsb.AppendLine();\n\t\t\t\tsb.Append($\"{indent}.Items(\");\n\t\t\t\tsb.Append(\"new JsonSchemaBuilder()\");\n\n\t\t\t\tEmitSchemaForType(sb, elementType, false, indent + \"\\t\", context);\n\n\t\t\t\tif (itemAttributes is { Count: > 0 })\n\t\t\t\t\tEmitAttributes(sb, itemAttributes, indent + \"\\t\");\n\n\t\t\t\tsb.Append(\")\");\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeKind == TypeKind.Enum && context != null)\n\t\t{\n\t\t\tif (context.RootType != null && SymbolEqualityComparer.Default.Equals(unwrapped, CodeEmitterHelpers.UnwrapNullable(context.RootType)))\n\t\t\t\treturn;\n\n\t\t\tvar refUri = context.GetRefUri(unwrapped);\n\t\t\tif (!string.IsNullOrEmpty(refUri))\n\t\t\t{\n\t\t\t\tsb.AppendLine();\n\n\t\t\t\tif (isNullable)\n\t\t\t\t{\n\t\t\t\t\tsb.Append($\"{indent}.AnyOf(\");\n\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\tsb.Append($\"{indent}\\tnew JsonSchemaBuilder().Ref(\\\"{refUri}\\\"),\");\n\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\tsb.Append($\"{indent}\\tnew JsonSchemaBuilder().Type(SchemaValueType.Null)\");\n\t\t\t\t\tsb.AppendLine();\n\t\t\t\t\tsb.Append($\"{indent})\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tsb.Append($\"{indent}.Ref(\\\"{refUri}\\\")\");\n\n\t\t\t\treturn;", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing Json.Schema.Generation.SourceGeneration.Emitters;\nusing Json.Schema.Generation.Serialization;\nusing Microsoft.CodeAnalysis;\n\nnam" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs (2/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs", + "startLine": 121, + "endLine": 240, + "content": "}\n\t\t}\n\t\t\n\t\tif (typeSymbol is INamedTypeSymbol namedTypeSymbol)\n\t\t{\n\t\t\tvar typeInfo = new TypeInfo\n\t\t\t{\n\t\t\t\tTypeSymbol = namedTypeSymbol,\n\t\t\t\tFullyQualifiedName = typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat),\n\t\t\t\tSchemaPropertyName = \"\",\n\t\t\t\tPropertyNaming = NamingConvention.AsDeclared,\n\t\t\t\tPropertyOrder = PropertyOrder.AsDeclared,\n\t\t\t\tStrictConditionals = false,\n\t\t\t\tKind = typeKind,\n\t\t\t\tIsNullable = isNullable,\n\t\t\t\tItemAttributes = itemAttributes,\n\t\t\t\tPropertyAttributes = propertyAttributes\n\t\t\t};\n\n\t\t\tif (typeKind == TypeKind.Enum)\n\t\t\t{\n\t\t\t\tforeach (var member in namedTypeSymbol.GetMembers())\n\t\t\t\t{\n\t\t\t\t\tif (member is IFieldSymbol { IsConst: true, HasConstantValue: true } field)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (CodeEmitterHelpers.ShouldIncludeEnumMember(field))\n\t\t\t\t\t\t\ttypeInfo.EnumValues.Add(field.Name);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar emitter = SchemaEmitterRegistry.Emitters.FirstOrDefault(e => e.Handles(typeInfo));\n\t\t\tif (emitter != null)\n\t\t\t\temitter.EmitSchema(sb, typeInfo, indent, context ?? new SchemaEmissionContext());\n\t\t\telse\n\t\t\t{\n\t\t\t\tsb.AppendLine();\n\t\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Object)\");\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}.Type(SchemaValueType.Object)\");\n\t\t}\n\t}\n\n\tinternal static TypeKind DetermineTypeKind(ITypeSymbol typeSymbol)\n\t{\n\t\tvar unwrappedType = CodeEmitterHelpers.UnwrapNullable(typeSymbol);\n\t\t\n\t\tswitch (unwrappedType.SpecialType)\n\t\t{\n\t\t\tcase SpecialType.System_Boolean:\n\t\t\t\treturn TypeKind.Boolean;\n\t\t\tcase SpecialType.System_Byte:\n\t\t\tcase SpecialType.System_SByte:\n\t\t\tcase SpecialType.System_Int16:\n\t\t\tcase SpecialType.System_UInt16:\n\t\t\tcase SpecialType.System_Int32:\n\t\t\tcase SpecialType.System_UInt32:\n\t\t\tcase SpecialType.System_Int64:\n\t\t\tcase SpecialType.System_UInt64:\n\t\t\t\treturn TypeKind.Integer;\n\t\t\tcase SpecialType.System_Single:\n\t\t\tcase SpecialType.System_Double:\n\t\t\tcase SpecialType.System_Decimal:\n\t\t\t\treturn TypeKind.Number;\n\t\t\tcase SpecialType.System_String:\n\t\t\t\treturn TypeKind.String;\n\t\t}\n\t\t\n\t\tvar typeString = unwrappedType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n\t\t\n\t\tswitch (typeString)\n\t\t{\n\t\t\tcase \"global::System.Text.Json.JsonDocument\" or \"global::System.Text.Json.JsonElement\" or \"global::System.Text.Json.Nodes.JsonNode\" or \"global::System.Text.Json.Nodes.JsonValue\":\n\t\t\t\treturn TypeKind.Any;\n\t\t\tcase \"global::System.Text.Json.Nodes.JsonObject\":\n\t\t\t\treturn TypeKind.Object;\n\t\t\tcase \"global::System.Text.Json.Nodes.JsonArray\":\n\t\t\t\treturn TypeKind.Array;\n\t\t\tcase \"global::System.DateTime\" or \"global::System.DateTimeOffset\":\n\t\t\t\treturn TypeKind.DateTime;\n\t\t\tcase \"global::System.Guid\":\n\t\t\t\treturn TypeKind.Guid;\n\t\t\tcase \"global::System.Uri\":\n\t\t\t\treturn TypeKind.Uri;\n\t\t}\n\n\t\tif (unwrappedType.TypeKind == Microsoft.CodeAnalysis.TypeKind.Enum) return TypeKind.Enum;\n\t\tif (unwrappedType is IArrayTypeSymbol || CodeEmitterHelpers.IsCollectionType(unwrappedType)) return TypeKind.Array;\n\t\tif (CodeEmitterHelpers.IsDictionaryType(unwrappedType)) return TypeKind.Dictionary;\n\n\t\treturn TypeKind.Object;\n\t}\n\n\tpublic static string EmitGeneratedClass(List types, string namespaceName, ClassDeclarationInfo classDeclaration, List schemaHandlers, IReadOnlyList<(string TypeName, string SchemaId)> foreignTypeEntries)\n\t{\n\t\tvar sb = new StringBuilder();\n\n\t\tsb.AppendLine(\"// \");\n\t\tsb.AppendLine(\"#nullable enable\");\n\t\tsb.AppendLine();\n\t\tsb.AppendLine(\"using System;\");\n\t\tsb.AppendLine(\"using System.Diagnostics.CodeAnalysis;\");\n\t\tsb.AppendLine(\"using System.Runtime.CompilerServices;\");\n\t\tsb.AppendLine(\"using System.Text.Json.Serialization;\");\n\t\tsb.AppendLine(\"using Json.Schema;\");\n\t\tsb.AppendLine(\"using Json.Schema.Serialization;\");\n\t\tsb.AppendLine();\n\n\t\tif (!string.IsNullOrEmpty(namespaceName))\n\t\t{\n\t\t\tsb.AppendLine($\"namespace {namespaceName};\");\n\t\t\tsb.AppendLine();\n\t\t}\n\n\t\tvar customAttributes = new Dictionary();\n\t\tforeach (var type in types)", + "snippet": "}\n\t\t}\n\t\t\n\t\tif (typeSymbol is INamedTypeSymbol namedTypeSymbol)\n\t\t{\n\t\t\tvar typeInfo = new TypeInfo\n\t\t\t{\n\t\t\t\tTypeSymbol = namedTypeSymbol,\n\t\t\t\tFullyQualifiedName = typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualif" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs (3/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs", + "startLine": 241, + "endLine": 360, + "content": "{\n\t\t\tCollectCustomAttributes(type.TypeAttributes, customAttributes);\n\t\t\tforeach (var prop in type.Properties)\n\t\t\t{\n\t\t\t\tCollectCustomAttributes(prop.Attributes, customAttributes);\n\t\t\t}\n\t\t}\n\n\t\tEmitExtensionMethods(sb, customAttributes);\n\t\tsb.AppendLine();\n\n\t\tsb.AppendLine(\"/// \");\n\t\tsb.AppendLine(\"/// Contains generated JSON schemas for types decorated with [GenerateJsonSchema].\");\n\t\tsb.AppendLine(\"/// \");\n\t\tsb.AppendLine(classDeclaration.GetDeclarationString());\n\t\tsb.AppendLine(\"{\");\n\n\t\tvar orderedTypes = OrderTypesTopologically(types);\n\n\t\tvar typeIds = new Dictionary();\n\t\tforeach (var type in orderedTypes)\n\t\t{\n\t\t\tvar typeKey = SchemaEmissionContext.GetTypeKey(type.TypeSymbol);\n\t\t\ttypeIds[typeKey] = GetSchemaId(type);\n\t\t}\n\n\t\tforeach (var (typeName, schemaId) in foreignTypeEntries)\n\t\t\ttypeIds[typeName] = schemaId;\n\n\t\tvar shapeAliases = GetShapeAliases(orderedTypes);\n\t\tvar aliasTypes = new HashSet(shapeAliases.Select(a => a.TypeName), StringComparer.Ordinal);\n\n\t\tforeach (var type in orderedTypes)\n\t\t{\n\t\t\tif (!aliasTypes.Contains(type.FullyQualifiedName))\n\t\t\t\tEmitSchemaProperty(sb, type, typeIds, schemaHandlers);\n\t\t}\n\n\t\tEmitBuildForTypeMethod(sb, orderedTypes, schemaHandlers, foreignTypeEntries, shapeAliases);\n\n\t\tEmitRegisterSchemasMethod(sb, orderedTypes, aliasTypes);\n\n\t\tsb.AppendLine(\"}\");\n\t\tsb.AppendLine();\n\t\t\n\t\tEmitRegistrationClass(sb, orderedTypes, aliasTypes);\n\n\t\treturn sb.ToString();\n\t}\n\n\tprivate static string GetSchemaId(TypeInfo type)\n\t{\n\t\tvar idAttr = type.TypeAttributes.FirstOrDefault(a => a.AttributeName == \"IdAttribute\");\n\t\tif (idAttr != null && idAttr.Parameters.TryGetValue(\"arg0\", out var idValue) && idValue is string idStr)\n\t\t\treturn idStr;\n\n\t\treturn ToUrn(type.FullyQualifiedName);\n\t}\n\n\tinternal static string ToUrn(string typeName)\n\t{\n\t\t// Remove global:: prefix if present\n\t\tif (typeName.StartsWith(\"global::\"))\n\t\t\ttypeName = typeName.Substring(8);\n\n\t\t// Canonical collection shapes share IDs.\n\t\tif (typeName.StartsWith(\"System.Collections.Generic.IEnumerable<\") ||\n\t\t\ttypeName.StartsWith(\"System.Collections.Generic.IReadOnlyCollection<\") ||\n\t\t\ttypeName.StartsWith(\"System.Collections.Generic.ICollection<\") ||\n\t\t\ttypeName.StartsWith(\"System.Collections.Generic.HashSet<\") ||\n\t\t\ttypeName.StartsWith(\"System.Collections.Generic.Queue<\") ||\n\t\t\ttypeName.StartsWith(\"System.Collections.Generic.Stack<\") ||\n\t\t\ttypeName.EndsWith(\"[]\"))\n\t\t{\n\t\t\tstring elementType;\n\t\t\tif (typeName.EndsWith(\"[]\"))\n\t\t\t{\n\t\t\t\telementType = typeName.Substring(0, typeName.Length - 2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar start = typeName.IndexOf('<') + 1;\n\t\t\t\tvar len = typeName.LastIndexOf('>') - start;\n\t\t\t\telementType = typeName.Substring(start, len);\n\t\t\t}\n\n\t\t\tvar elementUrn = ToUrn(elementType).Replace(\"urn:jsonschema:\", \"\");\n\t\t\treturn $\"urn:jsonschema:array-{elementUrn}\";\n\t\t}\n\n\t\t// Canonical dictionary shapes share IDs.\n\t\tif (typeName.StartsWith(\"System.Collections.Generic.Dictionary<\") ||\n\t\t\ttypeName.StartsWith(\"System.Collections.Generic.IDictionary<\") ||\n\t\t\ttypeName.StartsWith(\"System.Collections.Generic.IReadOnlyDictionary<\"))\n\t\t{\n\t\t\tvar start = typeName.IndexOf('<') + 1;\n\t\t\tvar len = typeName.LastIndexOf('>') - start;\n\t\t\tvar args = typeName.Substring(start, len).Split(',');\n\t\t\tvar keyUrn = ToUrn(args[0].Trim()).Replace(\"urn:jsonschema:\", \"\");\n\t\t\tvar valueUrn = ToUrn(args[1].Trim()).Replace(\"urn:jsonschema:\", \"\");\n\t\t\treturn $\"urn:jsonschema:object-{keyUrn}-{valueUrn}\";\n\t\t}\n\n\t\t// Fallback: replace problematic chars for URN\n\t\tvar sb = new StringBuilder(\"urn:jsonschema:\");\n\t\tforeach (var ch in typeName)\n\t\t{\n\t\t\tif (char.IsLetterOrDigit(ch)) sb.Append(ch);\n\t\t\telse if (ch == '.') sb.Append('.');\n\t\t\telse if (ch == '<') sb.Append('-');\n\t\t\telse if (ch == '>') continue;\n\t\t\telse if (ch == ',') sb.Append('-');\n\t\t\telse if (ch == '`') sb.Append('G');\n\t\t\telse if (ch == '[') sb.Append(\"-Arr\");\n\t\t\telse if (ch == ']') continue;\n\t\t\telse if (ch == ' ') continue;\n\t\t\telse if (ch == ':') sb.Append(':');\n\t\t\telse sb.Append('-');\n\t\t}\n\t\treturn sb.ToString();", + "snippet": "{\n\t\t\tCollectCustomAttributes(type.TypeAttributes, customAttributes);\n\t\t\tforeach (var prop in type.Properties)\n\t\t\t{\n\t\t\t\tCollectCustomAttributes(prop.Attributes, customAttributes);\n\t\t\t}\n\t\t}\n\n\t\tEmitExtensionMethods(sb, cust" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs (4/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs", + "startLine": 361, + "endLine": 480, + "content": "}\n\n\tprivate static void EmitBuildForTypeMethod(StringBuilder sb, List types, List schemaHandlers, IReadOnlyList<(string TypeName, string SchemaId)> foreignTypeEntries, IReadOnlyList<(string TypeName, string SchemaId)> shapeAliases)\n\t{\n\t\tsb.AppendLine(\"\\tpublic static JsonSchemaBuilder BuildForType(this JsonSchemaBuilder builder, Type type)\");\n\t\tsb.AppendLine(\"\\t{\");\n\t\tsb.AppendLine(\"\\t\\tvar isNullable = Nullable.GetUnderlyingType(type) != null;\");\n\t\tsb.AppendLine(\"\\t\\tvar unwrapped = Nullable.GetUnderlyingType(type) ?? type;\");\n\n\t\tforeach (var handler in schemaHandlers)\n\t\t{\n\t\t\tif (handler.IsOpenGenericTarget)\n\t\t\t{\n\t\t\t\tsb.AppendLine($\"\\t\\tif (unwrapped.IsGenericType && unwrapped.GetGenericTypeDefinition() == typeof({handler.TargetTypeName}))\");\n\t\t\t\tsb.AppendLine(\"\\t\\t{\");\n\t\t\t\tif (handler.ReturnsBuilder)\n\t\t\t\t\tsb.AppendLine($\"\\t\\t\\treturn {handler.HandlerTypeName}.Apply(builder, unwrapped);\");\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsb.AppendLine($\"\\t\\t\\t{handler.HandlerTypeName}.Apply(builder, unwrapped);\");\n\t\t\t\t\tsb.AppendLine(\"\\t\\t\\treturn builder;\");\n\t\t\t\t}\n\t\t\t\tsb.AppendLine(\"\\t\\t}\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsb.AppendLine($\"\\t\\tif (unwrapped == typeof({handler.TargetTypeName}))\");\n\t\t\t\tsb.AppendLine(\"\\t\\t{\");\n\t\t\t\tif (handler.ReturnsBuilder)\n\t\t\t\t\tsb.AppendLine($\"\\t\\t\\treturn {handler.HandlerTypeName}.Apply(builder, unwrapped);\");\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsb.AppendLine($\"\\t\\t\\t{handler.HandlerTypeName}.Apply(builder, unwrapped);\");\n\t\t\t\t\tsb.AppendLine(\"\\t\\t\\treturn builder;\");\n\t\t\t\t}\n\t\t\t\tsb.AppendLine(\"\\t\\t}\");\n\t\t\t}\n\t\t}\n\n\t\tsb.AppendLine(\"\\t\\treturn unwrapped switch\");\n\t\tsb.AppendLine(\"\\t\\t{\");\n\n\t\tvar aliasTypeNames = new HashSet(\n\t\t\tshapeAliases.Select(a => a.TypeName),\n\t\t\tStringComparer.Ordinal);\n\n\t\tforeach (var (typeName, schemaId) in shapeAliases)\n\t\t\tsb.AppendLine($\"\\t\\t\\tvar t when t == typeof({typeName}) => builder.Ref(\\\"{schemaId}\\\"),\");\n\n\t\tforeach (var type in types)\n\t\t{\n\t\t\tif (aliasTypeNames.Contains(type.FullyQualifiedName)) continue;\n\n\t\t\tvar typeName = type.FullyQualifiedName;\n\t\t\tvar schemaId = GetSchemaId(type);\n\t\t\tsb.AppendLine($\"\\t\\t\\tvar t when t == typeof({typeName}) => builder.Ref(\\\"{schemaId}\\\"),\");\n\t\t}\n\n\t\tforeach (var (typeName, schemaId) in foreignTypeEntries)\n\t\t\tsb.AppendLine($\"\\t\\t\\tvar t when t == typeof({typeName}) => builder.Ref(\\\"{schemaId}\\\"),\");\n\n\t\tsb.AppendLine(\"\\t\\t\\tvar t when t == typeof(bool) => isNullable ? builder.Type(SchemaValueType.Boolean, SchemaValueType.Null) : builder.Type(SchemaValueType.Boolean),\");\n\t\tsb.AppendLine(\"\\t\\t\\tvar t when t == typeof(byte) || t == typeof(sbyte) || t == typeof(short) || t == typeof(ushort) || t == typeof(int) || t == typeof(uint) || t == typeof(long) || t == typeof(ulong) => isNullable ? builder.Type(SchemaValueType.Integer, SchemaValueType.Null) : builder.Type(SchemaValueType.Integer),\");\n\t\tsb.AppendLine(\"\\t\\t\\tvar t when t == typeof(float) || t == typeof(double) || t == typeof(decimal) => isNullable ? builder.Type(SchemaValueType.Number, SchemaValueType.Null) : builder.Type(SchemaValueType.Number),\");\n\t\tsb.AppendLine(\"\\t\\t\\tvar t when t == typeof(string) => builder.Type(SchemaValueType.String),\");\n\t\tsb.AppendLine(\"\\t\\t\\tvar t when t == typeof(DateTime) || t == typeof(DateTimeOffset) => isNullable ? builder.Type(SchemaValueType.String, SchemaValueType.Null).Format(global::Json.Schema.Formats.DateTime) : builder.Type(SchemaValueType.String).Format(global::Json.Schema.Formats.DateTime),\");\n\t\tsb.AppendLine(\"\\t\\t\\tvar t when t == typeof(Guid) => isNullable ? builder.Type(SchemaValueType.String, SchemaValueType.Null).Format(global::Json.Schema.Formats.Uuid) : builder.Type(SchemaValueType.String).Format(global::Json.Schema.Formats.Uuid),\");\n\t\tsb.AppendLine(\"\\t\\t\\tvar t when t == typeof(Uri) => isNullable ? builder.Type(SchemaValueType.String, SchemaValueType.Null).Format(global::Json.Schema.Formats.Uri) : builder.Type(SchemaValueType.String).Format(global::Json.Schema.Formats.Uri),\");\n\t\tsb.AppendLine(\"\\t\\t\\tvar t when t == typeof(System.Text.Json.JsonDocument) || t == typeof(System.Text.Json.JsonElement) || t == typeof(System.Text.Json.Nodes.JsonNode) || t == typeof(System.Text.Json.Nodes.JsonValue) => builder,\");\n\t\tsb.AppendLine(\"\\t\\t\\tvar t when t == typeof(System.Text.Json.Nodes.JsonObject) => isNullable ? builder.Type(SchemaValueType.Object, SchemaValueType.Null) : builder.Type(SchemaValueType.Object),\");\n\t\tsb.AppendLine(\"\\t\\t\\tvar t when t == typeof(System.Text.Json.Nodes.JsonArray) => isNullable ? builder.Type(SchemaValueType.Array, SchemaValueType.Null) : builder.Type(SchemaValueType.Array),\");\n\t\tsb.AppendLine(\"\\t\\t\\t_ => builder\");\n\t\tsb.AppendLine(\"\\t\\t};\");\n\t\tsb.AppendLine(\"\\t}\");\n\t\tsb.AppendLine();\n\t}\n\n\tprivate static List<(string TypeName, string SchemaId)> GetShapeAliases(List types)\n\t{\n\t\tvar result = new List<(string TypeName, string SchemaId)>();\n\n\t\tvar arrayGroups = types\n\t\t\t.Where(t => t.Kind == TypeKind.Array)\n\t\t\t.Where(t => !string.IsNullOrEmpty(GetArrayShapeKey(t.TypeSymbol)))\n\t\t\t.GroupBy(t => GetArrayShapeKey(t.TypeSymbol));\n\n\t\tforeach (var group in arrayGroups)\n\t\t{\n\t\t\tvar groupTypes = group.ToList();\n\t\t\tif (groupTypes.Count <= 1) continue;\n\n\t\t\tvar canonical = groupTypes\n\t\t\t\t.FirstOrDefault(t => IsPreferredCollectionShape(t.TypeSymbol))\n\t\t\t\t?? groupTypes.OrderBy(t => t.FullyQualifiedName, StringComparer.Ordinal).First();\n\n\t\t\tvar canonicalId = GetSchemaId(canonical);\n\t\t\tforeach (var type in groupTypes)\n\t\t\t{\n\t\t\t\tif (ReferenceEquals(type, canonical)) continue;\n\t\t\t\tresult.Add((type.FullyQualifiedName, canonicalId));\n\t\t\t}\n\t\t}\n\n\t\tvar dictionaryGroups = types\n\t\t\t.Where(t => t.Kind == TypeKind.Dictionary)\n\t\t\t.Where(t => !string.IsNullOrEmpty(GetDictionaryShapeKey(t.TypeSymbol)))\n\t\t\t.GroupBy(t => GetDictionaryShapeKey(t.TypeSymbol));\n\n\t\tforeach (var group in dictionaryGroups)\n\t\t{\n\t\t\tvar groupTypes = group.ToList();\n\t\t\tif (groupTypes.Count <= 1) continue;\n\n\t\t\tvar canonical = groupTypes\n\t\t\t\t.FirstOrDefault(t => IsPreferredDictionaryShape(t.TypeSymbol))\n\t\t\t\t?? groupTypes.OrderBy(t => t.FullyQualifiedName, StringComparer.Ordinal).First();\n\n\t\t\tvar canonicalId = GetSchemaId(canonical);\n\t\t\tforeach (var type in groupTypes)\n\t\t\t{", + "snippet": "}\n\n\tprivate static void EmitBuildForTypeMethod(StringBuilder sb, List types, List schemaHandlers, IReadOnlyList<(string TypeName, string SchemaId)> foreignTypeEntries, IReadOnlyList<(string T" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs (5/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs", + "startLine": 481, + "endLine": 600, + "content": "if (ReferenceEquals(type, canonical)) continue;\n\t\t\t\tresult.Add((type.FullyQualifiedName, canonicalId));\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprivate static string GetArrayShapeKey(ITypeSymbol typeSymbol)\n\t{\n\t\tvar elementType = CodeEmitterHelpers.GetElementType(typeSymbol);\n\t\tif (elementType == null) return string.Empty;\n\n\t\tvar unwrappedElement = CodeEmitterHelpers.UnwrapNullable(elementType);\n\t\treturn unwrappedElement.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n\t}\n\n\tprivate static string GetDictionaryShapeKey(ITypeSymbol typeSymbol)\n\t{\n\t\tvar keyType = CodeEmitterHelpers.GetDictionaryKeyType(typeSymbol);\n\t\tvar valueType = CodeEmitterHelpers.GetDictionaryValueType(typeSymbol);\n\t\tif (keyType == null || valueType == null) return string.Empty;\n\n\t\tvar unwrappedKey = CodeEmitterHelpers.UnwrapNullable(keyType).ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n\t\tvar unwrappedValue = CodeEmitterHelpers.UnwrapNullable(valueType).ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n\n\t\treturn $\"{unwrappedKey}|{unwrappedValue}\";\n\t}\n\n\tprivate static bool IsPreferredCollectionShape(ITypeSymbol typeSymbol)\n\t{\n\t\tif (typeSymbol is not INamedTypeSymbol namedType || !namedType.IsGenericType) return false;\n\n\t\tvar typeString = namedType.ConstructedFrom.ToDisplayString();\n\t\treturn typeString == \"System.Collections.Generic.IEnumerable\";\n\t}\n\n\tprivate static bool IsPreferredDictionaryShape(ITypeSymbol typeSymbol)\n\t{\n\t\tif (typeSymbol is not INamedTypeSymbol namedType || !namedType.IsGenericType) return false;\n\n\t\tvar typeString = namedType.ConstructedFrom\n\t\t\t.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)\n\t\t\t.Replace(\" \", string.Empty);\n\n\t\treturn typeString == \"global::System.Collections.Generic.IDictionary\";\n\t}\n\n\tprivate static void EmitRegisterSchemasMethod(StringBuilder sb, List types, HashSet aliasTypes)\n\t{\n\t\tsb.AppendLine();\n\t\tsb.AppendLine(\"\\t/// \");\n\t\tsb.AppendLine(\"\\t/// Registers all generated schemas in the specified schema registry.\");\n\t\tsb.AppendLine(\"\\t/// \");\n\t\tsb.AppendLine(\"\\tpublic static void RegisterSchemas(Json.Schema.SchemaRegistry registry)\");\n\t\tsb.AppendLine(\"\\t{\");\n\n\t\tvar registeredSchemaIds = new HashSet(StringComparer.Ordinal);\n\n\t\tforeach (var type in types)\n\t\t{\n\t\t\t// Skip non-canonical shapes — they share a schema with the canonical type\n\t\t\tif (aliasTypes.Contains(type.FullyQualifiedName)) continue;\n\n\t\t\tvar schemaId = GetSchemaId(type);\n\t\t\tif (!registeredSchemaIds.Add(schemaId)) continue;\n\n\t\t\tsb.AppendLine($\"\\t\\tregistry.Register({GetPropertyName(type)});\");\n\t\t}\n\n\t\tsb.AppendLine(\"\\t}\");\n\t}\n\n\tprivate static List OrderTypesTopologically(List types)\n\t{\n\t\tvar graph = new Dictionary>();\n\t\tvar inDegree = new Dictionary();\n\n\t\tforeach (var type in types)\n\t\t{\n\t\t\tgraph[type] = new List();\n\t\t\tinDegree[type] = 0;\n\t\t}\n\n\t\tforeach (var type in types)\n\t\t{\n\t\t\tforeach (var prop in type.Properties)\n\t\t\t{\n\t\t\t\tvar depType = FindTypeBySymbol(types, prop.Type);\n\t\t\t\tif (depType != null && depType != type)\n\t\t\t\t{\n\t\t\t\t\tgraph[type].Add(depType);\n\t\t\t\t\tinDegree[depType]++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar queue = new Queue();\n\t\tforeach (var type in types)\n\t\t{\n\t\t\tif (inDegree[type] == 0)\n\t\t\t\tqueue.Enqueue(type);\n\t\t}\n\n\t\tvar result = new List();\n\t\twhile (queue.Count > 0)\n\t\t{\n\t\t\tvar current = queue.Dequeue();\n\t\t\tresult.Add(current);\n\n\t\t\tforeach (var dep in graph[current])\n\t\t\t{\n\t\t\t\tinDegree[dep]--;\n\t\t\t\tif (inDegree[dep] == 0)\n\t\t\t\t\tqueue.Enqueue(dep);\n\t\t\t}\n\t\t}\n\n\t\t// If there are cycles, just return the original order\n\t\tif (result.Count != types.Count)", + "snippet": "if (ReferenceEquals(type, canonical)) continue;\n\t\t\t\tresult.Add((type.FullyQualifiedName, canonicalId));\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprivate static string GetArrayShapeKey(ITypeSymbol typeSymbol)\n\t{\n\t\tvar elementType " + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs (6/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs", + "startLine": 601, + "endLine": 720, + "content": "return types;\n\n\t\treturn result;\n\t}\n\n\tprivate static TypeInfo? FindTypeBySymbol(List types, ITypeSymbol symbol)\n\t{\n\t\tvar unwrapped = CodeEmitterHelpers.UnwrapNullable(symbol);\n\n\t\treturn types.FirstOrDefault(t => SymbolEqualityComparer.Default.Equals(t.TypeSymbol, unwrapped));\n\t}\n\n\tprivate static string GetPropertyName(TypeInfo type) => type.ResolvedPropertyName ?? type.SchemaPropertyName;\n\n\tprivate static void EmitSchemaProperty(StringBuilder sb, TypeInfo type, Dictionary typeIds, List schemaHandlers)\n\t{\n\t\tif (!string.IsNullOrWhiteSpace(type.XmlDocSummary))\n\t\t{\n\t\t\tsb.AppendLine(\"\\t/// \");\n\t\t\tsb.AppendLine($\"\\t/// {CodeEmitterHelpers.EscapeXmlDoc(type.XmlDocSummary!)}\");\n\t\t\tsb.AppendLine(\"\\t/// \");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsb.AppendLine(\"\\t/// \");\n\t\t\tsb.AppendLine($\"\\t/// Generated schema for {CodeEmitterHelpers.EscapeXmlDoc(type.FullyQualifiedName)}.\");\n\t\t\tsb.AppendLine(\"\\t/// \");\n\t\t}\n\n\t\tsb.Append($\"\\tpublic static readonly JsonSchema {GetPropertyName(type)} = \");\n\t\tEmitSchemaBuilder(sb, type, 2, typeIds, schemaHandlers);\n\t\tsb.AppendLine(\".Build();\");\n\t\tsb.AppendLine();\n\t}\n\n\tprivate static void EmitSchemaBuilder(StringBuilder sb, TypeInfo type, int indent, Dictionary typeIds, List schemaHandlers)\n\t{\n\t\tvar indentStr = new string('\\t', indent);\n\t\t\n\t\tvar context = new SchemaEmissionContext(typeIds, schemaHandlers);\n\t\tAnalyzeTypeReferences(type, context);\n\t\tcontext.RootType = type.TypeSymbol;\n\t\t\n\t\tsb.Append(\"new JsonSchemaBuilder()\");\n\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indentStr}.Schema(\\\"https://json-schema.org/draft/2020-12/schema\\\")\");\n\n\t\tvar idAttr = type.TypeAttributes.FirstOrDefault(a => a.AttributeName == \"IdAttribute\");\n\t\tstring id;\n\t\tif (idAttr != null && idAttr.Parameters.TryGetValue(\"arg0\", out var idValue) && idValue is string idStr)\n\t\t{\n\t\t\tid = idStr;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tid = ToUrn(type.FullyQualifiedName);\n\t\t}\n\t\tsb.AppendLine();\n\t\tsb.Append($\"{indentStr}.Id(\\\"{id}\\\")\");\n\n\t\tif (context.HasSchemaHandler(type.TypeSymbol))\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indentStr}.BuildForType(typeof({type.TypeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}))\");\n\t\t\tEmitAttributes(sb, type.TypeAttributes, indentStr);\n\t\t\treturn;\n\t\t}\n\n\t\tvar emitter = SchemaEmitterRegistry.Emitters.FirstOrDefault(e => e.Handles(type));\n\t\tif (emitter != null)\n\t\t{\n\t\t\temitter.EmitSchema(sb, type, indentStr, context);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indentStr}.Type(SchemaValueType.Object)\");\n\t\t}\n\n\t\tEmitAttributes(sb, type.TypeAttributes, indentStr);\n\t}\n\n\tinternal static void EmitAttributes(StringBuilder sb, List attributes, string indent)\n\t{\n\t\tforeach (var attr in attributes)\n\t\t{\n\t\t\tif (attr.Parameters.TryGetValue(\"ConditionGroup\", out var conditionGroup) && conditionGroup != null) continue;\n\n\t\t\t// Skip IdAttribute as it's handled separately in EmitSchemaBuilder\n\t\t\tif (attr.AttributeName == \"IdAttribute\") continue;\n\n\t\t\tif (attr.IsCustomEmitter && attr.AttributeFullName != null)\n\t\t\t{\n\t\t\t\tsb.AppendLine();\n\t\t\t\tsb.Append($\"{indent}\");\n\t\t\t\tEmitCustomAttributeCall(sb, attr);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!ShouldEmitBuiltInAttribute(attr)) continue;\n\n\t\t\tsb.AppendLine();\n\t\t\tsb.Append($\"{indent}\");\n\t\t\tEmitAttributeConstraint(sb, attr);\n\t\t}\n\t}\n\n\tinternal static bool IsBuiltInAttributeNamespace(string? attributeFullName)\n\t{\n\t\tvar isJsonSchemaGenerationAttr = attributeFullName?.StartsWith(\"global::Json.Schema.Generation.\") == true;\n\t\tvar isSpecialSystemAttr = attributeFullName == \"global::System.ObsoleteAttribute\" ||\n\t\t attributeFullName == \"global::System.Text.Json.Serialization.JsonNumberHandlingAttribute\";\n\t\treturn isJsonSchemaGenerationAttr || isSpecialSystemAttr;\n\t}\n\n\tinternal static bool ShouldEmitBuiltInAttribute(AttributeInfo attr)\n\t{\n\t\treturn IsBuiltInAttributeNamespace(attr.AttributeFullName);\n\t}", + "snippet": "return types;\n\n\t\treturn result;\n\t}\n\n\tprivate static TypeInfo? FindTypeBySymbol(List types, ITypeSymbol symbol)\n\t{\n\t\tvar unwrapped = CodeEmitterHelpers.UnwrapNullable(symbol);\n\n\t\treturn types.FirstOrDefault(t =>" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs (7/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs#L721-L840", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs", + "startLine": 721, + "endLine": 840, + "content": "internal static void EmitAttributeConstraint(StringBuilder sb, AttributeInfo attr)\n\t{\n\t\tswitch (attr.AttributeName)\n\t\t{\n\t\t\tcase \"MinimumAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var minValue):\n\t\t\t\tsb.Append($\".Minimum({CodeEmitterHelpers.FormatValue(minValue)})\");\n\t\t\t\tbreak;\n\t\t\tcase \"MaximumAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var maxValue):\n\t\t\t\tsb.Append($\".Maximum({CodeEmitterHelpers.FormatValue(maxValue)})\");\n\t\t\t\tbreak;\n\t\t\tcase \"ExclusiveMinimumAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var exMinValue):\n\t\t\t\tsb.Append($\".ExclusiveMinimum({CodeEmitterHelpers.FormatValue(exMinValue)})\");\n\t\t\t\tbreak;\n\t\t\tcase \"ExclusiveMaximumAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var exMaxValue):\n\t\t\t\tsb.Append($\".ExclusiveMaximum({CodeEmitterHelpers.FormatValue(exMaxValue)})\");\n\t\t\t\tbreak;\n\t\t\tcase \"MinLengthAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var minLen):\n\t\t\t\tsb.Append($\".MinLength({CodeEmitterHelpers.FormatValue(minLen)})\");\n\t\t\t\tbreak;\n\t\t\tcase \"MaxLengthAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var maxLen):\n\t\t\t\tsb.Append($\".MaxLength({CodeEmitterHelpers.FormatValue(maxLen)})\");\n\t\t\t\tbreak;\n\t\t\tcase \"PatternAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var pattern):\n\t\t\t\tsb.Append($\".Pattern(\\\"{CodeEmitterHelpers.EscapeString(pattern?.ToString() ?? \"\")}\\\")\");\n\t\t\t\tbreak;\n\t\t\tcase \"MinItemsAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var minItems):\n\t\t\t\tsb.Append($\".MinItems({CodeEmitterHelpers.FormatValue(minItems)})\");\n\t\t\t\tbreak;\n\t\t\tcase \"MaxItemsAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var maxItems):\n\t\t\t\tsb.Append($\".MaxItems({CodeEmitterHelpers.FormatValue(maxItems)})\");\n\t\t\t\tbreak;\n\t\t\tcase \"UniqueItemsAttribute\":\n\t\t\t\tsb.Append($\".UniqueItems(true)\");\n\t\t\t\tbreak;\n\t\t\tcase \"MultipleOfAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var multipleOf):\n\t\t\t\tsb.Append($\".MultipleOf({CodeEmitterHelpers.FormatValue(multipleOf)})\");\n\t\t\t\tbreak;\n\t\t\tcase \"TitleAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var title):\n\t\t\t\tsb.Append($\".Title(\\\"{CodeEmitterHelpers.EscapeString(title?.ToString() ?? \"\")}\\\")\");\n\t\t\t\tbreak;\n\t\t\tcase \"DescriptionAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var description):\n\t\t\t\tsb.Append($\".Description(\\\"{CodeEmitterHelpers.EscapeString(description?.ToString() ?? \"\")}\\\")\");\n\t\t\t\tbreak;\n\t\t\tcase \"ObsoleteAttribute\":\n\t\t\t\tsb.Append(\".Deprecated(true)\");\n\t\t\t\tbreak;\n\t\t\tcase \"ReadOnlyAttribute\":\n\t\t\t\tsb.Append(\".ReadOnly(true)\");\n\t\t\t\tbreak;\n\t\t\tcase \"WriteOnlyAttribute\":\n\t\t\t\tsb.Append(\".WriteOnly(true)\");\n\t\t\t\tbreak;\n\t\t\tcase \"DefaultAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var defaultValue):\n\t\t\t\tsb.Append($\".Default({CodeEmitterHelpers.FormatValue(defaultValue)})\");\n\t\t\t\tbreak;\n\t\t\tcase \"AdditionalPropertiesAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var additionalProps) && additionalProps is bool boolVal:\n\t\t\t\tsb.Append($\".AdditionalProperties({(boolVal ? \"true\" : \"false\")})\");\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tprivate static void CollectCustomAttributes(List attributes, Dictionary customAttributes)\n\t{\n\t\tforeach (var attr in attributes)\n\t\t{\n\t\t\tif (attr is { IsCustomEmitter: true, AttributeFullName: not null }) \n\t\t\t\tcustomAttributes.TryAdd(attr.AttributeFullName, attr);\n\t\t}\n\t}\n\n\tprivate static void EmitExtensionMethods(StringBuilder sb, Dictionary customAttributes)\n\t{\n\t\tsb.AppendLine(\"/// \");\n\t\tsb.AppendLine(\"/// Extension methods for custom schema attributes.\");\n\t\tsb.AppendLine(\"/// \");\n\t\tsb.AppendLine(\"public static class GeneratedSchemaExtensions\");\n\t\tsb.AppendLine(\"{\");\n\t\tforeach (var kvp in customAttributes)\n\t\t{\n\t\t\tvar attrFullName = kvp.Key;\n\t\t\tvar attrInfo = kvp.Value;\n\t\t\t\n\t\t\tvar lastDot = attrFullName.LastIndexOf('.');\n\t\t\tvar attrName = lastDot >= 0 ? attrFullName[(lastDot + 1)..] : attrFullName;\n\t\t\tif (attrName.EndsWith(\"Attribute\"))\n\t\t\t\tattrName = attrName[..^9];\n\n\t\t\tvar paramList = new StringBuilder(\"this JsonSchemaBuilder builder\");\n\t\t\tvar argList = new StringBuilder(\"builder\");\n\t\t\t\n\t\t\tif (attrInfo.ApplyMethodParameters != null)\n\t\t\t{\n\t\t\t\tforeach (var param in attrInfo.ApplyMethodParameters)\n\t\t\t\t{\n\t\t\t\t\tparamList.Append($\", {param.TypeName} {param.Name}\");\n\t\t\t\t\targList.Append($\", {param.Name}\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsb.AppendLine($\"\\tpublic static JsonSchemaBuilder {attrName}({paramList})\");\n\t\t\tsb.AppendLine(\"\\t{\");\n\t\t\tsb.AppendLine($\"\\t\\treturn {attrFullName}.Apply({argList});\");\n\t\t\tsb.AppendLine(\"\\t}\");\n\t\t\tsb.AppendLine();\n\t\t}\n\n\t\tsb.AppendLine(\"}\");\n\t}\n\n\tprivate static void EmitCustomAttributeCall(StringBuilder sb, AttributeInfo attr)\n\t{\n\t\tvar lastDot = attr.AttributeFullName!.LastIndexOf('.');\n\t\tvar attrName = lastDot >= 0 ? attr.AttributeFullName[(lastDot + 1)..] : attr.AttributeFullName;\n\t\tif (attrName.EndsWith(\"Attribute\"))\n\t\t\tattrName = attrName[..^9];\n\n\t\tsb.Append($\".{attrName}(\");\n\t\t\n\t\tvar first = true;", + "snippet": "internal static void EmitAttributeConstraint(StringBuilder sb, AttributeInfo attr)\n\t{\n\t\tswitch (attr.AttributeName)\n\t\t{\n\t\t\tcase \"MinimumAttribute\" when attr.Parameters.TryGetValue(\"arg0\", out var minValue):\n\t\t\t\tsb.Append" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs (8/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs#L841-L960", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs", + "startLine": 841, + "endLine": 960, + "content": "if (attr.ApplyMethodParameters != null && attr.ApplyMethodParameters.Count > 0)\n\t\t{\n\t\t\tforeach (var param in attr.ApplyMethodParameters)\n\t\t\t{\n\t\t\t\tif (!first)\n\t\t\t\t\tsb.Append(\", \");\n\t\t\t\t\n\t\t\t\tobject? value = null;\n\t\t\t\tvar found = false;\n\t\t\t\t\n\t\t\t\tfor (int i = 0; i < attr.Parameters.Count; i++)\n\t\t\t\t{\n\t\t\t\t\tif (attr.Parameters.TryGetValue($\"arg{i}\", out value))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (i == attr.ApplyMethodParameters.IndexOf(param))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!found)\n\t\t\t\t{\n\t\t\t\t\tforeach (var kvp in attr.Parameters)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!kvp.Key.StartsWith(\"arg\") && \n\t\t\t\t\t\t string.Equals(kvp.Key, param.Name, StringComparison.OrdinalIgnoreCase))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalue = kvp.Value;\n\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (found)\n\t\t\t\t\tsb.Append(FormatCustomApplyParameterValue(param, value));\n\t\t\t\telse\n\t\t\t\t\tsb.Append(\"0\");\n\n\t\t\t\tfirst = false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (int i = 0; i < attr.Parameters.Count; i++)\n\t\t\t{\n\t\t\t\tif (attr.Parameters.TryGetValue($\"arg{i}\", out var value))\n\t\t\t\t{\n\t\t\t\t\tif (!first)\n\t\t\t\t\t\tsb.Append(\", \");\n\n\t\t\t\t\tsb.Append(CodeEmitterHelpers.FormatValue(value));\n\t\t\t\t\tfirst = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tsb.Append(')');\n\t}\n\n\tprivate static string FormatCustomApplyParameterValue(ApplyParameterInfo parameter, object? value)\n\t{\n\t\tvar normalizedTypeName = parameter.TypeName\n\t\t\t.Replace(\"global::\", string.Empty)\n\t\t\t.Replace(\" \", string.Empty);\n\n\t\tif (normalizedTypeName is \"System.Type\" or \"Type\")\n\t\t{\n\t\t\tif (value is ITypeSymbol typeSymbol)\n\t\t\t\treturn $\"typeof({typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)})\";\n\n\t\t\treturn $\"typeof({value})\";\n\t\t}\n\n\t\treturn CodeEmitterHelpers.FormatValue(value);\n\t}\n\n\n\tprivate static void AnalyzeTypeReferences(TypeInfo type, SchemaEmissionContext context)\n\t{\n\t\tforeach (var prop in type.Properties)\n\t\t{\n\t\t\tCollectPropertyTypes(prop.Type, context);\n\t\t}\n\t}\n\n\tprivate static void CollectPropertyTypes(ITypeSymbol typeSymbol, SchemaEmissionContext context)\n\t{\n\t\tvar unwrapped = CodeEmitterHelpers.UnwrapNullable(typeSymbol);\n\t\tif (IsBuiltInJsonDomType(unwrapped)) return;\n\t\t\n\t\tvar typeKind = DetermineTypeKind(unwrapped);\n\t\tif (typeKind is TypeKind.Boolean or TypeKind.Integer or TypeKind.Number or \n\t\t TypeKind.String or TypeKind.DateTime or TypeKind.Guid or TypeKind.Uri or TypeKind.Any)\n\t\t\treturn;\n\n\t\tif (typeKind == TypeKind.Enum)\n\t\t{\n\t\t\tvar typeKey = SchemaEmissionContext.GetTypeKey(unwrapped);\n\t\t\tif (!context.TypeReferences.ContainsKey(typeKey))\n\t\t\t{\n\t\t\t\tvar defName = SchemaEmissionContext.GetDefinitionName(unwrapped);\n\t\t\t\tcontext.TypeReferences[typeKey] = (defName, unwrapped);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (typeKind == TypeKind.Array)\n\t\t{\n\t\t\tvar elementType = CodeEmitterHelpers.GetElementType(unwrapped);\n\t\t\tif (elementType != null) \n\t\t\t\tCollectPropertyTypes(elementType, context);\n\n\t\t\treturn;\n\t\t}", + "snippet": "if (attr.ApplyMethodParameters != null && attr.ApplyMethodParameters.Count > 0)\n\t\t{\n\t\t\tforeach (var param in attr.ApplyMethodParameters)\n\t\t\t{\n\t\t\t\tif (!first)\n\t\t\t\t\tsb.Append(\", \");\n\t\t\t\t\n\t\t\t\tobject? value = null;\n\t\t\t\tvar f" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs (9/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs#L961-L1029", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/SchemaCodeEmitter.cs", + "startLine": 961, + "endLine": 1029, + "content": "if (typeKind == TypeKind.Dictionary)\n\t\t{\n\t\t\tvar keyType = CodeEmitterHelpers.GetDictionaryKeyType(unwrapped);\n\t\t\tif (keyType != null)\n\t\t\t\tCollectPropertyTypes(keyType, context);\n\n\t\t\tvar valueType = CodeEmitterHelpers.GetDictionaryValueType(unwrapped);\n\t\t\tif (valueType != null)\n\t\t\t\tCollectPropertyTypes(valueType, context);\n\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (typeKind == TypeKind.Object)\n\t\t{\n\t\t\tvar typeKey = SchemaEmissionContext.GetTypeKey(unwrapped);\n\t\t\tif (!context.TypeReferences.ContainsKey(typeKey))\n\t\t\t{\n\t\t\t\tvar defName = SchemaEmissionContext.GetDefinitionName(unwrapped);\n\t\t\t\tcontext.TypeReferences[typeKey] = (defName, unwrapped);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static bool IsBuiltInJsonDomType(ITypeSymbol typeSymbol)\n\t{\n\t\tvar typeName = typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n\t\treturn typeName is\n\t\t\t\"global::System.Text.Json.JsonDocument\" or\n\t\t\t\"global::System.Text.Json.JsonElement\" or\n\t\t\t\"global::System.Text.Json.Nodes.JsonNode\" or\n\t\t\t\"global::System.Text.Json.Nodes.JsonValue\" or\n\t\t\t\"global::System.Text.Json.Nodes.JsonObject\" or\n\t\t\t\"global::System.Text.Json.Nodes.JsonArray\";\n\t}\n\n\tprivate static void EmitRegistrationClass(StringBuilder sb, List types, HashSet aliasTypes)\n\t{\n\t\tsb.AppendLine(\"/// \");\n\t\tsb.AppendLine(\"/// Registers generated schemas with the ValidatingJsonConverter for AOT scenarios.\");\n\t\tsb.AppendLine(\"/// \");\n\t\tsb.AppendLine(\"[UnconditionalSuppressMessage(\\\"AOT\\\", \\\"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\\\", Justification = \\\"Suppressing for generated code.\\\")]\");\n\t\tsb.AppendLine(\"internal static class GeneratedSchemaRegistration\");\n\t\tsb.AppendLine(\"{\");\n\t\tsb.AppendLine(\"\\t[ModuleInitializer]\");\n\t\tsb.AppendLine(\"\\tinternal static void RegisterSchemas()\");\n\t\tsb.AppendLine(\"\\t{\");\n\n\t\tvar registeredSchemaIds = new HashSet(StringComparer.Ordinal);\n\n\t\tforeach (var type in types)\n\t\t{\n\t\t\tif (aliasTypes.Contains(type.FullyQualifiedName)) continue;\n\n\t\t\tvar schemaId = GetSchemaId(type);\n\t\t\tif (!registeredSchemaIds.Add(schemaId)) continue;\n\n\t\t\tsb.AppendLine($\"\\t\\tValidatingJsonConverter.RegisterConverter(\");\n\t\t\tsb.AppendLine($\"\\t\\t\\ttypeof({type.FullyQualifiedName}),\");\n\t\t\tsb.AppendLine($\"\\t\\t\\tnew ValidatingJsonConverter<{type.FullyQualifiedName}>(\");\n\t\t\t\tsb.AppendLine($\"\\t\\t\\t\\tGeneratedJsonSchemas.{GetPropertyName(type)},\");\n\t\t\tsb.AppendLine($\"\\t\\t\\t\\tValidatingJsonConverter.DefaultOptionsFactory));\");\n\t\t}\n\n\t\tsb.AppendLine(\"\\t}\");\n\t\tsb.AppendLine(\"}\");\n\t}\n}", + "snippet": "if (typeKind == TypeKind.Dictionary)\n\t\t{\n\t\t\tvar keyType = CodeEmitterHelpers.GetDictionaryKeyType(unwrapped);\n\t\t\tif (keyType != null)\n\t\t\t\tCollectPropertyTypes(keyType, context);\n\n\t\t\tvar valueType = CodeEmitterHelpers.Get" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/SchemaEmissionContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/SchemaEmissionContext.cs#L1-L88", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/SchemaEmissionContext.cs", + "startLine": 1, + "endLine": 88, + "content": "using System.Collections.Generic;\nusing Microsoft.CodeAnalysis;\nusing Json.Schema.Generation.SourceGeneration.Emitters;\n\nnamespace Json.Schema.Generation.SourceGeneration;\n\ninternal class SchemaEmissionContext\n{\n\tpublic Dictionary TypeReferences { get; } = new();\n\tpublic Dictionary TypeIds { get; } = new();\n\tprivate HashSet HandlerTargets { get; } = new();\n\tprivate HashSet OpenGenericHandlerTargets { get; } = new();\n\tpublic ITypeSymbol? RootType { get; set; }\n\n\tpublic SchemaEmissionContext(Dictionary? typeIds = null, List? schemaHandlers = null)\n\t{\n\t\tif (typeIds != null)\n\t\t\tTypeIds = typeIds;\n\n\t\tif (schemaHandlers == null) return;\n\n\t\tforeach (var handler in schemaHandlers)\n\t\t{\n\t\t\tif (handler.IsOpenGenericTarget)\n\t\t\t\tOpenGenericHandlerTargets.Add(handler.TargetTypeName);\n\t\t\telse\n\t\t\t\tHandlerTargets.Add(handler.TargetTypeName);\n\t\t}\n\t}\n\n\tpublic static string GetTypeKey(ITypeSymbol typeSymbol)\n\t{\n\t\tvar unwrapped = CodeEmitterHelpers.UnwrapNullable(typeSymbol);\n\t\treturn unwrapped.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n\t}\n\n\tpublic static string GetDefinitionName(ITypeSymbol typeSymbol)\n\t{\n\t\tvar unwrapped = CodeEmitterHelpers.UnwrapNullable(typeSymbol);\n\t\tvar displayName = unwrapped.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat);\n\t\t\n\t\tvar lastDot = displayName.LastIndexOf('.');\n\t\tvar simpleName = lastDot >= 0 ? displayName[(lastDot + 1)..] : displayName;\n\t\t\n\t\tvar backtickIndex = simpleName.IndexOf('`');\n\t\tif (backtickIndex >= 0)\n\t\t\tsimpleName = simpleName[..backtickIndex];\n\t\t\n\t\tsimpleName = simpleName\n\t\t\t.Replace(\"<\", \"_\")\n\t\t\t.Replace(\">\", \"\")\n\t\t\t.Replace(\",\", \"_\")\n\t\t\t.Replace(\"?\", \"\")\n\t\t\t.Replace(\" \", \"\");\n\t\t\n\t\treturn simpleName;\n\t}\n\n\tpublic string GetRefUri(ITypeSymbol typeSymbol)\n\t{\n\t\tif (RootType != null && SymbolEqualityComparer.Default.Equals(\n\t\t\tCodeEmitterHelpers.UnwrapNullable(typeSymbol), \n\t\t\tCodeEmitterHelpers.UnwrapNullable(RootType)))\n\t\t{\n\t\t\treturn \"#\";\n\t\t}\n\t\t\n\t\tvar typeKey = GetTypeKey(typeSymbol);\n\t\treturn TypeIds.TryGetValue(typeKey, out var id) ? id : \"\";\n\t}\n\n\tpublic bool HasSchemaHandler(ITypeSymbol typeSymbol)\n\t{\n\t\tvar unwrapped = CodeEmitterHelpers.UnwrapNullable(typeSymbol);\n\t\tvar fullyQualified = unwrapped.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n\t\tif (HandlerTargets.Contains(fullyQualified))\n\t\t\treturn true;\n\n\t\tif (unwrapped is INamedTypeSymbol { IsGenericType: true } named)\n\t\t{\n\t\t\tvar unbound = named.ConstructUnboundGenericType().ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n\t\t\treturn OpenGenericHandlerTargets.Contains(unbound);\n\t\t}\n\n\t\treturn false;\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing Microsoft.CodeAnalysis;\nusing Json.Schema.Generation.SourceGeneration.Emitters;\n\nnamespace Json.Schema.Generation.SourceGeneration;\n\ninternal class SchemaEmissionContext\n{\n\tpublic " + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs (1/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Json.Schema.Generation.Serialization;\nusing Json.Schema.Generation.SourceGeneration.Emitters;\nusing Microsoft.CodeAnalysis;\n\nnamespace Json.Schema.Generation.SourceGeneration;\n\ninternal static class TypeAnalyzer\n{\n\tpublic static TypeInfo? Analyze(Compilation compilation, INamedTypeSymbol typeSymbol, AttributeData? attributeData, Action reportDiagnostic, NamingConvention defaultPropertyNaming = NamingConvention.AsDeclared, PropertyOrder defaultPropertyOrder = PropertyOrder.AsDeclared)\n\t{\n\t\tif (typeSymbol is { IsGenericType: true, IsUnboundGenericType: false })\n\t\t{\n\t\t\tforeach (var typeArg in typeSymbol.TypeArguments)\n\t\t\t{\n\t\t\t\tif (typeArg.TypeKind == Microsoft.CodeAnalysis.TypeKind.TypeParameter)\n\t\t\t\t{\n\t\t\t\t\treportDiagnostic(Diagnostic.Create(\n\t\t\t\t\t\tDiagnostics.OpenGenericTypeNotSupported,\n\t\t\t\t\t\ttypeSymbol.Locations.FirstOrDefault(),\n\t\t\t\t\t\ttypeSymbol.ToDisplayString()));\n\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar propertyNaming = defaultPropertyNaming;\n\t\tvar propertyOrder = defaultPropertyOrder;\n\t\tvar strictConditionals = false;\n\n\t\tif (attributeData != null)\n\t\t{\n\t\t\tforeach (var namedArg in attributeData.NamedArguments)\n\t\t\t{\n\t\t\t\tswitch (namedArg.Key)\n\t\t\t\t{\n\t\t\t\t\tcase \"PropertyNaming\" when namedArg.Value.Value is int namingValue:\n\t\t\t\t\t\tpropertyNaming = (NamingConvention)namingValue;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"PropertyOrder\" when namedArg.Value.Value is int orderValue:\n\t\t\t\t\t\tpropertyOrder = (PropertyOrder)orderValue;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"StrictConditionals\" when namedArg.Value.Value is bool strictValue:\n\t\t\t\t\t\tstrictConditionals = strictValue;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar typeKind = DetermineTypeKind(typeSymbol);\n\t\tvar isNullable = IsNullableType(typeSymbol);\n\n\t\tvar typeInfo = new TypeInfo\n\t\t{\n\t\t\tTypeSymbol = typeSymbol,\n\t\t\tFullyQualifiedName = typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat),\n\t\t\tSchemaPropertyName = GetSchemaPropertyName(typeSymbol),\n\t\t\tPropertyNaming = propertyNaming,\n\t\t\tPropertyOrder = propertyOrder,\n\t\t\tStrictConditionals = strictConditionals,\n\t\t\tKind = typeKind,\n\t\t\tIsNullable = isNullable,\n\t\t\tXmlDocSummary = GetXmlDocSummary(typeSymbol)\n\t\t};\n\n\t\tswitch (typeKind)\n\t\t{\n\t\t\tcase TypeKind.Object:\n\t\t\t\tAnalyzeObjectType(compilation, typeInfo, reportDiagnostic);\n\t\t\t\tbreak;\n\t\t\tcase TypeKind.Enum:\n\t\t\t\tAnalyzeEnumType(typeInfo);\n\t\t\t\tbreak;\n\t\t\tcase TypeKind.Array:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tExtractAttributes(compilation, typeSymbol.GetAttributes(), typeInfo.TypeAttributes);\n\n\t\tif (typeKind == TypeKind.Object)\n\t\t\tAnalyzeConditionals(typeInfo);\n\n\t\treturn typeInfo;\n\t}\n\n\tprivate static TypeKind DetermineTypeKind(ITypeSymbol typeSymbol)\n\t{\n\t\tvar unwrappedType = UnwrapNullable(typeSymbol);\n\t\tvar typeString = unwrappedType.ToDisplayString();\n\n\t\tswitch (typeString)\n\t\t{\n\t\t\tcase \"System.Text.Json.JsonDocument\" or \"System.Text.Json.JsonElement\" or \"System.Text.Json.Nodes.JsonNode\" or \"System.Text.Json.Nodes.JsonValue\":\n\t\t\t\treturn TypeKind.Any;\n\t\t\tcase \"System.Text.Json.Nodes.JsonObject\":\n\t\t\t\treturn TypeKind.Object;\n\t\t\tcase \"System.Text.Json.Nodes.JsonArray\":\n\t\t\t\treturn TypeKind.Array;\n\t\t\tcase \"bool\" or \"System.Boolean\":\n\t\t\t\treturn TypeKind.Boolean;\n\t\t\tcase \"byte\" or \"sbyte\" or \"short\" or \"ushort\" or \"int\" or \"uint\" or \"long\" or \"ulong\" or\n\t\t\t\t\"System.Byte\" or \"System.SByte\" or \"System.Int16\" or \"System.UInt16\" or\n\t\t\t\t\"System.Int32\" or \"System.UInt32\" or \"System.Int64\" or \"System.UInt64\":\n\t\t\t\treturn TypeKind.Integer;\n\t\t\tcase \"float\" or \"double\" or \"decimal\" or \"System.Single\" or \"System.Double\" or \"System.Decimal\":\n\t\t\t\treturn TypeKind.Number;\n\t\t\tcase \"string\" or \"System.String\":\n\t\t\t\treturn TypeKind.String;\n\t\t\tcase \"System.DateTime\" or \"System.DateTimeOffset\":\n\t\t\t\treturn TypeKind.DateTime;\n\t\t\tcase \"System.Guid\":\n\t\t\t\treturn TypeKind.Guid;\n\t\t\tcase \"System.Uri\":\n\t\t\t\treturn TypeKind.Uri;\n\t\t}\n\n\t\tif (unwrappedType.TypeKind == Microsoft.CodeAnalysis.TypeKind.Enum) return TypeKind.Enum;", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Json.Schema.Generation.Serialization;\nusing Json.Schema.Generation.SourceGeneration.Emitters;\nusing Microsoft.CodeAnalysis;\n\nnamespace Json.Schema." + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs (2/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs", + "startLine": 121, + "endLine": 240, + "content": "if (unwrappedType is IArrayTypeSymbol) return TypeKind.Array;\n\t\tif (CodeEmitterHelpers.IsCollectionType(unwrappedType)) return TypeKind.Array;\n\t\tif (CodeEmitterHelpers.IsDictionaryType(unwrappedType)) return TypeKind.Dictionary;\n\n\t\treturn TypeKind.Object;\n\t}\n\n\tprivate static void AnalyzeObjectType(Compilation compilation, TypeInfo typeInfo, Action reportDiagnostic)\n\t{\n\t\tvar typeSymbol = (INamedTypeSymbol)typeInfo.TypeSymbol;\n\t\tvar encounteredSchemaNames = new HashSet(StringComparer.Ordinal);\n\n\t\tvar members = typeSymbol.GetMembers()\n\t\t\t.Where(m => m is { IsStatic: false, Kind: SymbolKind.Property or SymbolKind.Field })\n\t\t\t.ToList();\n\n\t\tforeach (var member in members)\n\t\t{\n\t\t\tif (HasAttribute(member, \"JsonExcludeAttribute\")) continue;\n\n\t\t\tvar jsonIgnoreAttr = member.GetAttributes()\n\t\t\t\t.FirstOrDefault(a => a.AttributeClass?.Name == \"JsonIgnoreAttribute\");\n\n\t\t\tif (jsonIgnoreAttr != null)\n\t\t\t{\n\t\t\t\tvar conditionArg = jsonIgnoreAttr.NamedArguments\n\t\t\t\t\t.FirstOrDefault(arg => arg.Key == \"Condition\");\n\n\t\t\t\tif (conditionArg.Value.Value == null || (int)conditionArg.Value.Value == 1) continue;\n\t\t\t}\n\n\t\t\tITypeSymbol memberType;\n\t\t\tbool isReadOnly;\n\t\t\tvar isWriteOnly = false;\n\n\t\t\tif (member is IPropertySymbol property)\n\t\t\t{\n\t\t\t\tif (property.DeclaredAccessibility != Accessibility.Public && !HasAttribute(member, \"JsonIncludeAttribute\")) continue;\n\n\t\t\t\tif (property.IsIndexer) continue;\n\n\t\t\t\tmemberType = property.Type;\n\t\t\t\tisReadOnly = property.SetMethod is not { DeclaredAccessibility: Accessibility.Public };\n\t\t\t\tisWriteOnly = property.GetMethod is not { DeclaredAccessibility: Accessibility.Public };\n\n\t\t\t\tif (isWriteOnly) continue;\n\t\t\t}\n\t\t\telse if (member is IFieldSymbol field)\n\t\t\t{\n\t\t\t\tif (field.DeclaredAccessibility != Accessibility.Public && !HasAttribute(member, \"JsonIncludeAttribute\")) continue;\n\n\t\t\t\tmemberType = field.Type;\n\t\t\t\tisReadOnly = field.IsReadOnly;\n\t\t\t}\n\t\t\telse continue;\n\n\t\t\tvar schemaName = GetPropertySchemaName(member, typeInfo.PropertyNaming);\n\t\t\tif (!encounteredSchemaNames.Add(schemaName))\n\t\t\t{\n\t\t\t\treportDiagnostic(Diagnostic.Create(\n\t\t\t\t\tDiagnostics.DuplicateSchemaPropertyName,\n\t\t\t\t\tmember.Locations.FirstOrDefault(),\n\t\t\t\t\ttypeSymbol.ToDisplayString(),\n\t\t\t\t\tschemaName));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar isRequired = false;\n\t\t\tvar requiredAttrs = member.GetAttributes().Where(a => a.AttributeClass?.Name == \"RequiredAttribute\").ToList();\n\t\t\tforeach (var reqAttr in requiredAttrs)\n\t\t\t{\n\t\t\t\tvar hasConditionGroup = false;\n\t\t\t\tforeach (var namedArg in reqAttr.NamedArguments)\n\t\t\t\t{\n\t\t\t\t\tif (namedArg is { Key: \"ConditionGroup\", Value.Value: not null })\n\t\t\t\t\t{\n\t\t\t\t\t\thasConditionGroup = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!hasConditionGroup)\n\t\t\t\t{\n\t\t\t\t\tisRequired = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!isRequired)\n\t\t\t\tisRequired = HasAttribute(member, \"JsonRequiredAttribute\");\n\n\t\t\tif (!isRequired && member is IPropertySymbol propertySymbol)\n\t\t\t\tisRequired = propertySymbol.IsRequired;\n\n\t\t\tvar memberAttributes = member.GetAttributes();\n\t\t\tvar isNullable = GetNullableAttributeOverride(memberAttributes) ?? IsNullableType(memberType);\n\n\t\t\tvar propertyInfo = new PropertyInfo\n\t\t\t{\n\t\t\t\tName = member.Name,\n\t\t\t\tSchemaName = schemaName,\n\t\t\t\tType = memberType,\n\t\t\t\tIsRequired = isRequired,\n\t\t\t\tIsNullable = isNullable,\n\t\t\t\tIsReadOnly = isReadOnly,\n\t\t\t\tIsWriteOnly = isWriteOnly,\n\t\t\t\tXmlDocSummary = GetXmlDocSummary(member)\n\t\t\t};\n\n\t\t\tExtractAttributes(compilation, memberAttributes, propertyInfo.Attributes);\n\n\t\t\ttypeInfo.Properties.Add(propertyInfo);\n\t\t}\n\n\t\tif (typeInfo.PropertyOrder == PropertyOrder.ByName)\n\t\t\ttypeInfo.Properties.Sort((a, b) => string.Compare(a.SchemaName, b.SchemaName, StringComparison.OrdinalIgnoreCase));\n\t}\n\n\tprivate static void AnalyzeEnumType(TypeInfo typeInfo)\n\t{", + "snippet": "if (unwrappedType is IArrayTypeSymbol) return TypeKind.Array;\n\t\tif (CodeEmitterHelpers.IsCollectionType(unwrappedType)) return TypeKind.Array;\n\t\tif (CodeEmitterHelpers.IsDictionaryType(unwrappedType)) return TypeKind.Dic" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs (3/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs", + "startLine": 241, + "endLine": 360, + "content": "var typeSymbol = typeInfo.TypeSymbol;\n\n\t\tforeach (var member in typeSymbol.GetMembers())\n\t\t{\n\t\t\tif (member is IFieldSymbol { IsConst: true, HasConstantValue: true } field)\n\t\t\t{\n\t\t\t\tif (CodeEmitterHelpers.ShouldIncludeEnumMember(field))\n\t\t\t\t\ttypeInfo.EnumValues.Add(field.Name);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void AnalyzeConditionals(TypeInfo typeInfo)\n\t{\n\t\tvar conditionalsByGroup = new Dictionary();\n\n\t\tvar typeAttributes = typeInfo.TypeSymbol.GetAttributes();\n\n\t\tforeach (var attr in typeAttributes)\n\t\t{\n\t\t\tif (attr.AttributeClass == null) continue;\n\n\t\t\tvar attrName = attr.AttributeClass.Name;\n\t\t\tobject? conditionGroup = null;\n\n\t\t\tforeach (var namedArg in attr.NamedArguments)\n\t\t\t{\n\t\t\t\tif (namedArg.Key == \"ConditionGroup\")\n\t\t\t\t{\n\t\t\t\t\tconditionGroup = namedArg.Value.Value;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (conditionGroup == null && attr.ConstructorArguments.Length > 0)\n\t\t\t{\n\t\t\t\tvar lastArg = attr.ConstructorArguments[^1];\n\t\t\t\tif (lastArg.Value != null)\n\t\t\t\t\tconditionGroup = lastArg.Value;\n\t\t\t}\n\n\t\t\tif (conditionGroup == null) continue;\n\n\t\t\tif (!conditionalsByGroup.TryGetValue(conditionGroup, out var conditionalInfo))\n\t\t\t{\n\t\t\t\tconditionalInfo = new ConditionalInfo { ConditionGroup = conditionGroup };\n\t\t\t\tconditionalsByGroup[conditionGroup] = conditionalInfo;\n\t\t\t}\n\n\t\t\tswitch (attrName)\n\t\t\t{\n\t\t\t\tcase \"IfAttribute\":\n\t\t\t\t\tParseIfAttribute(attr, conditionalInfo, typeInfo);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"IfMinAttribute\":\n\t\t\t\t\tParseIfMinAttribute(attr, conditionalInfo, typeInfo);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"IfMaxAttribute\":\n\t\t\t\t\tParseIfMaxAttribute(attr, conditionalInfo, typeInfo);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"IfEnumAttribute\":\n\t\t\t\t\tParseIfEnumAttribute(attr, typeInfo, conditionalsByGroup);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tforeach (var property in typeInfo.Properties)\n\t\t{\n\t\t\tforeach (var attr in property.Attributes)\n\t\t\t{\n\t\t\t\tif (!attr.Parameters.TryGetValue(\"ConditionGroup\", out var conditionGroupValue) || conditionGroupValue == null)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tvar conditionGroup = conditionGroupValue;\n\n\t\t\t\tif (!conditionalsByGroup.TryGetValue(conditionGroup, out var conditionalInfo))\n\t\t\t\t{\n\t\t\t\t\tconditionalInfo = new ConditionalInfo { ConditionGroup = conditionGroup };\n\t\t\t\t\tconditionalsByGroup[conditionGroup] = conditionalInfo;\n\t\t\t\t}\n\n\t\t\t\tif (!property.ConditionGroups.Contains(conditionGroup))\n\t\t\t\t\tproperty.ConditionGroups.Add(conditionGroup);\n\n\t\t\t\tvar existingConsequence = conditionalInfo.PropertyConsequences\n\t\t\t\t\t.FirstOrDefault(c => c.PropertySchemaName == property.SchemaName);\n\n\t\t\t\tvar isRequired = existingConsequence?.IsConditionallyRequired ?? false;\n\t\t\t\tvar isReadOnly = existingConsequence?.IsConditionallyReadOnly ?? false;\n\t\t\t\tvar isWriteOnly = existingConsequence?.IsConditionallyWriteOnly ?? false;\n\t\t\t\tvar conditionalAttributes = existingConsequence?.ConditionalAttributes ?? new List();\n\t\t\t\t// Set boolean flags for special cases\n\t\t\t\tswitch (attr.AttributeName)\n\t\t\t\t{\n\t\t\t\t\tcase \"RequiredAttribute\":\n\t\t\t\t\t\tisRequired = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"ReadOnlyAttribute\":\n\t\t\t\t\t\tif (attr.Parameters.TryGetValue(\"arg0\", out var readOnlyValue) && readOnlyValue is not false)\n\t\t\t\t\t\t\tisReadOnly = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"WriteOnlyAttribute\":\n\t\t\t\t\t\tif (attr.Parameters.TryGetValue(\"arg0\", out var writeOnlyValue) && writeOnlyValue is not false)\n\t\t\t\t\t\t\tisWriteOnly = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Add all validation attributes to the list (except RequiredAttribute which is handled separately)\n\t\t\t\tif (attr.AttributeName != \"RequiredAttribute\" && SchemaCodeEmitter.ShouldEmitBuiltInAttribute(attr))\n\t\t\t\t\tconditionalAttributes.Add(attr);\n\n\t\t\t\tvar newConsequence = new PropertyConditionalConsequence\n\t\t\t\t{\n\t\t\t\t\tPropertySchemaName = property.SchemaName,\n\t\t\t\t\tIsConditionallyRequired = isRequired,\n\t\t\t\t\tIsConditionallyReadOnly = isReadOnly,\n\t\t\t\t\tIsConditionallyWriteOnly = isWriteOnly,\n\t\t\t\t\tConditionalAttributes = conditionalAttributes\n\t\t\t\t};", + "snippet": "var typeSymbol = typeInfo.TypeSymbol;\n\n\t\tforeach (var member in typeSymbol.GetMembers())\n\t\t{\n\t\t\tif (member is IFieldSymbol { IsConst: true, HasConstantValue: true } field)\n\t\t\t{\n\t\t\t\tif (CodeEmitterHelpers.ShouldIncludeEnu" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs (4/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs", + "startLine": 361, + "endLine": 480, + "content": "if (existingConsequence != null)\n\t\t\t\t\tconditionalInfo.PropertyConsequences.Remove(existingConsequence);\n\n\t\t\t\tconditionalInfo.PropertyConsequences.Add(newConsequence);\n\t\t\t}\n\t\t}\n\n\t\ttypeInfo.Conditionals.AddRange(conditionalsByGroup.Values);\n\t}\n\n\tprivate static void ParseIfAttribute(AttributeData attr, ConditionalInfo conditionalInfo, TypeInfo typeInfo)\n\t{\n\t\tif (attr.ConstructorArguments.Length < 2) return;\n\n\t\tvar propertyName = attr.ConstructorArguments[0].Value?.ToString();\n\t\tvar value = attr.ConstructorArguments[1].Value;\n\n\t\tif (string.IsNullOrEmpty(propertyName)) return;\n\n\t\tvar property = typeInfo.Properties.FirstOrDefault(p => p.Name == propertyName);\n\t\tvar schemaName = property?.SchemaName ?? ApplyNamingConvention(propertyName!, typeInfo.PropertyNaming);\n\n\t\tvar trigger = new ConditionalTrigger\n\t\t{\n\t\t\tType = ConditionalTriggerType.Equality,\n\t\t\tPropertyName = propertyName!,\n\t\t\tPropertySchemaName = schemaName,\n\t\t\tExpectedValue = FormatValueForSchema(value)\n\t\t};\n\n\t\tconditionalInfo.Triggers.Add(trigger);\n\t}\n\n\tprivate static void ParseIfMinAttribute(AttributeData attr, ConditionalInfo conditionalInfo, TypeInfo typeInfo) =>\n\t\tParseIfNumericBoundAttribute(attr, conditionalInfo, typeInfo, ConditionalTriggerType.Minimum);\n\n\tprivate static void ParseIfMaxAttribute(AttributeData attr, ConditionalInfo conditionalInfo, TypeInfo typeInfo) =>\n\t\tParseIfNumericBoundAttribute(attr, conditionalInfo, typeInfo, ConditionalTriggerType.Maximum);\n\n\tprivate static void ParseIfNumericBoundAttribute(AttributeData attr, ConditionalInfo conditionalInfo, TypeInfo typeInfo, ConditionalTriggerType triggerType)\n\t{\n\t\tif (attr.ConstructorArguments.Length < 2) return;\n\n\t\tvar propertyName = attr.ConstructorArguments[0].Value?.ToString();\n\t\tvar value = attr.ConstructorArguments[1].Value;\n\n\t\tif (string.IsNullOrEmpty(propertyName)) return;\n\n\t\tvar property = typeInfo.Properties.FirstOrDefault(p => p.Name == propertyName);\n\t\tvar schemaName = property?.SchemaName ?? ApplyNamingConvention(propertyName!, typeInfo.PropertyNaming);\n\n\t\tvar isExclusive = false;\n\t\tforeach (var namedArg in attr.NamedArguments)\n\t\t{\n\t\t\tif (namedArg is { Key: \"IsExclusive\", Value.Value: bool exclusive })\n\t\t\t{\n\t\t\t\tisExclusive = exclusive;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tvar trigger = new ConditionalTrigger\n\t\t{\n\t\t\tType = triggerType,\n\t\t\tPropertyName = propertyName!,\n\t\t\tPropertySchemaName = schemaName,\n\t\t\tNumericValue = Convert.ToDouble(value),\n\t\t\tIsExclusive = isExclusive\n\t\t};\n\n\t\tconditionalInfo.Triggers.Add(trigger);\n\t}\n\n\tprivate static void ParseIfEnumAttribute(AttributeData attr, TypeInfo typeInfo, Dictionary conditionalsByGroup)\n\t{\n\t\tif (attr.ConstructorArguments.Length < 1) return;\n\n\t\tvar propertyName = attr.ConstructorArguments[0].Value?.ToString();\n\t\tif (string.IsNullOrEmpty(propertyName)) return;\n\n\t\tvar property = typeInfo.Properties.FirstOrDefault(p => p.Name == propertyName);\n\t\tif (property == null) return;\n\n\t\tvar schemaName = property.SchemaName;\n\n\t\tvar propertyType = UnwrapNullable(property.Type);\n\t\tif (propertyType.TypeKind != Microsoft.CodeAnalysis.TypeKind.Enum) return;\n\n\t\tvar useNumbers = false;\n\t\tif (attr.ConstructorArguments.Length > 1 && attr.ConstructorArguments[1].Value is bool un)\n\t\t\tuseNumbers = un;\n\n\t\tvar enumMembers = propertyType.GetMembers()\n\t\t\t.OfType()\n\t\t\t.Where(f => f is { IsConst: true, HasConstantValue: true })\n\t\t\t.ToList();\n\n\t\tforeach (var enumMember in enumMembers)\n\t\t{\n\t\t\tvar enumValue = enumMember.ConstantValue;\n\t\t\tif (enumValue == null) continue;\n\n\t\t\tvar conditionGroup = enumValue;\n\n\t\t\tif (!conditionalsByGroup.TryGetValue(conditionGroup, out var conditionalInfo))\n\t\t\t{\n\t\t\t\tconditionalInfo = new ConditionalInfo { ConditionGroup = conditionGroup };\n\t\t\t\tconditionalsByGroup[conditionGroup] = conditionalInfo;\n\t\t\t}\n\n\t\t\tvar trigger = new ConditionalTrigger\n\t\t\t{\n\t\t\t\tType = ConditionalTriggerType.Equality,\n\t\t\t\tPropertyName = propertyName!,\n\t\t\t\tPropertySchemaName = schemaName,\n\t\t\t\tExpectedValue = useNumbers ? enumValue.ToString() : $\"\\\"{enumMember.Name}\\\"\"\n\t\t\t};\n\n\t\t\tconditionalInfo.Triggers.Add(trigger);\n\t\t}", + "snippet": "if (existingConsequence != null)\n\t\t\t\t\tconditionalInfo.PropertyConsequences.Remove(existingConsequence);\n\n\t\t\t\tconditionalInfo.PropertyConsequences.Add(newConsequence);\n\t\t\t}\n\t\t}\n\n\t\ttypeInfo.Conditionals.AddRange(conditiona" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs (5/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs", + "startLine": 481, + "endLine": 600, + "content": "}\n\n\tprivate static string FormatValueForSchema(object? value)\n\t{\n\t\treturn value switch\n\t\t{\n\t\t\tnull => \"null\",\n\t\t\tbool b => b ? \"true\" : \"false\",\n\t\t\tstring s => $\"\\\"{s}\\\"\",\n\t\t\t_ => value.ToString() ?? \"null\"\n\t\t};\n\t}\n\n\tprivate static void ExtractAttributes(Compilation compilation, IEnumerable attributes, List targetList)\n\t{\n\t\tforeach (var attr in attributes)\n\t\t{\n\t\t\tvar attrClass = attr.AttributeClass;\n\t\t\tif (attrClass == null) continue;\n\n\t\t\tvar attrName = attrClass.Name;\n\t\t\tvar attrFullName = attrClass.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n\n\t\t\tvar isCustomEmitter = ImplementsInterface(attrClass, \"IAttributeHandler\") && HasStaticApplyMethod(attrClass);\n\n\t\t\tINamedTypeSymbol? handlerClass = null;\n\t\t\tif (!isCustomEmitter)\n\t\t\t{\n\t\t\t\thandlerClass = FindAttributeHandler(compilation, attrClass);\n\t\t\t\tif (handlerClass != null)\n\t\t\t\t\tisCustomEmitter = true;\n\t\t\t}\n\n\t\t\tif (!isCustomEmitter && !SchemaCodeEmitter.IsBuiltInAttributeNamespace(attrFullName)) continue;\n\n\t\t\tList? applyParams = null;\n\t\t\tif (isCustomEmitter)\n\t\t\t{\n\t\t\t\tvar emitterClass = handlerClass ?? attrClass;\n\t\t\t\tapplyParams = ExtractApplyMethodParameters(emitterClass);\n\t\t\t}\n\n\t\t\tvar attrInfo = new AttributeInfo\n\t\t\t{\n\t\t\t\tAttributeName = attrName,\n\t\t\t\tIsCustomEmitter = isCustomEmitter,\n\t\t\t\tAttributeFullName = isCustomEmitter ? (handlerClass?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) ?? attrFullName) : attrFullName,\n\t\t\t\tApplyMethodParameters = applyParams\n\t\t\t};\n\n\t\t\tfor (int i = 0; i < attr.ConstructorArguments.Length; i++)\n\t\t\t{\n\t\t\t\tvar arg = attr.ConstructorArguments[i];\n\t\t\t\tattrInfo.Parameters[$\"arg{i}\"] = arg.Value;\n\t\t\t}\n\n\t\t\tforeach (var namedArg in attr.NamedArguments)\n\t\t\t{\n\t\t\t\tattrInfo.Parameters[namedArg.Key] = namedArg.Value.Value;\n\t\t\t}\n\n\t\t\ttargetList.Add(attrInfo);\n\t\t}\n\t}\n\n\tprivate static List? ExtractApplyMethodParameters(INamedTypeSymbol attrClass)\n\t{\n\t\tvar applyMethod = attrClass.GetMembers(\"Apply\")\n\t\t\t.OfType()\n\t\t\t.FirstOrDefault(m => m is { IsStatic: true, Name: \"Apply\" });\n\n\t\tif (applyMethod == null) return null;\n\n\t\tvar parameters = new List();\n\t\tforeach (var param in applyMethod.Parameters.Skip(1))\n\t\t{\n\t\t\tparameters.Add(new ApplyParameterInfo\n\t\t\t{\n\t\t\t\tName = param.Name,\n\t\t\t\tTypeName = param.Type.ToDisplayString()\n\t\t\t});\n\t\t}\n\n\t\treturn parameters;\n\t}\n\n\tprivate static bool ImplementsInterface(INamedTypeSymbol typeSymbol, string interfaceName) =>\n\t\ttypeSymbol.AllInterfaces.Any(i => i.Name == interfaceName);\n\n\tprivate static bool HasStaticApplyMethod(INamedTypeSymbol typeSymbol) =>\n\t\ttypeSymbol.GetMembers(\"Apply\")\n\t\t\t.OfType()\n\t\t\t.Any(m => m.IsStatic && m.Name == \"Apply\" &&\n\t\t\t m.Parameters.Length > 0 &&\n\t\t\t m.Parameters[0].Type.Name == \"JsonSchemaBuilder\");\n\n\tprivate static INamedTypeSymbol? FindAttributeHandler(Compilation compilation, INamedTypeSymbol attributeClass)\n\t{\n\t\tvar handlerType = FindHandlerByInterface(compilation.Assembly.GlobalNamespace, attributeClass);\n\t\tif (handlerType != null && HasStaticApplyMethod(handlerType))\n\t\t\treturn handlerType;\n\n\t\tforeach (var reference in compilation.References)\n\t\t{\n\t\t\tvar assemblySymbol = compilation.GetAssemblyOrModuleSymbol(reference) as IAssemblySymbol;\n\t\t\tif (assemblySymbol == null) continue;\n\n\t\t\thandlerType = FindHandlerByInterface(assemblySymbol.GlobalNamespace, attributeClass);\n\t\t\tif (handlerType != null && HasStaticApplyMethod(handlerType))\n\t\t\t\treturn handlerType;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate static INamedTypeSymbol? FindHandlerByInterface(INamespaceSymbol namespaceSymbol, INamedTypeSymbol attributeClass)\n\t{\n\t\tforeach (var type in namespaceSymbol.GetTypeMembers())\n\t\t{\n\t\t\tif (type.TypeKind != Microsoft.CodeAnalysis.TypeKind.Class) continue;", + "snippet": "}\n\n\tprivate static string FormatValueForSchema(object? value)\n\t{\n\t\treturn value switch\n\t\t{\n\t\t\tnull => \"null\",\n\t\t\tbool b => b ? \"true\" : \"false\",\n\t\t\tstring s => $\"\\\"{s}\\\"\",\n\t\t\t_ => value.ToString() ?? \"null\"\n\t\t};\n\t}\n\n\tpri" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs (6/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs", + "startLine": 601, + "endLine": 720, + "content": "foreach (var iface in type.AllInterfaces)\n\t\t\t{\n\t\t\t\tif (iface.Name != \"IAttributeHandler\") continue;\n\t\t\t\tif (!iface.IsGenericType || iface.TypeArguments.Length != 1) continue;\n\n\t\t\t\tvar typeArg = iface.TypeArguments[0];\n\t\t\t\tif (SymbolEqualityComparer.Default.Equals(typeArg, attributeClass))\n\t\t\t\t\treturn type;\n\t\t\t}\n\t\t}\n\n\t\tforeach (var nestedNamespace in namespaceSymbol.GetNamespaceMembers())\n\t\t{\n\t\t\tvar foundType = FindHandlerByInterface(nestedNamespace, attributeClass);\n\t\t\tif (foundType != null)\n\t\t\t\treturn foundType;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate static string GetPropertySchemaName(ISymbol member, NamingConvention naming)\n\t{\n\t\tvar jsonPropertyNameAttr = member.GetAttributes()\n\t\t\t.FirstOrDefault(a => a.AttributeClass?.Name == \"JsonPropertyNameAttribute\");\n\n\t\treturn jsonPropertyNameAttr is { ConstructorArguments.Length: > 0 }\n\t\t\t? jsonPropertyNameAttr.ConstructorArguments[0].Value?.ToString() ?? member.Name\n\t\t\t: ApplyNamingConvention(member.Name, naming);\n\t}\n\n\tprivate static string ApplyNamingConvention(string name, NamingConvention naming) =>\n\t\tnaming switch\n\t\t{\n\t\t\tNamingConvention.CamelCase => ToCamelCase(name),\n\t\t\tNamingConvention.PascalCase => ToPascalCase(name),\n\t\t\tNamingConvention.LowerSnakeCase => ToSnakeCase(name).ToLowerInvariant(),\n\t\t\tNamingConvention.UpperSnakeCase => ToSnakeCase(name).ToUpperInvariant(),\n\t\t\tNamingConvention.KebabCase => ToKebabCase(name),\n\t\t\tNamingConvention.UpperKebabCase => ToKebabCase(name).ToUpperInvariant(),\n\t\t\t_ => name\n\t\t};\n\n\tprivate static string ToCamelCase(string name) =>\n\t\tstring.IsNullOrEmpty(name) || char.IsLower(name[0])\n\t\t\t? name\n\t\t\t: char.ToLowerInvariant(name[0]) + name[1..];\n\n\tprivate static string ToPascalCase(string name) =>\n\t\tstring.IsNullOrEmpty(name) || char.IsUpper(name[0])\n\t\t\t? name\n\t\t\t: char.ToUpperInvariant(name[0]) + name[1..];\n\n\tprivate static string ToSnakeCase(string name)\n\t{\n\t\tif (string.IsNullOrEmpty(name)) return name;\n\n\t\tvar result = new System.Text.StringBuilder();\n\t\tresult.Append(char.ToLowerInvariant(name[0]));\n\n\t\tfor (int i = 1; i < name.Length; i++)\n\t\t{\n\t\t\tif (char.IsUpper(name[i]))\n\t\t\t{\n\t\t\t\tresult.Append('_');\n\t\t\t\tresult.Append(char.ToLowerInvariant(name[i]));\n\t\t\t}\n\t\t\telse\n\t\t\t\tresult.Append(name[i]);\n\t\t}\n\n\t\treturn result.ToString();\n\t}\n\n\tprivate static string ToKebabCase(string name) => ToSnakeCase(name).Replace('_', '-');\n\n\tprivate static string GetSchemaPropertyName(INamedTypeSymbol typeSymbol)\n\t{\n\t\tvar currentName = typeSymbol.Name;\n\n\t\tif (typeSymbol.IsGenericType && typeSymbol.TypeArguments.Length > 0)\n\t\t{\n\t\t\tvar typeArgNames = typeSymbol.TypeArguments\n\t\t\t\t.Select(GetTypeArgumentPropertyName);\n\t\t\tcurrentName = $\"{currentName}Of{string.Join(\"And\", typeArgNames)}\";\n\t\t}\n\n\t\treturn typeSymbol.ContainingType != null\n\t\t\t? $\"{GetSchemaPropertyName(typeSymbol.ContainingType)}_{currentName}\"\n\t\t\t: currentName;\n\t}\n\n\tprivate static string GetTypeArgumentPropertyName(ITypeSymbol typeSymbol)\n\t{\n\t\tvar isNullable = typeSymbol.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T ||\n\t\t typeSymbol.NullableAnnotation == NullableAnnotation.Annotated;\n\t\tvar unwrapped = UnwrapNullable(typeSymbol);\n\n\t\tstring name;\n\t\tif (unwrapped is INamedTypeSymbol namedType)\n\t\t\tname = GetSchemaPropertyName(namedType);\n\t\telse if (unwrapped is IArrayTypeSymbol arrayType)\n\t\t\tname = $\"{GetTypeArgumentPropertyName(arrayType.ElementType)}Array\";\n\t\telse\n\t\t\tname = SanitizeSchemaPropertyName(unwrapped.Name);\n\n\t\tif (isNullable)\n\t\t\tname += \"Nullable\";\n\n\t\treturn name;\n\t}\n\n\tprivate static string SanitizeSchemaPropertyName(string name)\n\t{\n\t\tvar sb = new System.Text.StringBuilder(name.Length);\n\t\tvar lastWasUnderscore = false;\n\n\t\tforeach (var ch in name)\n\t\t{", + "snippet": "foreach (var iface in type.AllInterfaces)\n\t\t\t{\n\t\t\t\tif (iface.Name != \"IAttributeHandler\") continue;\n\t\t\t\tif (!iface.IsGenericType || iface.TypeArguments.Length != 1) continue;\n\n\t\t\t\tvar typeArg = iface.TypeArguments[0];\n\t\t" + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs (7/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs#L721-L793", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/TypeAnalyzer.cs", + "startLine": 721, + "endLine": 793, + "content": "if (char.IsLetterOrDigit(ch) || ch == '_')\n\t\t\t{\n\t\t\t\tsb.Append(ch);\n\t\t\t\tlastWasUnderscore = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (lastWasUnderscore) continue;\n\n\t\t\tsb.Append('_');\n\t\t\tlastWasUnderscore = true;\n\t\t}\n\n\t\treturn sb.ToString().Trim('_');\n\t}\n\n\t/// Returns the value of [Nullable(bool)] if the attribute is present; null otherwise.\n\t/// Only recognises Json.Schema.Generation.NullableAttribute to avoid picking up the\n\t/// compiler-generated System.Runtime.CompilerServices.NullableAttribute.\n\tprivate static bool? GetNullableAttributeOverride(IEnumerable attributes)\n\t{\n\t\tvar attr = attributes.FirstOrDefault(a =>\n\t\t\ta.AttributeClass?.Name == \"NullableAttribute\" &&\n\t\t\ta.AttributeClass.ContainingNamespace?.ToDisplayString() == \"Json.Schema.Generation\");\n\n\t\tif (attr == null) return null;\n\n\t\t// [Nullable] with no argument defaults to true\n\t\tif (attr.ConstructorArguments.Length == 0) return true;\n\n\t\treturn attr.ConstructorArguments[0].Value is bool value ? value : true;\n\t}\n\n\tprivate static bool IsNullableType(ITypeSymbol typeSymbol) =>\n\t\ttypeSymbol.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T ||\n\t\ttypeSymbol.NullableAnnotation == NullableAnnotation.Annotated;\n\n\tprivate static ITypeSymbol UnwrapNullable(ITypeSymbol typeSymbol) =>\n\t\ttypeSymbol.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T &&\n\t\ttypeSymbol is INamedTypeSymbol namedType\n\t\t\t? namedType.TypeArguments[0]\n\t\t\t: typeSymbol;\n\n\tprivate static bool HasAttribute(ISymbol symbol, string attributeName) =>\n\t\tsymbol.GetAttributes().Any(a => a.AttributeClass?.Name == attributeName);\n\n\tprivate static string? GetXmlDocSummary(ISymbol symbol)\n\t{\n\t\tvar xml = symbol.GetDocumentationCommentXml();\n\t\tif (string.IsNullOrWhiteSpace(xml)) return null;\n\n\t\tvar summaryStart = xml!.IndexOf(\"\", StringComparison.Ordinal);\n\t\tvar summaryEnd = xml.IndexOf(\"\", StringComparison.Ordinal);\n\n\t\tif (summaryStart >= 0 && summaryEnd > summaryStart)\n\t\t{\n\t\t\tvar summaryText = xml.Substring(summaryStart + 9, summaryEnd - summaryStart - 9);\n\n\t\t\t// Normalise multi-line summaries: trim each line, discard blank lines,\n\t\t\t// then join into a single space-separated string.\n\t\t\tvar lines = summaryText\n\t\t\t\t.Split(['\\r', '\\n'], StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(l => l.Trim())\n\t\t\t\t.Where(l => l.Length > 0);\n\n\t\t\tvar joined = string.Join(\" \", lines);\n\t\t\treturn joined.Length > 0 ? joined : null;\n\t\t}\n\n\t\treturn null;\n\t}\n}", + "snippet": "if (char.IsLetterOrDigit(ch) || ch == '_')\n\t\t\t{\n\t\t\t\tsb.Append(ch);\n\t\t\t\tlastWasUnderscore = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (lastWasUnderscore) continue;\n\n\t\t\tsb.Append('_');\n\t\t\tlastWasUnderscore = true;\n\t\t}\n\n\t\treturn sb." + }, + { + "title": "src/JsonSchema.Generation/SourceGeneration/TypeInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/SourceGeneration/TypeInfo.cs#L1-L115", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/SourceGeneration/TypeInfo.cs", + "startLine": 1, + "endLine": 115, + "content": "using System.Collections.Generic;\nusing Json.Schema.Generation.Serialization;\nusing Microsoft.CodeAnalysis;\n\nnamespace Json.Schema.Generation.SourceGeneration;\n\ninternal sealed class TypeInfo\n{\n\tpublic required ITypeSymbol TypeSymbol { get; init; }\n\tpublic required string FullyQualifiedName { get; init; }\n\tpublic required string SchemaPropertyName { get; init; }\n\tpublic string? ResolvedPropertyName { get; set; }\n\tpublic required NamingConvention PropertyNaming { get; init; }\n\tpublic required PropertyOrder PropertyOrder { get; init; }\n\tpublic required bool StrictConditionals { get; init; }\n\tpublic required TypeKind Kind { get; init; }\n\tpublic required bool IsNullable { get; init; }\n\tpublic List Properties { get; init; } = new();\n\tpublic List EnumValues { get; init; } = new();\n\tpublic string? XmlDocSummary { get; init; }\n\tpublic List TypeAttributes { get; init; } = new();\n\tpublic List Conditionals { get; init; } = new();\n\tpublic List? ItemAttributes { get; init; }\n\tpublic List? PropertyAttributes { get; init; }\n}\n\ninternal sealed class PropertyInfo\n{\n\tpublic required string Name { get; init; }\n\tpublic required string SchemaName { get; init; }\n\tpublic required ITypeSymbol Type { get; init; }\n\tpublic required bool IsRequired { get; init; }\n\tpublic required bool IsNullable { get; init; }\n\tpublic required bool IsReadOnly { get; init; }\n\tpublic required bool IsWriteOnly { get; init; }\n\tpublic List Attributes { get; init; } = new();\n\tpublic string? XmlDocSummary { get; init; }\n\tpublic List ConditionGroups { get; init; } = new();\n}\n\ninternal sealed class AttributeInfo\n{\n\tpublic required string AttributeName { get; init; }\n\tpublic Dictionary Parameters { get; init; } = new();\n\tpublic bool IsCustomEmitter { get; init; }\n\tpublic string? AttributeFullName { get; init; }\n\tpublic List? ApplyMethodParameters { get; init; }\n}\n\ninternal sealed class ApplyParameterInfo\n{\n\tpublic required string Name { get; init; }\n\tpublic required string TypeName { get; init; }\n}\n\ninternal sealed class SchemaHandlerInfo\n{\n\tpublic required string HandlerTypeName { get; init; }\n\tpublic required string TargetTypeName { get; init; }\n\tpublic required bool IsOpenGenericTarget { get; init; }\n\tpublic required bool ReturnsBuilder { get; init; }\n}\n\ninternal enum TypeKind\n{\n\tUnknown,\n\tAny,\n\tDictionary,\n\tBoolean,\n\tInteger,\n\tNumber,\n\tString,\n\tDateTime,\n\tGuid,\n\tUri,\n\tEnum,\n\tArray,\n\tObject\n}\n\ninternal sealed class ConditionalInfo\n{\n\tpublic required object ConditionGroup { get; init; }\n\tpublic List Triggers { get; init; } = new();\n\tpublic List PropertyConsequences { get; init; } = new();\n}\n\ninternal sealed class ConditionalTrigger\n{\n\tpublic required ConditionalTriggerType Type { get; init; }\n\tpublic required string PropertyName { get; init; }\n\tpublic required string PropertySchemaName { get; init; }\n\tpublic string? ExpectedValue { get; init; }\n\tpublic double? NumericValue { get; init; }\n\tpublic bool IsExclusive { get; init; }\n}\n\ninternal enum ConditionalTriggerType\n{\n\tEquality,\n\tMinimum,\n\tMaximum,\n\tEnum\n}\n\ninternal sealed class PropertyConditionalConsequence\n{\n\tpublic required string PropertySchemaName { get; init; }\n\tpublic bool IsConditionallyRequired { get; init; }\n\tpublic bool IsConditionallyReadOnly { get; init; }\n\tpublic bool IsConditionallyWriteOnly { get; init; }\n\tpublic List ConditionalAttributes { get; init; } = new();\n}", + "snippet": "using System.Collections.Generic;\nusing Json.Schema.Generation.Serialization;\nusing Microsoft.CodeAnalysis;\n\nnamespace Json.Schema.Generation.SourceGeneration;\n\ninternal sealed class TypeInfo\n{\n\tpublic required ITypeSymb" + }, + { + "title": "src/JsonSchema.Generation/TypeExtensions.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/TypeExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/TypeExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Humanizer;\nusing Json.More;\n#pragma warning disable IL2075\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Provides informative methods for types.\n/// \npublic static class TypeExtensions\n{\n\t/// \n\t/// Determines whether the type is a simple, one-dimensional, non-keyed collection.\n\t/// \n\t/// The type.\n\t/// true if the type represents an array; false otherwise.\n\tpublic static bool IsArray(this Type type)\n\t{\n\t\treturn type != typeof(string) &&\n\t\t (type.IsArray ||\n\t\t type == typeof(Array) ||\n\t\t typeof(IEnumerable).IsAssignableFrom(type));\n\t}\n\n\tinternal static Type GetMemberType(this MemberInfo info) =>\n\t\tinfo switch\n\t\t{\n\t\t\tFieldInfo fieldInfo => fieldInfo.FieldType,\n\t\t\tPropertyInfo propertyInfo => propertyInfo.PropertyType,\n\t\t\t_ => throw new NotSupportedException($\"Cannot get type of {info.GetType()}\")\n\t\t};\n\n\tinternal static bool IsReadOnly(this MemberInfo info) =>\n\t\tinfo switch\n\t\t{\n\t\t\tFieldInfo fieldInfo => fieldInfo.IsInitOnly,\n\t\t\tPropertyInfo propertyInfo => !propertyInfo.CanWrite,\n\t\t\t_ => throw new NotSupportedException($\"Cannot get readability of {info.GetType()}\")\n\t\t};\n\n\tinternal static bool IsWriteOnly(this MemberInfo info) =>\n\t\tinfo switch\n\t\t{\n\t\t\tFieldInfo => false,\n\t\t\tPropertyInfo propertyInfo => !propertyInfo.CanRead,\n\t\t\t_ => throw new NotSupportedException($\"Cannot get writability of {info.GetType()}\")\n\t\t};\n\n\t// ReSharper disable once IdentifierTypo\n\tprivate static readonly Dictionary _keywordedTypes =\n\t\tnew()\n\t\t{\n\t\t\t[typeof(void)] = \"void\",\n\t\t\t[typeof(string)] = \"string\",\n\t\t\t[typeof(int)] = \"int\",\n\t\t\t[typeof(short)] = \"short\",\n\t\t\t[typeof(long)] = \"long\",\n\t\t\t[typeof(ulong)] = \"ulong\",\n\t\t\t[typeof(uint)] = \"uint\",\n\t\t\t[typeof(ushort)] = \"ushort\",\n\t\t\t[typeof(double)] = \"double\",\n\t\t\t[typeof(float)] = \"float\",\n\t\t\t[typeof(byte)] = \"byte\",\n\t\t\t[typeof(char)] = \"char\",\n\t\t\t[typeof(bool)] = \"bool\",\n\t\t};\n\n\tinternal static bool IsJsonType(this Type type) =>\n\t\t_keywordedTypes.ContainsKey(type) ||\n\t\ttype.IsSubclassOf(typeof(JsonNode));\n\n\tinternal static string CSharpName(this Type type, StringBuilder? sb = null)\n\t{\n\t\tif (_keywordedTypes.TryGetValue(type, out var keyword)) return keyword;\n\n\t\tsb ??= new StringBuilder();\n\t\tvar name = type.Name;\n\t\tif (!type.IsGenericType)\n\t\t{\n\t\t\tif (type is { IsNested: true, IsGenericParameter: false })\n\t\t\t\tname = $\"{type.DeclaringType!.CSharpName()}.{name}\";\n\t\t\treturn name;\n\t\t}\n\n\t\tif (type.GetGenericTypeDefinition() == typeof(Nullable<>)) return $\"{CSharpName(type.GetGenericArguments()[0])}?\";\n\n\t\tsb.Append(name[..name.IndexOf('`')]);\n\t\tsb.Append('<');\n\t\tsb.Append(string.Join(\", \", type.GetGenericArguments()\n\t\t\t.Select(x => CSharpName(x, sb))));\n\t\tsb.Append('>');\n\t\tname = sb.ToString();\n\n\t\tif (type.IsNested)\n\t\t\tname = $\"{type.DeclaringType!.CSharpName()}.{name}\";\n\n\t\treturn name;\n\t}\n\n\t/// \n\t/// Determines if the type is a nullable value type, i.e. .\n\t/// \n\t/// The type\n\t/// True if the type is ; false otherwise.\n\tpublic static bool IsNullableValueType(this Type type)\n\t{\n\t\treturn type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>);\n\t}\n\n\t/// \n\t/// Determines if the type is a nullable value type, i.e. .\n\t/// \n\t/// The type", + "snippet": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing System.Text.Json.Nodes;\nusing Humanizer;\nusing Json.More;\n#pragma warning dis" + }, + { + "title": "src/JsonSchema.Generation/TypeExtensions.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/TypeExtensions.cs#L121-L193", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/TypeExtensions.cs", + "startLine": 121, + "endLine": 193, + "content": "/// True if the type is ; false otherwise.\n\tpublic static bool IsNullableNumber(this Type type)\n\t{\n\t\treturn type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) &&\n\t\t\t type.GetGenericArguments()[0].IsNumber();\n\t}\n\n\tinternal static string GetDefName(this Type type) =>\n\t\tSchemaGeneratorConfiguration.Current.TypeNameGenerator?.GenerateName(type) ??\n\t\tGetName(type).Camelize();\n\n\tprivate static string GetName(Type type)\n\t{\n\t\tif (type.IsInteger()) return \"integer\";\n\t\tif (type.IsNumber()) return \"number\";\n\t\tif (type == typeof(string)) return \"string\";\n\t\tif (type == typeof(bool)) return \"boolean\";\n\t\tif (type.IsArray)\n\t\t{\n\t\t\tvar itemType = type.GetElementType();\n\t\t\treturn $\"array of {GetName(itemType!)}\";\n\t\t}\n\t\tif (type.IsGenericType &&\n\t\t typeof(IEnumerable<>).IsAssignableFrom(type.GetGenericTypeDefinition()) &&\n\t\t type.GenericTypeArguments.Length == 1)\n\t\t{\n\t\t\tvar itemType = type.GenericTypeArguments[0];\n\t\t\treturn $\"array of {GetName(itemType)}\";\n\t\t}\n\t\treturn GetFriendlyTypeName(type);\n\t}\n\n\tprivate static string GetFriendlyTypeName(Type type, StringBuilder? sb = null)\n\t{\n\t\tsb ??= new StringBuilder();\n\t\tvar name = type.Name;\n\t\tif (!type.IsGenericType)\n\t\t{\n\t\t\tif (type is { IsNested: true, IsGenericParameter: false })\n\t\t\t\tname = $\"{name} in {GetName(type.DeclaringType!)}\";\n\t\t\treturn name;\n\t\t}\n\n\t\tsb.Append(name[..name.IndexOf('`')]);\n\t\tsb.Append(\" of \");\n\t\tsb.Append(string.Join(\" and \", type.GetGenericArguments()\n\t\t\t.Select(x => GetFriendlyTypeName(x, sb))));\n\t\tname = sb.ToString();\n\n\t\tif (type.IsNested)\n\t\t\tname = $\"{name} in {GetName(type.DeclaringType!)}\";\n\n\t\treturn name;\n\t}\n\n\tinternal static bool IsMarkedAsNullable(this MemberInfo member)\n\t{\n#if NET8_0_OR_GREATER\n\t\tvar infoContext = member switch\n\t\t{\n\t\t\tPropertyInfo p => new NullabilityInfoContext().Create(p),\n\t\t\tFieldInfo f => new NullabilityInfoContext().Create(f),\n\t\t\t_ => null\n\t\t};\n\n\t\treturn infoContext?.WriteState is NullabilityState.Nullable;\n#else\n\t\treturn false;\n#endif\n\t}\n\n\tinternal static bool CanBeReferenced(this Type type) => !type.IsJsonType() && !type.IsNullableValueType();\n}", + "snippet": "/// True if the type is ; false otherwise.\n\tpublic static bool IsNullableNumber(this Type type)\n\t{\n\t\treturn type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Null" + }, + { + "title": "src/JsonSchema.Generation/TypeGenerationContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/TypeGenerationContext.cs#L1-L75", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/TypeGenerationContext.cs", + "startLine": 1, + "endLine": 75, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Reflection;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Provides a context for generating schemas for types.\n/// \n[DebuggerDisplay(\"{DebuggerDisplay}\")]\npublic class TypeGenerationContext : SchemaGenerationContextBase\n{\n\t/// \n\t/// The type.\n\t/// \n\tpublic override Type Type { get; }\n\n\t/// \n\t/// The number of times this context has been referenced.\n\t/// \n\tpublic List References { get; } = [];\n\n\tinternal string DefinitionName { get; }\n\n\tinternal IComparer DeclarationOrderComparer => field ??= MemberInfoMetadataTokenComparer.Get(Type);\n\n\tinternal TypeGenerationContext(Type type)\n\t{\n\t\tType = type;\n\t\tDebuggerDisplay = type.CSharpName();\n\t\tDefinitionName = type.GetDefName();\n\t}\n\n\tinternal override void GenerateIntents()\n\t{\n\t\tif (ReferenceEquals(this, True) || ReferenceEquals(this, False)) return;\n\n\t\tvar configuration = SchemaGeneratorConfiguration.Current;\n\n\t\tif (configuration.ExternalReferences.TryGetValue(Type, out var uri))\n\t\t\tIntents.Add(new RefIntent(uri) { IsExternalRef = true });\n\t\telse\n\t\t{\n\t\t\tvar runGenerator = true;\n\t\t\tif (!IsRoot)\n\t\t\t{\n\t\t\t\tvar idAttribute = Type.GetCustomAttributes().SingleOrDefault();\n\t\t\t\tif (idAttribute is not null)\n\t\t\t\t{\n\t\t\t\t\tIntents.Add(new RefIntent(idAttribute.Uri));\n\t\t\t\t\trunGenerator = false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (runGenerator)\n\t\t\t{\n\t\t\t\tvar generator = configuration.Generators.FirstOrDefault(x => x.Handles(Type)) ?? GeneratorRegistry.Get(Type);\n\t\t\t\tgenerator?.AddConstraints(this);\n\t\t\t}\n\t\t}\n\n\t\tAttributeHandler.HandleAttributes(this);\n\n\t\tvar refiners = configuration.Refiners.ToList();\n\t\tforeach (var refiner in refiners.Where(x => x.ShouldRun(this)))\n\t\t{\n\t\t\trefiner.Run(this);\n\t\t}\n\t}\n\n\tinternal bool IsSimpleRef() => Intents is [RefIntent { IsExternalRef: true }];\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Reflection;\nusing Json.Schema.Generation.Intents;\n\nnamespace Json.Schema.Generation;\n\n/// \n/// Provides a" + }, + { + "title": "src/JsonSchema.Generation/XmlComments/CommonComments.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/XmlComments/CommonComments.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/XmlComments/CommonComments.cs", + "startLine": 1, + "endLine": 23, + "content": "namespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Base class for comments classes\n/// \ninternal class CommonComments\n{\n\t/// \n\t/// \"summary\" comment\n\t/// \n\tpublic string? Summary { get; set; }\n\n\t/// \n\t/// \"remarks\" comment\n\t/// \n\tpublic string? Remarks { get; set; }\n\n\t/// \n\t/// \"example\" comment\n\t/// \n\tpublic string? Example { get; set; }\n}", + "snippet": "namespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Base class for comments classes\n/// \ninternal class CommonComments\n{\n\t/// \n\t/// \"summary\" comment\n\t/// \n\tpublic string" + }, + { + "title": "src/JsonSchema.Generation/XmlComments/DocXmlReader.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/XmlComments/DocXmlReader.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/XmlComments/DocXmlReader.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Reflection;\nusing System.Xml;\nusing System.Xml.XPath;\n\n#pragma warning disable RS1035 // Do not use APIs banned for analyzers - This class is only used in reflection-based schema generation, not in source generators\n\nnamespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Helper class that reads XML documentation generated by C# compiler from code comments.\n/// \npublic class DocXmlReader\n{\n\tprivate static readonly Dictionary _explicitXmlContent = [];\n\t\n\t/// \n\t/// Dictionary of XML navigators for multiple assemblies.\n\t/// \n\tprivate readonly ConcurrentDictionary _assemblyNavigators;\n\n\t/// \n\t/// Function that returns path to XML documentation file for specified assembly.\n\t/// \n\tprivate readonly Func _assemblyXmlPathFunction;\n\n\t/// \n\t/// Default value is true.\n\t/// When it is set to true DocXmlReader removes leading spaces and an empty\n\t/// lines at the end of the comment.\n\t/// By default XML comments are indented for human readability but it adds\n\t/// leading spaces that are not present in source code.\n\t/// For example here is compiler generated XML documentation with '-'\n\t/// showing spaces for readability.\n\t/// ----\n\t/// \n\t/// ----Text\n\t/// ----\n\t/// \n\t/// With UnIndentText set to true returned summary text is just \"Text\"\n\t/// With UnIndentText set to false returned summary text contains leading spaces\n\t/// and the trailing empty line \"\\n----Text\\n----\"\n\t/// \n\tprivate readonly bool _unIndentText;\n\n\t/// \n\t/// Open XML documentation files based on assemblies of types. Comment file names\n\t/// are generated based on assembly names by replacing assembly location with .xml.\n\t/// \n\t/// \n\t/// Function that returns path to the assembly XML comment file.\n\t/// If function is null then comments file is assumed to have the same file name as assembly.\n\t/// If function returns null or if comments file does not exist then all comments for types from that\n\t/// assembly would remain empty.\n\t/// \n\tinternal DocXmlReader(Func assemblyXmlPathFunction)\n\t{\n\t\t_assemblyNavigators = [];\n\t\t_unIndentText = true;\n\t\t_assemblyXmlPathFunction = assemblyXmlPathFunction;\n\t}\n\n\t/// \n\t/// \n\t/// \n\t[Obsolete(\"Use SchemaGeneratorConfiguration.RegisterXmlCommentFile() instead\")]\n\tpublic static void ExplicitlyAddAssemblyXml(Assembly assembly, string xmlContent)\n\t{\n\t\t_explicitXmlContent[assembly] = xmlContent;\n\t}\n\n\t/// \n\t/// \n\t/// \n\t[Obsolete(\"Do not use\")]\n\tpublic static void ExplictlyRemoveAssemblyXml(Assembly assembly)\n\t{\n\t\t_explicitXmlContent.Remove(assembly);\n\t}\n\n\t#region Public methods\n\n\t/// \n\t/// Returns comments for the class method. May return null object is comments for method\n\t/// are missing in XML documentation file.\n\t/// Returned comments tags:\n\t/// Summary, Remarks, Parameters (if present), Responses (if present), Returns\n\t/// \n\t/// \n\t/// Return null if comment for method is not available\n\t/// \n\tinternal MethodComments? GetMethodComments(MethodBase methodInfo, bool nullIfNoComment)\n\t{\n\t\tvar methodNode = GetXmlMemberNode(methodInfo.MethodId(), methodInfo.ReflectedType);\n\t\tif (nullIfNoComment && methodNode == null) return null;\n\t\tvar comments = new MethodComments();\n\t\treturn GetComments(comments, methodNode);\n\t}\n\n\tprivate MethodComments GetComments(MethodComments comments, XPathNavigator? node)\n\t{\n\t\tif (node == null) return comments;\n\n\t\tGetCommonComments(comments, node);\n\t\tcomments.Parameters = GetParametersComments(node);\n\t\tcomments.TypeParameters = GetNamedComments(node, _typeParamXPath, _nameAttribute);\n\t\tcomments.Returns = GetReturnsComment(node);\n\t\tcomments.Responses = GetNamedComments(node, _responsesXPath, _codeAttribute);\n\t\treturn comments;\n\t}\n\n\t/// \n\t/// Return Summary comments for specified type.\n\t/// For Delegate types Parameters field may be returned as well.\n\t/// \n\t/// \n\t/// TypeComment", + "snippet": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Reflection;\nusing System.Xml;\nusing System.Xml.XPath;\n\n#pragma warning disable RS1035 // Do not use APIs " + }, + { + "title": "src/JsonSchema.Generation/XmlComments/DocXmlReader.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/XmlComments/DocXmlReader.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/XmlComments/DocXmlReader.cs", + "startLine": 121, + "endLine": 240, + "content": "internal TypeComments GetTypeComments(Type type)\n\t{\n\t\tvar comments = new TypeComments();\n\t\tvar node = GetXmlMemberNode(type.TypeId(), type);\n\t\treturn GetComments(type, comments, node);\n\t}\n\n\tprivate TypeComments GetComments(Type type, TypeComments comments, XPathNavigator? node)\n\t{\n\t\tif (node == null) return comments;\n\t\tif (type.IsSubclassOf(typeof(Delegate)))\n\t\t{\n\t\t\tcomments.Parameters = GetParametersComments(node);\n\t\t\tcomments.Returns = GetReturnsComment(node);\n\t\t}\n\t\tGetCommonComments(comments, node);\n\t\treturn comments;\n\t}\n\n\t/// \n\t/// Returns comments for specified class member.\n\t/// \n\t/// \n\t/// \n\tinternal CommonComments GetMemberComments(MemberInfo memberInfo)\n\t{\n\t\tvar comments = new CommonComments();\n\t\tvar node = GetXmlMemberNode(memberInfo.MemberId(), memberInfo.ReflectedType);\n\t\treturn GetComments(comments, node);\n\t}\n\n\tprivate CommonComments GetComments(CommonComments comments, XPathNavigator? node)\n\t{\n\t\tif (node == null) return comments;\n\n\t\tGetCommonComments(comments, node);\n\t\treturn comments;\n\t}\n\n\t/// \n\t/// Get enum type description and comments for enum values. If \n\t/// is false and no comments exist for any value then ValueComments list is empty.\n\t/// \n\t/// \n\t/// Enum type to get comments for. If this is not an enum type then functions throws an\n\t/// ArgumentException\n\t/// \n\t/// \n\t/// True if ValueComments list should be filled even if\n\t/// none of the enum values have any summary comments\n\t/// \n\t/// EnumComment\n\tinternal EnumComments GetEnumComments(Type enumType, bool fillValues = false)\n\t{\n\t\tif (!enumType.IsEnum) throw new ArgumentException(nameof(enumType));\n\n\t\tvar comments = new EnumComments();\n\t\tvar typeNode = GetXmlMemberNode(enumType.TypeId(), enumType);\n\t\tif (typeNode != null) GetCommonComments(comments, typeNode);\n\n\t\tvar valueCommentsExist = false;\n\t\tforeach (var enumName in enumType.GetEnumNames())\n\t\t{\n\t\t\tvar valueNode = GetXmlMemberNode(enumType.EnumValueId(enumName), enumType);\n\t\t\tvalueCommentsExist |= valueNode != null;\n\t\t\tvar valueComment = new EnumValueComment(enumName, (int)Enum.Parse(enumType, enumName));\n\t\t\tcomments.ValueComments.Add(valueComment);\n\t\t\tGetCommonComments(valueComment, valueNode);\n\t\t}\n\n\t\tif (!valueCommentsExist && !fillValues) comments.ValueComments.Clear();\n\t\treturn comments;\n\t}\n\n\t#endregion\n\n\t#region XML items and atribute names\n\n\t// XPath strings and XML attribute names\n\tprivate const string _memberXPath = \"/doc/members/member[@name='{0}']\";\n\tprivate const string _summaryXPath = \"summary\";\n\tprivate const string _remarksXPath = \"remarks\";\n\tprivate const string _exampleXPath = \"example\";\n\tprivate const string _paramXPath = \"param\";\n\tprivate const string _typeParamXPath = \"typeparam\";\n\tprivate const string _responsesXPath = \"response\";\n\tprivate const string _returnsXPath = \"returns\";\n\n\t// XML attribute names\n\tprivate const string _nameAttribute = \"name\";\n\tprivate const string _codeAttribute = \"code\";\n\n\t#endregion\n\n\t#region XML helper functions\n\n\tprivate void GetCommonComments(CommonComments comments, XPathNavigator? rootNode)\n\t{\n\t\tcomments.Summary = GetSummaryComment(rootNode);\n\t\tcomments.Remarks = GetRemarksComment(rootNode);\n\t\tcomments.Example = GetExampleComment(rootNode);\n\t}\n\n\tprivate XPathNavigator? GetXmlMemberNode(string name, Type? typeForAssembly, bool searchAllCurrentFiles = false)\n\t{\n\t\tvar node = GetXmlMemberNodeFromDictionary(name, typeForAssembly);\n\t\tif (node != null ||\n\t\t\t!searchAllCurrentFiles ||\n\t\t\t_assemblyNavigators.Count <= 1 && typeForAssembly != null) return node;\n\t\tforeach (var docNavigator in _assemblyNavigators.Values)\n\t\t{\n\t\t\tnode = docNavigator?.SelectSingleNode(string.Format(_memberXPath, name));\n\t\t\tif (node != null) break;\n\t\t}\n\n\t\treturn node;\n\t}\n\n\tprivate XPathNavigator? GetXmlMemberNodeFromDictionary(string name, Type? typeForAssembly)\n\t{", + "snippet": "internal TypeComments GetTypeComments(Type type)\n\t{\n\t\tvar comments = new TypeComments();\n\t\tvar node = GetXmlMemberNode(type.TypeId(), type);\n\t\treturn GetComments(type, comments, node);\n\t}\n\n\tprivate TypeComments GetCommen" + }, + { + "title": "src/JsonSchema.Generation/XmlComments/DocXmlReader.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/XmlComments/DocXmlReader.cs#L241-L339", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/XmlComments/DocXmlReader.cs", + "startLine": 241, + "endLine": 339, + "content": "var typeNavigator = GetNavigatorForAssembly(typeForAssembly?.Assembly);\n\t\treturn typeNavigator?.SelectSingleNode(string.Format(_memberXPath, name));\n\t}\n\n\tprivate XPathNavigator? GetNavigatorForAssembly(Assembly? assembly)\n\t{\n\t\tif (assembly == null) return null;\n\t\tif (_assemblyNavigators.TryGetValue(assembly, out var typeNavigator)) return typeNavigator;\n\n\t\tif (!_explicitXmlContent.TryGetValue(assembly, out var response))\n\t\t{\n\t\t\tvar commentFileName = _assemblyXmlPathFunction(assembly);\n\t\t\tif (commentFileName == null)\n\t\t\t{\n\t\t\t\t_assemblyNavigators.TryAdd(assembly, null);\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tresponse = File.ReadAllText(commentFileName);\n\t\t}\n\t\tvar document = new XmlDocument();\n\t\tdocument.LoadXml(response);\n\t\tvar docNavigator = document.CreateNavigator();\n\t\tif (docNavigator == null) return null;\n\n\t\t_assemblyNavigators.TryAdd(assembly, docNavigator);\n\t\treturn docNavigator;\n\t}\n\n\tprivate string GetXmlText(XPathNavigator? node)\n\t{\n\t\tvar innerText = node?.InnerXml ?? \"\";\n\t\tif (!_unIndentText || string.IsNullOrEmpty(innerText)) return innerText;\n\n\t\tvar outerText = node?.OuterXml ?? \"\";\n\t\tvar indentText = FindIndent(outerText);\n\t\tif (string.IsNullOrEmpty(indentText)) return innerText;\n\t\treturn innerText.Replace(indentText, indentText[0].ToString()).Trim('\\r', '\\n');\n\t}\n\n\tprivate static string FindIndent(string? outerText)\n\t{\n\t\tif (string.IsNullOrEmpty(outerText)) return \"\";\n\t\tvar end = outerText!.LastIndexOf(\"= 0 && outerText[start] != '\\r' && outerText[start] != '\\n'; start--) ;\n\t\tif (start < 0 || end <= start) return \"\";\n\t\treturn outerText[start..end];\n\t}\n\n\n\tprivate string GetSummaryComment(XPathNavigator? rootNode)\n\t{\n\t\treturn GetXmlText(rootNode?.SelectSingleNode(_summaryXPath));\n\t}\n\n\tprivate string GetRemarksComment(XPathNavigator? rootNode)\n\t{\n\t\treturn GetXmlText(rootNode?.SelectSingleNode(_remarksXPath));\n\t}\n\n\tprivate string GetExampleComment(XPathNavigator? rootNode)\n\t{\n\t\treturn GetXmlText(rootNode?.SelectSingleNode(_exampleXPath));\n\t}\n\n\tprivate string GetReturnsComment(XPathNavigator? methodNode)\n\t{\n\t\tvar responseNodes = methodNode?.Select(_returnsXPath);\n\t\tif (responseNodes?.MoveNext() == true)\n\t\t\treturn GetXmlText(responseNodes.Current);\n\t\treturn \"\";\n\t}\n\n\tprivate List<(string Name, string Text)> GetParametersComments(XPathNavigator rootNode)\n\t{\n\t\treturn GetNamedComments(rootNode, _paramXPath, _nameAttribute);\n\t}\n\n\tprivate List<(string Name, string Text)> GetNamedComments(XPathNavigator rootNode, string path, string attributeName)\n\t{\n\t\tvar list = new List<(string Name, string Text)>();\n\t\tvar childNodes = rootNode.Select(path);\n\n\t\twhile (childNodes.MoveNext())\n\t\t{\n\t\t\tvar code = childNodes.Current?.GetAttribute(attributeName, \"\");\n\t\t\tif (code == null) continue;\n\t\t\tlist.Add((code, GetXmlText(childNodes.Current)));\n\t\t}\n\n\t\treturn list;\n\t}\n\n\t#endregion\n}", + "snippet": "var typeNavigator = GetNavigatorForAssembly(typeForAssembly?.Assembly);\n\t\treturn typeNavigator?.SelectSingleNode(string.Format(_memberXPath, name));\n\t}\n\n\tprivate XPathNavigator? GetNavigatorForAssembly(Assembly? assembly" + }, + { + "title": "src/JsonSchema.Generation/XmlComments/EnumComments.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/XmlComments/EnumComments.cs#L1-L19", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/XmlComments/EnumComments.cs", + "startLine": 1, + "endLine": 19, + "content": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Enum type comments\n/// \ninternal class EnumComments : CommonComments\n{\n\t/// \n\t/// \"summary\" comments of enum values. List contains names, values and\n\t/// comments for each enum value.\n\t/// If none of values have any summary comments then this list may be empty.\n\t/// If at least one value has summary comment then this list contains\n\t/// all enum values with empty comments for values without comments.\n\t/// \n\tpublic List ValueComments { get; set; } = [];\n}", + "snippet": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Enum type comments\n/// \ninternal class EnumComments : CommonComments\n{\n\t/// \n\t/// \"summary\" c" + }, + { + "title": "src/JsonSchema.Generation/XmlComments/EnumValueComment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/XmlComments/EnumValueComment.cs#L1-L33", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/XmlComments/EnumValueComment.cs", + "startLine": 1, + "endLine": 33, + "content": "namespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Comment of one enum value\n/// \ninternal class EnumValueComment : CommonComments\n{\n\tpublic EnumValueComment(string name, int value)\n\t{\n\t\tName = name;\n\t\tValue = value;\n\t}\n\n\t/// \n\t/// The name of the enum value\n\t/// \n\tpublic string Name { get; set; }\n\n\t/// \n\t/// Integer value of the enum\n\t/// \n\tpublic int Value { get; set; }\n\n\t/// \n\t/// Debugging-friendly text.\n\t/// \n\t/// \n\tpublic override string ToString()\n\t{\n\t\treturn $\"{Name ?? \"\"}={Value}\" + (Summary != null ? $\" {Summary}\" : \"\");\n\t}\n}", + "snippet": "namespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Comment of one enum value\n/// \ninternal class EnumValueComment : CommonComments\n{\n\tpublic EnumValueComment(string name, int value)\n\t{\n\t\tName " + }, + { + "title": "src/JsonSchema.Generation/XmlComments/InheritdocTag.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/XmlComments/InheritdocTag.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/XmlComments/InheritdocTag.cs", + "startLine": 1, + "endLine": 18, + "content": "namespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Inheritdoc tag with optional cref attribute.\n/// \ninternal class InheritdocTag\n{\n\tpublic InheritdocTag(string cref)\n\t{\n\t\tCref = cref;\n\t}\n\n\t/// \n\t/// Cref attribute value. This value is optional.\n\t/// \n\tpublic string Cref { get; set; }\n}", + "snippet": "namespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Inheritdoc tag with optional cref attribute.\n/// \ninternal class InheritdocTag\n{\n\tpublic InheritdocTag(string cref)\n\t{\n\t\tCref = cref;\n\t}\n\n\t//" + }, + { + "title": "src/JsonSchema.Generation/XmlComments/MethodComments.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/XmlComments/MethodComments.cs#L1-L36", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/XmlComments/MethodComments.cs", + "startLine": 1, + "endLine": 36, + "content": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Method, operator and constructor comments\n/// \ninternal class MethodComments : CommonComments\n{\n\t/// \n\t/// \"param\" comments of the method. Each item in the list is the tuple\n\t/// where Item1 is the \"name\" of the parameter in XML file and\n\t/// Item2 is the body of the comment.\n\t/// \n\tpublic List<(string Name, string Text)> Parameters { get; set; } = [];\n\n\t/// \n\t/// \"returns\" comment of the method.\n\t/// \n\tpublic string? Returns { get; set; }\n\n\t/// \n\t/// \"response\" comments of the method. The list contains tuples where\n\t/// Item1 is the \"code\" of the response and\n\t/// Item1 is the body of the comment.\n\t/// \n\tpublic List<(string Code, string Text)> Responses { get; set; } = [];\n\n\t/// \n\t/// \"typeparam\" comments of the method. Each item in the list is the tuple\n\t/// where Item1 is the \"name\" of the parameter in XML file and\n\t/// Item2 is the body of the comment.\n\t/// \n\tpublic List<(string Name, string Text)> TypeParameters { get; set; } = [];\n}", + "snippet": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Method, operator and constructor comments\n/// \ninternal class MethodComments : CommonComments\n{\n\t/// \n/// Class, Struct or delegate comments\n/// \ninternal class TypeComments : CommonComments\n{\n\t/// \n\t/// This list contains descriptions of delegate type parameters.\n\t/// For non-delegate types this list is empty.\n\t/// For delegate types this list contains tuples where\n\t/// Item1 is the \"param\" item \"name\" attribute and\n\t/// Item2 is the body of the comment\n\t/// \n\tpublic List<(string Name, string Text)> Parameters { get; set; } = [];\n\n\t/// \n\t/// \"returns\" comment of the method.\n\t/// \n\tpublic string? Returns { get; set; }\n}", + "snippet": "using System.Collections.Generic;\n\nnamespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Class, Struct or delegate comments\n/// \ninternal class TypeComments : CommonComments\n{\n\t/// \n\t//" + }, + { + "title": "src/JsonSchema.Generation/XmlComments/XmlDocId.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/XmlComments/XmlDocId.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/XmlComments/XmlDocId.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Generation.XmlComments;\n\n/// \n/// Class that constructs IDs for XML documentation comments.\n/// IDs uniquely identify comments in the XML documentation file.\n/// \ninternal static class XmlDocId\n{\n\t/// \n\t/// Type member XML ID prefix.\n\t/// \n\tprivate const char _memberPrefix = 'M';\n\n\t/// \n\t/// Field name XML ID prefix.\n\t/// \n\tprivate const char _fieldPrefix = 'F';\n\n\t/// \n\t/// Property name XML ID prefix.\n\t/// \n\tprivate const char _propertyPrefix = 'P';\n\n\t/// \n\t/// Event XML ID prefix.\n\t/// \n\tprivate const char _eventPrefix = 'E';\n\n\t/// \n\t/// Type name XML ID prefix.\n\t/// \n\tprivate const char _typePrefix = 'T';\n\n\t/// \n\t/// Part of the constructor XML tag in XML document.\n\t/// \n\tprivate const string _constructorNameId = \"#ctor\";\n\n\t/// \n\t/// Get XML Id of the type definition.\n\t/// \n\t/// \n\t/// \n\tpublic static string TypeId(this Type type)\n\t{\n\t\treturn _typePrefix + \":\" + GetTypeXmlId(type);\n\t}\n\n\t/// \n\t/// Get XML Id of a class method\n\t/// \n\t/// \n\t/// \n\tpublic static string MethodId(this MethodBase? methodInfo)\n\t{\n\t\tif (methodInfo == null) throw new ArgumentNullException(nameof(methodInfo));\n\t\treturn (IsIndexerProperty(methodInfo) ? _propertyPrefix : _memberPrefix) + \":\" +\n\t\t\t GetTypeXmlId(methodInfo.DeclaringType!) + \".\" +\n\t\t\t GetMethodXmlId(methodInfo);\n\t}\n\n\t/// \n\t/// Get XML Id of any member of the type.\n\t/// \n\t/// \n\t/// \n\tpublic static string MemberId(this MemberInfo memberInfo)\n\t{\n\t\tif (memberInfo == null) throw new ArgumentNullException(nameof(memberInfo));\n\t\tswitch (memberInfo.MemberType)\n\t\t{\n\t\t\tcase MemberTypes.Constructor:\n\t\t\tcase MemberTypes.Method:\n\t\t\t\treturn MethodId(memberInfo as MethodBase);\n\t\t\tcase MemberTypes.Property:\n\t\t\t\treturn PropertyId(memberInfo);\n\t\t\tcase MemberTypes.Field:\n\t\t\t\treturn FieldId(memberInfo);\n\t\t\tcase MemberTypes.NestedType:\n\t\t\t\treturn TypeId((Type)memberInfo);\n\t\t\tcase MemberTypes.Event:\n\t\t\t\treturn EventId(memberInfo);\n\t\t\t\t// case MemberTypes.TypeInfo:\n\t\t}\n\n\t\tthrow new NotSupportedException($\"{memberInfo.MemberType}\");\n\t}\n\n\t/// \n\t/// Get XML Id of property\n\t/// \n\t/// \n\t/// \n\tpublic static string PropertyId(this MemberInfo propertyInfo)\n\t{\n\t\tif (propertyInfo == null) throw new ArgumentNullException(nameof(propertyInfo));\n\t\tif ((propertyInfo.MemberType & MemberTypes.Property) == 0) throw new ArgumentException(nameof(propertyInfo));\n\n\t\tif (propertyInfo.Name == \"Item\")\n\t\t{\n\t\t\tvar getParameters = (propertyInfo as PropertyInfo)?.GetMethod?.GetParameters();\n\t\t\tif (getParameters?.Length > 0)\n\t\t\t\treturn _propertyPrefix + \":\" + GetTypeXmlId(propertyInfo.DeclaringType!) + \".\" +\n\t\t\t\t\t propertyInfo.Name +\n\t\t\t\t\t GetParametersXmlId(getParameters, GetGenericClassParams(propertyInfo));\n\n\t\t\tvar setParameters = (propertyInfo as PropertyInfo)?.SetMethod?.GetParameters();\n\t\t\tif (setParameters?.Length > 1)\n\t\t\t\treturn _propertyPrefix + \":\" + GetTypeXmlId(propertyInfo.DeclaringType!) + \".\" +\n\t\t\t\t\t propertyInfo.Name +\n\t\t\t\t\t GetParametersXmlId(setParameters.Take(setParameters.Length - 1), GetGenericClassParams(propertyInfo));\n\t\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Generation.XmlComments;\n\n/// \n/// C" + }, + { + "title": "src/JsonSchema.Generation/XmlComments/XmlDocId.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Generation/XmlComments/XmlDocId.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Generation/XmlComments/XmlDocId.cs", + "startLine": 121, + "endLine": 240, + "content": "return _propertyPrefix + \":\" + GetTypeXmlId(propertyInfo.DeclaringType!) + \".\" + propertyInfo.Name;\n\t}\n\n\t/// \n\t/// Get XML Id of field\n\t/// \n\t/// \n\t/// \n\tpublic static string FieldId(this MemberInfo fieldInfo)\n\t{\n\t\tif (fieldInfo == null) throw new ArgumentNullException(nameof(fieldInfo));\n\t\tif ((fieldInfo.MemberType & MemberTypes.Field) == 0) throw new ArgumentException(nameof(fieldInfo));\n\t\treturn _fieldPrefix + \":\" + GetTypeXmlId(fieldInfo.DeclaringType!) + \".\" + fieldInfo.Name;\n\t}\n\n\t/// \n\t/// Get XML Id of event field\n\t/// \n\t/// \n\t/// \n\tpublic static string EventId(this MemberInfo eventInfo)\n\t{\n\t\tif (eventInfo == null) throw new ArgumentNullException(nameof(eventInfo));\n\t\tif ((eventInfo.MemberType & MemberTypes.Event) == 0) throw new ArgumentException(nameof(eventInfo));\n\t\treturn _eventPrefix + \":\" + GetTypeXmlId(eventInfo.DeclaringType!) + \".\" + eventInfo.Name;\n\t}\n\n\t/// \n\t/// Get XML Id of specified value of the enum type.\n\t/// \n\t/// Enum type\n\t/// The name of the value without type and namespace\n\t/// \n\tpublic static string EnumValueId(this Type enumType, string enumName)\n\t{\n\t\tif (enumType == null) throw new ArgumentNullException(nameof(enumType));\n\t\tif (enumName == null) throw new ArgumentNullException(nameof(enumName));\n\t\tif (!enumType.IsEnum) throw new ArgumentException(nameof(enumType));\n\t\treturn _fieldPrefix + \":\" + GetTypeXmlId(enumType) + \".\" + enumName;\n\t}\n\n\t#region Non-public functions\n\n\t/// \n\t/// Gets the type's full name prepared for xml documentation format.\n\t/// \n\t/// The type.\n\t/// Whether the declaring member for this type is an out directional parameter.\n\t/// If the type is being used has a method parameter.\n\t/// The names of the generic class parameters from the parent type.\n\t/// The full name.\n\tprivate static string GetTypeXmlId(Type type, bool isOut = false, bool isMethodParameter = false, string[]? genericClassParams = null)\n\t{\n\t\t// Generic parameters of the class are referred to as `N where N is position of generic type.\n\t\t// Generic parameters of the method are referred to as ``N where N is position of generic type.\n\t\tif (type.IsGenericParameter) return $\"{GenericParamPrefix(type, genericClassParams)}{type.GenericParameterPosition}\";\n\n\t\tvar args = type.GetGenericArguments();\n\t\tstring fullTypeName;\n\t\tvar typeNamespace = type.Namespace == null ? \"\" : $\"{type.Namespace}\";\n\t\tvar outString = isOut ? \"@\" : \"\";\n\n\t\tif (type.MemberType == MemberTypes.TypeInfo &&\n\t\t\t!type.IsGenericTypeDefinition &&\n\t\t\t(type.IsGenericType || args.Length > 0) && (!type.IsClass || isMethodParameter))\n\t\t{\n\t\t\tvar paramString = string.Join(\",\",\n\t\t\t\targs.Select(o => GetTypeXmlId(o, false, isMethodParameter, genericClassParams)));\n\t\t\tvar typeName = Regex.Replace(type.Name, \"`[0-9]+\", \"{\" + paramString + \"}\");\n\t\t\tfullTypeName = $\"{typeNamespace}.{typeName}{outString}\";\n\t\t}\n\t\telse if (type.IsNested)\n\t\t{\n\t\t\tvar current = type;\n\t\t\tvar nestedStructure = string.Empty;\n\t\t\twhile (current!.IsNested)\n\t\t\t{\n\t\t\t\tnestedStructure = $\".{current.DeclaringType!.Name}{nestedStructure}\";\n\t\t\t\tcurrent = current.DeclaringType;\n\t\t\t}\n\t\t\tfullTypeName = $\"{typeNamespace}{nestedStructure}.{type.Name}{outString}\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfullTypeName = $\"{typeNamespace}.{type.Name}{outString}\";\n\t\t}\n\n\t\tfullTypeName = fullTypeName.Replace(\"&\", \"\");\n\n\t\t// Multi-dimensional arrays must have 0: for each dimension. Eg. [,,] has to become [0:,0:,0:]\n\t\twhile (fullTypeName.Contains(\"[,\"))\n\t\t{\n\t\t\tvar index = fullTypeName.IndexOf(\"[,\", StringComparison.Ordinal);\n\t\t\tvar lastIndex = fullTypeName.IndexOf(']', index);\n\t\t\tfullTypeName = fullTypeName[..(index + 1)] +\n\t\t\t\t\t\t string.Join(\",\", Enumerable.Repeat(\"0:\", lastIndex - index)) +\n\t\t\t\t\t\t fullTypeName[lastIndex..];\n\t\t}\n\n\t\treturn fullTypeName;\n\t}\n\n\t/// \n\t/// Get method element Id in XML document\n\t/// \n\t/// \n\t/// \n\tprivate static string GetMethodXmlId(MethodBase methodInfo)\n\t{\n\t\treturn $\"{ShortMethodName(methodInfo)}\" +\n\t\t\t GetParametersXmlId(methodInfo.GetParameters(), GetGenericClassParams(methodInfo)) +\n\t\t\t ExplicitImplicitPostfix(methodInfo);\n\t}\n\n\tprivate static string GetParametersXmlId(IEnumerable parameters, string[] genericClassParams)\n\t{\n\t\t// Calculate the parameter string as this is in the member name in the XML\n\t\tvar parameterStrings = parameters\n\t\t\t.Select(parameterInfo => GetTypeXmlId(\n\t\t\t\tparameterInfo.ParameterType,", + "snippet": "return _propertyPrefix + \":\" + GetTypeXmlId(propertyInfo.DeclaringType!) + \".\" + propertyInfo.Name;\n\t}\n\n\t/// \n\t/// Get XML Id of field\n\t/// \n\t/// \n\t/// 0 ? $\"({string.Join(\",\", parameterStrings)})\" : \"\";\n\t}\n\n\t/// \n\t/// Return true if this method is actually an indexer property.\n\t/// \n\t/// \n\t/// \n\tprivate static bool IsIndexerProperty(MethodBase methodInfo)\n\t{\n\t\treturn methodInfo.IsSpecialName && (methodInfo.Name == \"get_Item\" || methodInfo.Name == \"set_Item\");\n\t}\n\n\t/// \n\t/// Explicit/implicit operator may have return value appended to the name.\n\t/// \n\t/// \n\t/// \n\tprivate static string ExplicitImplicitPostfix(MethodBase methodInfo)\n\t{\n\t\tif (!methodInfo.IsSpecialName ||\n\t\t\tmethodInfo.Name != \"op_Explicit\" && methodInfo.Name != \"op_Implicit\") return \"\";\n\t\treturn \"~\" + GetTypeXmlId(((MethodInfo)methodInfo).ReturnType);\n\t}\n\n\t/// \n\t/// Get method name. Some methods have special names or like generic methods some extra information.\n\t/// \n\t/// \n\t/// \n\tprivate static string ShortMethodName(MethodBase methodInfo)\n\t{\n\t\tif (methodInfo.IsConstructor) return _constructorNameId;\n\t\treturn (IsIndexerProperty(methodInfo) ? \"Item\" : methodInfo.Name) +\n\t\t\t (methodInfo.IsGenericMethod ? \"``\" + methodInfo.GetGenericArguments().Length : \"\");\n\t}\n\n\tprivate static string[] GetGenericClassParams(MemberInfo info)\n\t{\n\t\treturn info.DeclaringType!.IsGenericType\n\t\t\t? info.DeclaringType.GetGenericArguments().Select(t => t.Name).ToArray()\n\t\t\t: [];\n\t}\n\n\tprivate static string GenericParamPrefix(Type type, string[]? genericClassParams)\n\t{\n\t\treturn genericClassParams != null && genericClassParams.Contains(type.Name) ? \"`\" : \"``\";\n\t}\n\n\t#endregion\n}", + "snippet": "parameterInfo.IsOut || parameterInfo.ParameterType.IsByRef,\n\t\t\t\ttrue,\n\t\t\t\tgenericClassParams))\n\t\t\t.ToList();\n\t\treturn parameterStrings.Count > 0 ? $\"({string.Join(\",\", parameterStrings)})\" : \"\";\n\t}\n\n\t/// \n\t/// " + }, + { + "title": "src/JsonSchema.OpenApi.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi.Tests/obj/Debug/net10.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/obj/Debug/net10.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/obj/Debug/net10.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.OpenApi.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi.Tests/obj/Debug/net8.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/obj/Debug/net8.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/obj/Debug/net8.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.OpenApi.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi.Tests/obj/Debug/net9.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/obj/Debug/net9.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/obj/Debug/net9.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.OpenApi.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi.Tests/obj/Release/net10.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/obj/Release/net10.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/obj/Release/net10.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.OpenApi.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi.Tests/obj/Release/net8.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/obj/Release/net8.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/obj/Release/net8.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.OpenApi.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi.Tests/obj/Release/net9.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/obj/Release/net9.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/obj/Release/net9.0/JsonSchema.OpenApi.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.OpenApi.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.OpenApi.Tests/OpenApiDoc.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/OpenApiDoc.cs#L1-L64", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/OpenApiDoc.cs", + "startLine": 1, + "endLine": 64, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.Path;\nusing Json.Pointer;\n\nnamespace Json.Schema.OpenApi.Tests;\n\n// OpenAPI.Net would need to set up their root document class to handle this.\n// This implementation is not optimal, but it seems to work.\n// Having a base URI is very important. The resolution system will break if one is not present.\n// If needed, generate one.\npublic class OpenApiDoc : IBaseDocument\n{\n\tprivate readonly JsonElement _definition;\n\tprivate readonly Dictionary _lookup = [];\n\n\t// implements IBaseDocument\n\tpublic Uri BaseUri { get; }\n\n\tpublic OpenApiDoc(Uri baseUri, JsonElement definition)\n\t{\n\t\t_definition = definition;\n\t\tBaseUri = baseUri;\n\n\t\t// Register this doc under the URI so that it's resolved when requested\n\t\tSchemaRegistry.Global.Register(this);\n\t}\n\n\t// implements IBaseDocument\n\tpublic JsonSchemaNode? FindSubschema(JsonPointer pointer, BuildContext context)\n\t{\n\t\tvar subschema = _lookup.GetValueOrDefault(pointer);\n\t\tif (subschema is null)\n\t\t{\n\t\t\tvar target = pointer.Evaluate(_definition);\n\t\t\tif (target is null) return null;\n\n#pragma warning disable CS0618 // Type or member is obsolete\n\t\t\tvar newContext = context with\n\t\t\t{\n\t\t\t\tLocalSchema = target.Value,\n\t\t\t\tBaseUri = BaseUri,\n\t\t\t\tPathFromResourceRoot = pointer\n\t\t\t};\n\t\t\tsubschema = JsonSchema.BuildNode(newContext);\n\t\t\tsubschema.PathFromResourceRoot = pointer;\n#pragma warning restore CS0618 // Type or member is obsolete\n\n\t\t\t_lookup[pointer] = subschema;\n\t\t}\n\n\t\treturn subschema;\n\t}\n\n\t// Paths are returned like: $['components']['schemas']\n\t// but we need pointers like /components/schemas to do lookups\n\tprivate static JsonPointer ConvertToPointer(JsonPath path) => \n\t\tJsonPointer.Parse(path.AsJsonPointer());\n\n\tprivate static JsonElement ConvertToElement(JsonNode? node) =>\n\t\tJsonSerializer.SerializeToElement(node, TestSerializationContext.Default.JsonNode!);\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.Path;\nusing Json.Pointer;\n\nnamespace Json.Schema.OpenApi.Tests;\n\n// OpenAPI.Net would need to set up their " + }, + { + "title": "src/JsonSchema.OpenApi.Tests/TestEnvironment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/TestEnvironment.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/TestEnvironment.cs", + "startLine": 1, + "endLine": 30, + "content": "using System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\n\nnamespace Json.Schema.OpenApi.Tests;\n\n[SetUpFixture]\npublic class TestEnvironment\n{\n\tpublic static readonly JsonSerializerOptions SerializerOptions =\n\t\tnew()\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializationContext.Default },\n\t\t\tWriteIndented = true,\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t\t};\n\n\t[OneTimeSetUp]\n\tpublic void Setup()\n\t{\n\t\tBuildOptions.Default.Dialect = Dialect.OpenApi_31;\n\t\tMetaSchemas.Register();\n\t\tEvaluationOptions.Default.OutputFormat = OutputFormat.Hierarchical;\n\t}\n}\n\n[JsonSerializable(typeof(JsonNode))]\ninternal partial class TestSerializationContext : JsonSerializerContext;", + "snippet": "using System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing NUnit.Framework;\n\nnamespace Json.Schema.OpenApi.Tests;\n\n[SetUpFixture]\npublic class TestE" + }, + { + "title": "src/JsonSchema.OpenApi.Tests/Tests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi.Tests/Tests.cs#L1-L103", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi.Tests/Tests.cs", + "startLine": 1, + "endLine": 103, + "content": "using System;\nusing System.Net.Http;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Schema.Tests;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.OpenApi.Tests;\n\npublic class SpecExampleTests\n{\n\t[Test]\n\tpublic void ConformanceTest()\n\t{\n\t\tvar onlineSchemaText = new HttpClient().GetStringAsync(MetaSchemas.DocumentSchema_31Id).Result;\n\t\tvar onlineSchemaJson = JsonDocument.Parse(onlineSchemaText).RootElement;\n\t\tvar onlineSchema = JsonSchema.Build(onlineSchemaJson, new BuildOptions{SchemaRegistry = new()});\n\n\t\tTestConsole.WriteLine(onlineSchema.Root.Source);\n\t\tTestConsole.WriteLine(MetaSchemas.DocumentSchema_31.Root.Source);\n\n\t\tAssert.That(() => onlineSchema.Root.Source.IsEquivalentTo(MetaSchemas.DocumentSchema_31.Root.Source));\n\t}\n\n\t[Test]\n\tpublic void DevTest()\n\t{\n\t\tvar openApiDocText =\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"openapi\": \"3.1.0\",\n\t\t\t \"info\": {\n\t\t\t \"title\": \"Webhook Example\",\n\t\t\t \"version\": \"1.0.0\"\n\t\t\t },\n\t\t\t \"webhooks\": {\n\t\t\t \"newPet\": {\n\t\t\t \"post\": {\n\t\t\t \"requestBody\": {\n\t\t\t \"description\": \"Information about a new pet in the system\",\n\t\t\t \"content\": {\n\t\t\t \"application/json\": {\n\t\t\t \"schema\": {\n\t\t\t \"$ref\": \"#/components/schemas/Pet\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t },\n\t\t\t \"responses\": {\n\t\t\t \"200\": {\n\t\t\t \"description\": \"Return a 200 status to indicate that the data was received successfully\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t },\n\t\t\t \"components\": {\n\t\t\t \"schemas\": {\n\t\t\t \"Pet\": {\n\t\t\t \"required\": [\n\t\t\t \"id\",\n\t\t\t \"name\"\n\t\t\t ],\n\t\t\t \"properties\": {\n\t\t\t \"id\": {\n\t\t\t \"type\": \"integer\",\n\t\t\t \"format\": \"int64\"\n\t\t\t },\n\t\t\t \"name\": {\n\t\t\t \"type\": \"string\"\n\t\t\t },\n\t\t\t \"tag\": {\n\t\t\t \"type\": \"string\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\n\t\t\t\"\"\";\n\n\t\tvar openApiDocNode = JsonDocument.Parse(openApiDocText).RootElement;\n\t\t_ = new OpenApiDoc(new Uri(\"http://localhost:1234/openapi\"), openApiDocNode);\n\t\tvar refSchema = new JsonSchemaBuilder()\n\t\t\t.Schema(Schema.MetaSchemas.Draft201909Id)\n\t\t\t.Ref(\"http://localhost:1234/openapi#/webhooks/newPet/post/requestBody/content/application~1json/schema\");\n\n\t\tvar payload = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t\t\"id\": 1,\n\t\t\t\t\"name\": \"fido\",\n\t\t\t\t\"tag\": \"a very good dog\"\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\n\t\tvar result = refSchema!.Evaluate(payload);\n\n\t\tresult.AssertValid();\n\t}\n}", + "snippet": "using System;\nusing System.Net.Http;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Schema.Tests;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.OpenApi.Tests;\n\npublic class SpecExampleTests\n{\n\t[Te" + }, + { + "title": "src/JsonSchema.OpenApi/Dialect.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/Dialect.cs#L1-L31", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/Dialect.cs", + "startLine": 1, + "endLine": 31, + "content": "using Json.Schema.OpenApi.Keywords;\n\nnamespace Json.Schema.OpenApi;\n\n/// \n/// Provides dialect definitions for OpenAPI 3.1 JSON Schema extensions.\n/// \n/// This class exposes constants and dialect configurations for the OpenAPI 3.1 dialect.\n/// It is intended for use when working with JSON Schema implementations that require OpenAPI vocabulary\n/// extensions. All members are static and thread-safe.\npublic static class Dialect\n{\n\t/// \n\t/// Provides the JSON Schema dialect definition for OpenAPI 3.1 with support for the OpenAPI-specific keywords.\n\t/// \n\t/// This dialect enables usage of the 'example', 'discriminator', 'externalDocs', and 'xml' keywords\n\t/// as defined in the OpenAPI 3.1 specification. Use this dialect when validating schemas that require these keywords.\n\t/// The dialect is configured with the appropriate meta-schema identifier and keyword support.\n\t// ReSharper disable once InconsistentNaming\n\tpublic static readonly Schema.Dialect OpenApi_31 =\n\t\tSchema.Dialect.Draft202012.With([\n\t\t\t\tExampleKeyword.Instance,\n\t\t\t\tDiscriminatorKeyword.Instance,\n\t\t\t\tExternalDocsKeyword.Instance,\n\t\t\t\tXmlKeyword.Instance\n\t\t\t],\n\t\t\tMetaSchemas.OpenApi_31Id,\n\t\t\tfalse,\n\t\t\ttrue);\n}", + "snippet": "using Json.Schema.OpenApi.Keywords;\n\nnamespace Json.Schema.OpenApi;\n\n/// \n/// Provides dialect definitions for OpenAPI 3.1 JSON Schema extensions.\n/// \n/// This class exposes constants and dia" + }, + { + "title": "src/JsonSchema.OpenApi/Formats.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/Formats.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/Formats.cs", + "startLine": 1, + "endLine": 24, + "content": "namespace Json.Schema.OpenApi;\n\n/// \n/// Defines formats used by the OpenAPI v3.1 specification.\n/// \npublic static class Formats\n{\n\t/// \n\t/// Defines the `media-range` custom format used by OpenAPI v3.1.\n\t/// \n\t/// \n\t/// Little is defined for this format except that it is intended to be a media\n\t/// type in line with RFC-7231 https://datatracker.ietf.org/doc/html/rfc7231#appendix-D.\n\t/// For more information, see https://github.com/OAI/OpenAPI-Specification/issues/2714.\n\t///\n\t/// This format carries no logic and will always pass validation.\n\t/// \n\tpublic static readonly Format MediaRange = new UnknownFormat(\"media-range\");\n\n\tstatic Formats()\n\t{\n\t\tFormatRegistry.Global.Register(MediaRange);\n\t}\n}", + "snippet": "namespace Json.Schema.OpenApi;\n\n/// \n/// Defines formats used by the OpenAPI v3.1 specification.\n/// \npublic static class Formats\n{\n\t/// \n\t/// Defines the `media-range` custom format used by O" + }, + { + "title": "src/JsonSchema.OpenApi/JsonSchemaBuilderExtensions.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/JsonSchemaBuilderExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/JsonSchemaBuilderExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.OpenApi;\n\n/// \n/// Provides a fluent interface for .\n/// \npublic static class JsonSchemaBuilderExtensions\n{\n\t/// \n\t/// Adds a `discriminator` keyword.\n\t/// \n\t/// The builder.\n\t/// The name of the property in the payload that will hold the discriminator value.\n\t/// An object to hold mappings between payload values and schema names or references.\n\t/// \n\t/// Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example,\n\t/// `x-internal-id`. Field names beginning `x-oai-` and `x-oas-` are reserved for uses defined by the OpenAPI Initiative.\n\t/// The value can be null, a primitive, an array or an object.\n\t/// \n\t/// The builder.\n\tpublic static JsonSchemaBuilder Discriminator(this JsonSchemaBuilder builder,\n\t\tstring propertyName,\n\t\tIReadOnlyDictionary? mapping = null,\n\t\tIReadOnlyDictionary? extensions = null)\n\t{\n\t\tvar obj = new JsonObject\n\t\t{\n\t\t\t[\"propertyName\"] = propertyName\n\t\t};\n\n\t\tif (mapping is not null)\n\t\t\tobj[\"mapping\"] = new JsonObject(mapping.ToDictionary(x => x.Key, x => (JsonNode?)x.Value));\n\n\t\tif (extensions is not null)\n\t\t{\n\t\t\tforeach (var extension in extensions)\n\t\t\t\tobj[extension.Key] = extension.Value;\n\t\t}\n\n\t\tbuilder.Add(\"discriminator\", obj);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Adds an `example` keyword.\n\t/// \n\t/// The builder.\n\t/// The example value.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Example(this JsonSchemaBuilder builder,\n\t\tJsonNode? value)\n\t{\n\t\tbuilder.Add(\"example\", value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Adds an `externalDocs` keyword.\n\t/// \n\t/// The builder.\n\t/// The URL for the target documentation. This MUST be in the form of a URL.\n\t/// A description of the target documentation. CommonMark syntax MAY be used for rich text representation.\n\t/// \n\t/// Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example,\n\t/// `x-internal-id`. Field names beginning `x-oai-` and `x-oas-` are reserved for uses defined by the OpenAPI Initiative.\n\t/// The value can be null, a primitive, an array or an object.\n\t/// \n\t/// The builder.\n\tpublic static JsonSchemaBuilder ExternalDocs(this JsonSchemaBuilder builder,\n\t\tUri url,\n\t\tstring? description = null,\n\t\tIReadOnlyDictionary? extensions = null)\n\t{\n\t\tvar obj = new JsonObject\n\t\t{\n\t\t\t[\"url\"] = url.OriginalString\n\t\t};\n\n\t\tif (description is not null)\n\t\t\tobj[\"description\"] = description;\n\n\t\tif (extensions is not null)\n\t\t{\n\t\t\tforeach (var extension in extensions)\n\t\t\t\tobj[extension.Key] = extension.Value;\n\t\t}\n\n\t\tbuilder.Add(\"externalDocs\", obj);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Adds an `xml` keyword to the schema.\n\t/// \n\t/// The builder.\n\t/// The URI of the namespace definition. This MUST be in the form of an absolute URI.\n\t/// Replaces the name of the element/attribute used for the described schema property.\n\t/// When defined within `items`, it will affect the name of the individual XML elements within the list.\n\t/// When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and\n\t/// only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored.\n\t/// The prefix to be used for the name.\n\t/// Declares whether the property definition translates to an attribute instead of an\n\t/// element. Default value is `false`.\n\t/// \n\t/// MAY be used only for an array definition. Signifies whether the array is wrapped (for example, ``)\n\t/// or unwrapped (``). Default value is `false`. The definition takes effect only when defined alongside `type`\n\t/// being `array` (outside the `items`).\n\t/// \n\t/// Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example,\n\t/// `x-internal-id`. Field names beginning `x-oai-` and `x-oas-` are reserved for uses defined by the OpenAPI Initiative.\n\t/// The value can be null, a primitive, an array or an object.\n\t/// \n\t/// The builder.\n\tpublic static JsonSchemaBuilder Xml(this JsonSchemaBuilder builder,\n\t\tUri? @namespace = null,\n\t\tstring? name = null,", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema.OpenApi;\n\n/// \n/// Provides a fluent interface for .\n/// ? extensions = null)\n\t{\n\t\tvar obj = new JsonObject();\n\n\t\tif (@namespace is not null)\n\t\t\tobj[\"namespace\"] = @namespace.OriginalString;\n\n\t\tif (name is not null)\n\t\t\tobj[\"name\"] = name;\n\n\t\tif (prefix is not null)\n\t\t\tobj[\"prefix\"] = prefix;\n\n\t\tif (attribute.HasValue)\n\t\t\tobj[\"attribute\"] = attribute.Value;\n\n\t\tif (wrapped.HasValue)\n\t\t\tobj[\"wrapped\"] = wrapped.Value;\n\n\t\tif (extensions is not null)\n\t\t{\n\t\t\tforeach (var extension in extensions)\n\t\t\t\tobj[extension.Key] = extension.Value;\n\t\t}\n\n\t\tbuilder.Add(\"xml\", obj);\n\t\treturn builder;\n\t}\n}", + "snippet": "string? prefix = null,\n\t\tbool? attribute = null,\n\t\tbool? wrapped = null,\n\t\tIReadOnlyDictionary? extensions = null)\n\t{\n\t\tvar obj = new JsonObject();\n\n\t\tif (@namespace is not null)\n\t\t\tobj[\"namespace\"] = " + }, + { + "title": "src/JsonSchema.OpenApi/JsonSchemaOpenApiSerializerContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/JsonSchemaOpenApiSerializerContext.cs#L1-L8", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/JsonSchemaOpenApiSerializerContext.cs", + "startLine": 1, + "endLine": 8, + "content": "using System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\n\nnamespace Json.Schema.OpenApi;\n\n[JsonSerializable(typeof(JsonNode))]\n[JsonSerializable(typeof(string))]\ninternal partial class JsonSchemaOpenApiSerializerContext : JsonSerializerContext;", + "snippet": "using System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\n\nnamespace Json.Schema.OpenApi;\n\n[JsonSerializable(typeof(JsonNode))]\n[JsonSerializable(typeof(string))]\ninternal partial class JsonSchemaOpenApiSeriali" + }, + { + "title": "src/JsonSchema.OpenApi/Keywords/DiscriminatorKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/Keywords/DiscriminatorKeyword.cs#L1-L79", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/Keywords/DiscriminatorKeyword.cs", + "startLine": 1, + "endLine": 79, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.OpenApi.Keywords;\n\n/// \n/// Handles `example`.\n/// \npublic class DiscriminatorKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static DiscriminatorKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"discriminator\";\n\n\tprivate DiscriminatorKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}\");\n\n\t\tif (!value.TryGetProperty(\"propertyName\", out var propertyNameElement))\n\t\t\tthrow new JsonSchemaException(\"'discriminator' requires a 'propertyName' property\");\n\n\t\tif (propertyNameElement.ValueKind != JsonValueKind.String)\n\t\t\tthrow new JsonSchemaException(\"'propertyName' must be a string\");\n\n\t\tif (value.TryGetProperty(\"mapping\", out var mappingElement))\n\t\t{\n\t\t\tif (mappingElement.ValueKind != JsonValueKind.Object)\n\t\t\t\tthrow new JsonSchemaException(\"'mapping' must be an object\");\n\n\t\t\tforeach (var prop in mappingElement.EnumerateObject())\n\t\t\t{\n\t\t\t\tif (prop.Value.ValueKind != JsonValueKind.String)\n\t\t\t\t\tthrow new JsonSchemaException(\"'mapping' values must be strings\");\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.OpenApi.Keywords;\n\n/// \n/// Handles `example`.\n/// \npublic class DiscriminatorKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance " + }, + { + "title": "src/JsonSchema.OpenApi/Keywords/ExampleKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/Keywords/ExampleKeyword.cs#L1-L60", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/Keywords/ExampleKeyword.cs", + "startLine": 1, + "endLine": 60, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.OpenApi.Keywords;\n\n/// \n/// Handles `example`.\n/// \npublic class ExampleKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ExampleKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"example\";\n\n\tprivate ExampleKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\t// 'example' can be any JSON value\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.OpenApi.Keywords;\n\n/// \n/// Handles `example`.\n/// \npublic class ExampleKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton i" + }, + { + "title": "src/JsonSchema.OpenApi/Keywords/ExternalDocsKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/Keywords/ExternalDocsKeyword.cs#L1-L74", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/Keywords/ExternalDocsKeyword.cs", + "startLine": 1, + "endLine": 74, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.OpenApi.Keywords;\n\n/// \n/// Handles `example`.\n/// \npublic class ExternalDocsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ExternalDocsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"externalDocs\";\n\n\tprivate ExternalDocsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}\");\n\n\t\tif (!value.TryGetProperty(\"url\", out var urlElement))\n\t\t\tthrow new JsonSchemaException(\"'externalDocs' requires a 'url' property\");\n\n\t\tif (urlElement.ValueKind != JsonValueKind.String)\n\t\t\tthrow new JsonSchemaException(\"'url' must be a string\");\n\n\t\tif (value.TryGetProperty(\"description\", out var descriptionElement))\n\t\t{\n\t\t\tif (descriptionElement.ValueKind != JsonValueKind.String)\n\t\t\t\tthrow new JsonSchemaException(\"'description' must be a string\");\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.OpenApi.Keywords;\n\n/// \n/// Handles `example`.\n/// \npublic class ExternalDocsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the single" + }, + { + "title": "src/JsonSchema.OpenApi/Keywords/XmlKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/Keywords/XmlKeyword.cs#L1-L91", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/Keywords/XmlKeyword.cs", + "startLine": 1, + "endLine": 91, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.OpenApi.Keywords;\n\n/// \n/// Handles `example`.\n/// \npublic class XmlKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static XmlKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"xml\";\n\n\tprivate XmlKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}\");\n\n\t\tif (value.TryGetProperty(\"name\", out var nameElement))\n\t\t{\n\t\t\tif (nameElement.ValueKind != JsonValueKind.String)\n\t\t\t\tthrow new JsonSchemaException(\"'name' must be a string\");\n\t\t}\n\n\t\tif (value.TryGetProperty(\"namespace\", out var namespaceElement))\n\t\t{\n\t\t\tif (namespaceElement.ValueKind != JsonValueKind.String)\n\t\t\t\tthrow new JsonSchemaException(\"'namespace' must be a string\");\n\t\t}\n\n\t\tif (value.TryGetProperty(\"prefix\", out var prefixElement))\n\t\t{\n\t\t\tif (prefixElement.ValueKind != JsonValueKind.String)\n\t\t\t\tthrow new JsonSchemaException(\"'prefix' must be a string\");\n\t\t}\n\n\t\tif (value.TryGetProperty(\"attribute\", out var attributeElement))\n\t\t{\n\t\t\tif (attributeElement.ValueKind is not (JsonValueKind.True or JsonValueKind.False))\n\t\t\t\tthrow new JsonSchemaException(\"'attribute' must be a boolean\");\n\t\t}\n\n\t\tif (value.TryGetProperty(\"wrapped\", out var wrappedElement))\n\t\t{\n\t\t\tif (wrappedElement.ValueKind is not (JsonValueKind.True or JsonValueKind.False))\n\t\t\t\tthrow new JsonSchemaException(\"'wrapped' must be a boolean\");\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.OpenApi.Keywords;\n\n/// \n/// Handles `example`.\n/// \npublic class XmlKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the \n/// Provides access to the OpenAPI vocabulary meta-schemas and methods for registering its components.\n/// \n/// Use this class to register and retrieve the meta-schemas required for working with the OpenAPI\n/// vocabulary in JSON Schema processing. All members are static and intended for application-wide\n/// configuration.\npublic static class MetaSchemas\n{\n\t/// \n\t/// The ID for the OpenAPI 3.1 dialect.\n\t/// \n\t// ReSharper disable once InconsistentNaming\n\tpublic static readonly Uri OpenApi_31Id = new(\"https://spec.openapis.org/oas/3.1/dialect/base\");\n\n\t/// \n\t/// The ID for the OpenAPI 3.1 vocabulary meta-schema.\n\t/// \n\t// ReSharper disable once InconsistentNaming\n\tpublic static readonly Uri OpenApiMeta_31Id = new(\"https://spec.openapis.org/oas/3.1/meta/base\");\n\n\t/// \n\t/// The ID for the OpenAPI 3.1 document schema.\n\t/// \n\t// ReSharper disable once InconsistentNaming\n\tpublic static readonly Uri DocumentSchema_31Id = new(\"https://spec.openapis.org/oas/3.1/schema/2022-02-27\");\n\n\t/// \n\t/// The OpenAPI 3.1 dialect meta-schema.\n\t/// \n\t// ReSharper disable once InconsistentNaming\n\tpublic static JsonSchema OpenApiDialect_31 { get; private set; } = null!;\n\n\t/// \n\t/// The OpenAPI 3.1 vocabulary meta-schema.\n\t/// \n\t// ReSharper disable once InconsistentNaming\n\tpublic static JsonSchema OpenApiMeta_31 { get; private set; } = null!;\n\n\t/// \n\t/// The OpenAPI 3.1 document schema.\n\t/// \n\t// ReSharper disable once InconsistentNaming\n\tpublic static JsonSchema DocumentSchema_31 { get; private set; } = null!;\n\n\t/// \n\t/// Registers all components required to use the OpenAPI vocabulary.\n\t/// \n\tpublic static void Register(BuildOptions? buildOptions = null)\n\t{\n\t\tbuildOptions ??= BuildOptions.Default;\n\n\t\tbuildOptions.DialectRegistry.Register(Dialect.OpenApi_31);\n\t\tbuildOptions.VocabularyRegistry.Register(Vocabulary.OpenApi_31);\n\n\t\tOpenApiDialect_31 = LoadMetaSchema(\"openapi-dialect-base\", buildOptions);\n\t\tOpenApiMeta_31 = LoadMetaSchema(\"openapi-meta-base\", buildOptions);\n\t\tDocumentSchema_31 = LoadMetaSchema(\"schema\", buildOptions);\n\t}\n\n\tprivate static JsonSchema LoadMetaSchema(string resourceName, BuildOptions buildOptions)\n\t{\n\t\tvar resources = typeof(MetaSchemas).Assembly.GetManifestResourceNames();\n\t\tvar resourceStream = typeof(MetaSchemas).Assembly.GetManifestResourceStream(@$\"Json.Schema.OpenApi.Meta_Schemas._3._1.{resourceName}.json\");\n\t\tusing var reader = new StreamReader(resourceStream!, Encoding.UTF8);\n\n\t\tvar text = reader.ReadToEnd();\n\t\tvar json = JsonDocument.Parse(text).RootElement;\n\n\t\treturn JsonSchema.Build(json, buildOptions);\n\t}\n}", + "snippet": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Text.Json;\n\nnamespace Json.Schema.OpenApi;\n\n/// \n/// Provides access to the OpenAPI vocabulary meta-schemas and methods for registering its componen" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Debug/net10.0/JsonSchema.OpenApi.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Debug/net10.0/JsonSchema.OpenApi.AssemblyInfo.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Debug/net10.0/JsonSchema.OpenApi.AssemblyInfo.cs", + "startLine": 1, + "endLine": 29, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to support OpenAPI v3.1\\'s JSON Schema vocabulary extension\" +\n \"\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Debug/net8.0/JsonSchema.OpenApi.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Debug/net8.0/JsonSchema.OpenApi.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Debug/net8.0/JsonSchema.OpenApi.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to support OpenAPI v3.1\\'s JSON Schema vocabulary extension\" +\n \"\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Debug/net9.0/JsonSchema.OpenApi.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Debug/net9.0/JsonSchema.OpenApi.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Debug/net9.0/JsonSchema.OpenApi.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to support OpenAPI v3.1\\'s JSON Schema vocabulary extension\" +\n \"\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Debug/netstandard2.0/JsonSchema.OpenApi.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Debug/netstandard2.0/JsonSchema.OpenApi.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Debug/netstandard2.0/JsonSchema.OpenApi.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to support OpenAPI v3.1\\'s JSON Schema vocabulary extension\" +\n \"\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.1+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Release/net10.0/JsonSchema.OpenApi.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Release/net10.0/JsonSchema.OpenApi.AssemblyInfo.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Release/net10.0/JsonSchema.OpenApi.AssemblyInfo.cs", + "startLine": 1, + "endLine": 29, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to support OpenAPI v3.1\\'s JSON Schema vocabulary extension\" +\n \"\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Release/net8.0/JsonSchema.OpenApi.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Release/net8.0/JsonSchema.OpenApi.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Release/net8.0/JsonSchema.OpenApi.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to support OpenAPI v3.1\\'s JSON Schema vocabulary extension\" +\n \"\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Release/net9.0/JsonSchema.OpenApi.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Release/net9.0/JsonSchema.OpenApi.AssemblyInfo.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Release/net9.0/JsonSchema.OpenApi.AssemblyInfo.cs", + "startLine": 1, + "endLine": 28, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to support OpenAPI v3.1\\'s JSON Schema vocabulary extension\" +\n \"\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema.OpenApi/obj/Release/netstandard2.0/JsonSchema.OpenApi.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/obj/Release/netstandard2.0/JsonSchema.OpenApi.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/obj/Release/netstandard2.0/JsonSchema.OpenApi.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyDescriptionAttribute(\"Extends JsonSchema.Net to support OpenAPI v3.1\\'s JSON Schema vocabulary extension\" +\n \"\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"5.0.1\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"5.0.1+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net.OpenApi\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"5.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.OpenApi/Vocabulary.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.OpenApi/Vocabulary.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.OpenApi/Vocabulary.cs", + "startLine": 1, + "endLine": 28, + "content": "using System;\nusing Json.Schema.OpenApi.Keywords;\n\nnamespace Json.Schema.OpenApi;\n\n/// \n/// Declares the vocabularies of the supported drafts.\n/// \npublic static class Vocabulary\n{\n\t/// \n\t/// The OpenAPI 3.1 vocabulary ID.\n\t/// \n\t// ReSharper disable once InconsistentNaming\n\tpublic static readonly Uri OpenApi_31Id = new(\"https://spec.openapis.org/oas/3.1/vocab/base\");\n\n\t/// \n\t/// The OpenAPI 3.1 vocabulary.\n\t/// \n\t// ReSharper disable once InconsistentNaming\n\tpublic static readonly Schema.Vocabulary OpenApi_31 =\n\t\tnew(OpenApi_31Id,\n\t\t\tExampleKeyword.Instance,\n\t\t\tDiscriminatorKeyword.Instance,\n\t\t\tExternalDocsKeyword.Instance,\n\t\t\tXmlKeyword.Instance);\n}", + "snippet": "using System;\nusing Json.Schema.OpenApi.Keywords;\n\nnamespace Json.Schema.OpenApi;\n\n/// \n/// Declares the vocabularies of the supported drafts.\n/// \npublic static class Vocabulary\n{\n\t/// \n\t/// " + }, + { + "title": "src/JsonSchema.Test.Api/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Test.Api/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Test.Api/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Test.Api/obj/Debug/net10.0/JsonSchema.Test.Api.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Test.Api/obj/Debug/net10.0/JsonSchema.Test.Api.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Test.Api/obj/Debug/net10.0/JsonSchema.Test.Api.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Test.Api\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+8b8ab34027de5ad9f4ed50808b8e4889ca69cf4d\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Test.Api\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Test.Api\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Test.Api/obj/Debug/net10.0/JsonSchema.Test.Api.GlobalUsings.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Test.Api/obj/Debug/net10.0/JsonSchema.Test.Api.GlobalUsings.g.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Test.Api/obj/Debug/net10.0/JsonSchema.Test.Api.GlobalUsings.g.cs", + "startLine": 1, + "endLine": 18, + "content": "// \nglobal using Microsoft.AspNetCore.Builder;\nglobal using Microsoft.AspNetCore.Hosting;\nglobal using Microsoft.AspNetCore.Http;\nglobal using Microsoft.AspNetCore.Routing;\nglobal using Microsoft.Extensions.Configuration;\nglobal using Microsoft.Extensions.DependencyInjection;\nglobal using Microsoft.Extensions.Hosting;\nglobal using Microsoft.Extensions.Logging;\nglobal using System;\nglobal using System.Collections.Generic;\nglobal using System.IO;\nglobal using System.Linq;\nglobal using System.Net.Http;\nglobal using System.Net.Http.Json;\nglobal using System.Threading;\nglobal using System.Threading.Tasks;", + "snippet": "// \nglobal using Microsoft.AspNetCore.Builder;\nglobal using Microsoft.AspNetCore.Hosting;\nglobal using Microsoft.AspNetCore.Http;\nglobal using Microsoft.AspNetCore.Routing;\nglobal using Microsoft.Extensi" + }, + { + "title": "src/JsonSchema.Tests/AnchorTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/AnchorTests.cs#L1-L106", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/AnchorTests.cs", + "startLine": 1, + "endLine": 106, + "content": "using System;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\npublic class AnchorTests\n{\n\t[TestCase(\"inner:colon\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestCase(\"under_score\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestCase(\"inner-hyphen\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestCase(\"inner.period\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestCase(\"start0123456789end\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestCase(\"_underscore\", \"https://json-schema.org/draft/2020-12/schema\")]\n\t[TestCase(\"under_score\", \"https://json-schema.org/draft/2020-12/schema\")]\n\t[TestCase(\"inner-hyphen\", \"https://json-schema.org/draft/2020-12/schema\")]\n\t[TestCase(\"inner.period\", \"https://json-schema.org/draft/2020-12/schema\")]\n\t[TestCase(\"start0123456789end\", \"https://json-schema.org/draft/2020-12/schema\")]\n\tpublic void ValidAnchor(string anchor, string metaSchemaUri)\n\t{\n\t\tvar schema = JsonSchema.FromText(\n\t\t\t$$\"\"\"\n\t\t\t {\n\t\t\t \"$schema\": \"{{metaSchemaUri}}\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"foo\": { \"$ref\": \"#{{anchor}}\" }\n\t\t\t },\n\t\t\t \"$defs\": {\n\t\t\t \"foo-def\": {\n\t\t\t \"$anchor\": \"{{anchor}}\",\n\t\t\t \"type\": \"string\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t \"\"\"\n\t\t);\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"{ \"foo\": \"value\" }\"\"\").RootElement;\n\n\t\tvar results = schema.Evaluate(instance);\n\n\t\tresults.AssertValid();\n\t}\n\n\t[TestCase(\"#foo\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestCase(\"0number\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestCase(\".period\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestCase(\"-hyphen\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestCase(\"_underscore\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestCase(\":colon\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestCase(\"/a/b\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestCase(\"#foo\", \"https://json-schema.org/draft/2020-12/schema\")]\n\t[TestCase(\".period\", \"https://json-schema.org/draft/2020-12/schema\")]\n\t[TestCase(\"-hyphen\", \"https://json-schema.org/draft/2020-12/schema\")]\n\t[TestCase(\":colon\", \"https://json-schema.org/draft/2020-12/schema\")]\n\t[TestCase(\"inner:colon\", \"https://json-schema.org/draft/2020-12/schema\")]\n\t[TestCase(\"/a/b\", \"https://json-schema.org/draft/2020-12/schema\")]\n\tpublic void InvalidAnchor(string anchor, string metaSchemaUri)\n\t{\n\t\tJsonSchema schema;\n\t\ttry\n\t\t{\n\t\t\tschema = JsonSchema.FromText(\n\t\t\t\t$$\"\"\"\n\t\t\t\t {\n\t\t\t\t \"$schema\": \"{{metaSchemaUri}}\",\n\t\t\t\t \"type\": \"object\",\n\t\t\t\t \"properties\": {\n\t\t\t\t \"foo\": { \"$ref\": \"#{{anchor}}\" }\n\t\t\t\t },\n\t\t\t\t \"$defs\": {\n\t\t\t\t \"foo-def\": {\n\t\t\t\t \"$anchor\": \"{{anchor}}\",\n\t\t\t\t \"type\": \"string\"\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t \"\"\"\n\t\t\t);\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tTestConsole.WriteLine(\"failed during deserialization\");\n\t\t\tTestConsole.WriteLine(e);\n\t\t\treturn;\n\t\t}\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"{ \"foo\": \"value\" }\"\"\").RootElement;\n\n\t\tEvaluationResults results;\n\t\ttry\n\t\t{\n\t\t\tresults = schema.Evaluate(instance);\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tTestConsole.WriteLine(\"failed during evaluation\");\n\t\t\tTestConsole.WriteLine(e);\n\t\t\treturn;\n\t\t}\n\n\t\tresults.AssertInvalid();\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\npublic class AnchorTests\n{\n\t[TestCase(\"inner:colon\", \"https://json-schema.org/draft/2019-09/schema\")]\n\t[TestC" + }, + { + "title": "src/JsonSchema.Tests/BaseDocumentTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/BaseDocumentTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/BaseDocumentTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class BaseDocumentTests\n{\n\t[Test]\n\tpublic void SchemasEmbeddedInJsonCanBeReferenced_Valid()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t};\n\n\t\tJsonSchema targetSchema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Integer);\n\n\t\tvar schemaAsText = JsonSerializer.Serialize(targetSchema, TestEnvironment.SerializerOptions);\n\n\t\tvar jsonText = $$\"\"\"\n\t\t\t\t\t\t {\n\t\t\t\t\t\t \"prop1\": \"foo\",\n\t\t\t\t\t\t \"prop2\": [\n\t\t\t\t\t\t \"bar\",\n\t\t\t\t\t\t {{schemaAsText}}\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t }\n\t\t\t\t\t\t \"\"\";\n\t\tvar json = JsonDocument.Parse(jsonText).RootElement;\n\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.List\n\t\t};\n\n\t\tvar jsonBaseDoc = new JsonElementBaseDocument(json, new Uri(\"http://localhost:1234/doc\"));\n\t\tbuildOptions.SchemaRegistry.Register(jsonBaseDoc);\n\n\t\tJsonSchema subjectSchema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Ref(\"http://localhost:1234/doc#/prop2/1\");\n\n\t\tvar instance = JsonDocument.Parse(\"42\").RootElement;\n\n\t\tvar result = subjectSchema.Evaluate(instance, options);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void SchemasEmbeddedInJsonCanBeReferenced_Invalid()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t};\n\n\t\tJsonSchema targetSchema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Integer);\n\n\t\tvar schemaAsText = JsonSerializer.Serialize(targetSchema, TestEnvironment.SerializerOptions);\n\n\t\tvar jsonText = $$\"\"\"\n\t\t\t\t\t\t {\n\t\t\t\t\t\t \"prop1\": \"foo\",\n\t\t\t\t\t\t \"prop2\": [\n\t\t\t\t\t\t \"bar\",\n\t\t\t\t\t\t {{schemaAsText}}\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t }\n\t\t\t\t\t\t \"\"\";\n\t\tvar json = JsonDocument.Parse(jsonText).RootElement;\n\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.List\n\t\t};\n\n\t\tvar jsonBaseDoc = new JsonElementBaseDocument(json, new Uri(\"http://localhost:1234/doc\"));\n\t\tbuildOptions.SchemaRegistry.Register(jsonBaseDoc);\n\n\t\tJsonSchema subjectSchema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Ref(\"http://localhost:1234/doc#/prop2/1\");\n\n\t\tvar instance = JsonDocument.Parse(\"\\\"baz\\\"\").RootElement;\n\n\t\tvar result = subjectSchema.Evaluate(instance, options);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void ReferencesFromWithinEmbeddedSchemas()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t};\n\n\t\tvar jsonText = \"\"\"\n\t\t {\n\t\t \"prop1\": \"foo\",\n\t\t \"prop2\": [\n\t\t \"bar\",\n\t\t {\n\t\t \"type\": \"integer\"\n\t\t }\n\t\t ],\n\t\t \"prop3\": {\n\t\t \"$ref\": \"#/prop2/1\"\n\t\t }\n\t\t }\n\t\t \"\"\";\n\t\tvar json = JsonDocument.Parse(jsonText).RootElement;\n\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.List\n\t\t};", + "snippet": "using System;\nusing System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class BaseDocumentTests\n{\n\t[Test]\n\tpublic void SchemasEmbeddedInJsonCanBeReferenced_Valid()\n\t{\n\t\tvar buildOptions = new B" + }, + { + "title": "src/JsonSchema.Tests/BaseDocumentTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/BaseDocumentTests.cs#L121-L231", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/BaseDocumentTests.cs", + "startLine": 121, + "endLine": 231, + "content": "var jsonBaseDoc = new JsonElementBaseDocument(json, new Uri(\"http://localhost:1234/doc\"));\n\t\tbuildOptions.SchemaRegistry.Register(jsonBaseDoc);\n\n\t\tJsonSchema subjectSchema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Ref(\"http://localhost:1234/doc#/prop3\");\n\n\t\tvar instance = JsonDocument.Parse(\"42\").RootElement;\n\n\t\tvar result = subjectSchema.Evaluate(instance, options);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void NestedReferencesFromWithinEmbeddedSchemas()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t};\n\n\t\tvar jsonText = \"\"\"\n\t\t {\n\t\t \"prop1\": \"foo\",\n\t\t \"prop2\": [\n\t\t \"bar\",\n\t\t {\n\t\t \"type\": \"integer\"\n\t\t }\n\t\t ],\n\t\t \"prop3\": {\n\t\t \"properties\": {\n\t\t \"data\": {\n\t\t \"$ref\": \"#/prop2/1\"\n\t\t }\n\t\t }\n\t\t }\n\t\t }\n\t\t \"\"\";\n\t\tvar json = JsonDocument.Parse(jsonText).RootElement;\n\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.List\n\t\t};\n\n\t\tvar jsonBaseDoc = new JsonElementBaseDocument(json, new Uri(\"http://localhost:1234/doc\"));\n\t\tbuildOptions.SchemaRegistry.Register(jsonBaseDoc);\n\n\t\tJsonSchema subjectSchema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Ref(\"http://localhost:1234/doc#/prop3\");\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"{ \"data\": 42 }\"\"\").RootElement;\n\n\t\tvar result = subjectSchema.Evaluate(instance, options);\n\n\t\tresult.AssertValid();\n\t}\n\n\t[Test]\n\t[Ignore(\"Maybe this isn't a valid thing to do?\")]\n\tpublic void ReferenceEmbeddedSchemaStartingWithOtherEmbeddedSchema()\n\t{\n\t\t// TODO: having an issue with this. Starting at /prop3 automatically generates\n\t\t// an ID for that subschema, causing the $ref to resolve to that subschema\n\t\t// location instead of the document root.\n\t\tvar jsonDocBaseUri = new Uri(\"http://localhost:1234/doc\");\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t};\n\n\t\tvar jsonText = \"\"\"\n\t\t {\n\t\t \"prop1\": \"foo\",\n\t\t \"prop2\": [\n\t\t \"bar\",\n\t\t {\n\t\t \"type\": \"integer\"\n\t\t }\n\t\t ],\n\t\t \"prop3\": {\n\t\t \"properties\": {\n\t\t \"data\": {\n\t\t \"$ref\": \"#/prop2/1\"\n\t\t }\n\t\t }\n\t\t }\n\t\t }\n\t\t \"\"\";\n\t\tvar json = JsonDocument.Parse(jsonText).RootElement;\n\t\tvar subjectSchemaJson = json.GetProperty(\"prop3\");\n\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.List\n\t\t};\n\n\t\tvar jsonBaseDoc = new JsonElementBaseDocument(json, jsonDocBaseUri);\n\t\tbuildOptions.SchemaRegistry.Register(jsonBaseDoc);\n\n\t\tvar subjectSchema = JsonSchema.Build(subjectSchemaJson, buildOptions, jsonDocBaseUri); // throws \n\n\t\tvar instance = JsonDocument.Parse(\"\"\"{ \"data\": 42 }\"\"\").RootElement;\n\n\t\tvar result = subjectSchema.Evaluate(instance, options);\n\n\t\tresult.AssertValid();\n\t}\n}", + "snippet": "var jsonBaseDoc = new JsonElementBaseDocument(json, new Uri(\"http://localhost:1234/doc\"));\n\t\tbuildOptions.SchemaRegistry.Register(jsonBaseDoc);\n\n\t\tJsonSchema subjectSchema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Ref(\"h" + }, + { + "title": "src/JsonSchema.Tests/BuilderExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/BuilderExtensions.cs#L1-L28", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/BuilderExtensions.cs", + "startLine": 1, + "endLine": 28, + "content": "using System;\nusing System.Globalization;\n\nnamespace Json.Schema.Tests;\n\npublic static class BuilderExtensions\n{\n\tpublic static JsonSchemaBuilder MinDate(this JsonSchemaBuilder builder, DateTime date)\n\t{\n\t\tvar dateString = date.ToString(\"yyyy-MM-dd'T'HH:mm:ss.FFFFFFFK\", CultureInfo.InvariantCulture);\n\t\tbuilder.Add(\"minDate\", dateString);\n\t\treturn builder;\n\t}\n\n\tpublic static JsonSchemaBuilder NonVocabMinDate(this JsonSchemaBuilder builder, DateTime date)\n\t{\n\t\tvar dateString = date.ToString(\"yyyy-MM-dd'T'HH:mm:ss.FFFFFFFK\", CultureInfo.InvariantCulture);\n\t\tbuilder.Add(\"minDate-nv\", dateString);\n\t\treturn builder;\n\t}\n\n\tpublic static JsonSchemaBuilder MaxDate(this JsonSchemaBuilder builder, DateTime date)\n\t{\n\t\tvar dateString = date.ToString(\"yyyy-MM-dd'T'HH:mm:ss.FFFFFFFK\", CultureInfo.InvariantCulture);\n\t\tbuilder.Add(\"maxDate\", dateString);\n\t\treturn builder;\n\t}\n}", + "snippet": "using System;\nusing System.Globalization;\n\nnamespace Json.Schema.Tests;\n\npublic static class BuilderExtensions\n{\n\tpublic static JsonSchemaBuilder MinDate(this JsonSchemaBuilder builder, DateTime date)\n\t{\n\t\tvar dateString" + }, + { + "title": "src/JsonSchema.Tests/BundleTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/BundleTests.cs#L1-L63", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/BundleTests.cs", + "startLine": 1, + "endLine": 63, + "content": "using System;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\npublic class BundleTests\n{\n [Test]\n public void CreateBundle_IncludesReferencedSchemasAndExcludesIndependent()\n {\n var buildOptions = new BuildOptions { SchemaRegistry = new() };\n var registry = buildOptions.SchemaRegistry;\n\n var aUri = new Uri(\"https://json-everything.test/bundle-ref-a\");\n var bUri = new Uri(\"https://json-everything.test/bundle-ref-b\");\n var rootUri = new Uri(\"https://json-everything.test/bundle-root\");\n var independentUri = new Uri(\"https://json-everything.test/bundle-independent\");\n var bundleUri = new Uri(\"https://json-everything.test/bundle\");\n\n _ = new JsonSchemaBuilder(buildOptions)\n .Schema(MetaSchemas.Draft202012Id)\n .Id(aUri)\n .Type(SchemaValueType.String)\n .Build();\n\n _ = new JsonSchemaBuilder(buildOptions)\n .Schema(MetaSchemas.Draft202012Id)\n .Id(bUri)\n .Type(SchemaValueType.Integer)\n .Build();\n\n _ = new JsonSchemaBuilder(buildOptions)\n .Schema(MetaSchemas.Draft202012Id)\n .Id(rootUri)\n .Properties(\n (\"a\", new JsonSchemaBuilder().Ref(aUri)),\n (\"b\", new JsonSchemaBuilder().Ref(bUri))\n )\n .Build();\n\n _ = new JsonSchemaBuilder(buildOptions)\n .Schema(MetaSchemas.Draft202012Id)\n .Id(independentUri)\n .Type(SchemaValueType.Object)\n .Build();\n\n var bundle = registry.CreateBundle(rootUri, bundleUri);\n\n Assert.That(bundle, Is.Not.Null);\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(bundle, TestEnvironment.TestOutputSerializerOptions));\n\n var defs = bundle!.Root.Source.GetProperty(\"$defs\");\n\n Assert.That(defs.TryGetProperty(rootUri.ToString(), out _), Is.True, \"Root schema should be in $defs\");\n Assert.That(defs.TryGetProperty(aUri.ToString(), out _), Is.True, \"Schema A should be in $defs\");\n Assert.That(defs.TryGetProperty(bUri.ToString(), out _), Is.True, \"Schema B should be in $defs\");\n Assert.That(defs.TryGetProperty(independentUri.ToString(), out _), Is.False, \"Independent schema should not be in $defs\");\n }\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\npublic class BundleTests\n{\n [Test]\n public void CreateBundle_IncludesReferencedSchemasAndExcludesIndepe" + }, + { + "title": "src/JsonSchema.Tests/CreationTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/CreationTests.cs#L1-L42", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/CreationTests.cs", + "startLine": 1, + "endLine": 42, + "content": "using System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class CreationTests\n{\n\t[Test]\n\tpublic void FromText()\n\t{\n\t\tvar schema = JsonSchema.FromText(\"{\\\"$id\\\":\\\"https://json-everything.test/FromText\\\",\\\"minimum\\\":5}\");\n\n\t\tvar results = schema.Evaluate(10.AsJsonElement());\n\n\t\tresults.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void FromTextIgnoringComments()\n\t{\n\t\tvar options = new JsonDocumentOptions\n\t\t{\n\t\t\tCommentHandling = JsonCommentHandling.Skip\n\t\t};\n\t\tvar schema = JsonSchema.FromText(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$id\":\"https://json-everything.test/FromTextIgnoringComments\",\n\t\t\t // comment here, just passing through\n\t\t\t \"minimum\":5\n\t\t\t}\n\t\t\t\"\"\", jsonOptions: options);\n\n\t\tusing var json = JsonDocument.Parse(\"10\");\n\n\t\tvar results = schema.Evaluate(json.RootElement);\n\n\t\tresults.AssertValid();\n\t}\n\n}", + "snippet": "using System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class CreationTests\n{\n\t[Test]\n\tpublic void FromText()\n\t{\n\t\tvar schema = JsonSchema.FromText(\"{\\\"$id\\\":\\\"https://json-e" + }, + { + "title": "src/JsonSchema.Tests/CrossDraftTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/CrossDraftTests.cs#L1-L86", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/CrossDraftTests.cs", + "startLine": 1, + "endLine": 86, + "content": "using System.Collections.Generic;\nusing System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class CrossDraftTests\n{\n\tpublic static IEnumerable ArrayItemsIsAllowedForDraft7Cases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(JsonDocument.Parse(\"\"\"{ \"foo\": [\"string\", 42] }\"\"\").RootElement, true);\n\t\t\tyield return new TestCaseData(JsonDocument.Parse(\"\"\"{ \"foo\": [\"string\", \"other string\"] }\"\"\").RootElement, false);\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(ArrayItemsIsAllowedForDraft7Cases))]\n\tpublic void ArrayItemsIsAllowedForDraft7(JsonElement instance, bool valid)\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t};\n\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Id(\"base\")\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", new JsonSchemaBuilder().Ref(\"foo\"))\n\t\t\t)\n\t\t\t.Defs(\n\t\t\t\t(\"foo-def\", new JsonSchemaBuilder()\n\t\t\t\t\t.Schema(MetaSchemas.Draft7Id)\n\t\t\t\t\t.Id(\"foo\")\n\t\t\t\t\t.Type(SchemaValueType.Array)\n\t\t\t\t\t.Items([\n\t\t\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.String),\n\t\t\t\t\t\tnew JsonSchemaBuilder().Type(SchemaValueType.Integer)\n\t\t\t\t\t])\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Build();\n\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t};\n\n\t\tvar result = schema.Evaluate(instance, options);\n\n\t\tif (valid)\n\t\t\tresult.AssertValid();\n\t\telse\n\t\t\tresult.AssertInvalid();\n\t}\n\n\t[TestCase(\"http://json-schema.org/draft-06/schema#\")]\n\t[TestCase(\"http://json-schema.org/draft-07/schema#\")]\n\tpublic void ContainsShouldIgnoreMinContainsForEarlierDrafts(string metaSchemaId)\n\t{\n\t\tvar dialect = metaSchemaId switch\n\t\t{\n\t\t\t\"http://json-schema.org/draft-06/schema#\" => Dialect.Draft06,\n\t\t\t\"http://json-schema.org/draft-07/schema#\" => Dialect.Draft07,\n\t\t\t_ => throw new System.ArgumentOutOfRangeException(nameof(metaSchemaId), metaSchemaId, null)\n\t\t};\n\t\tvar buildOptions = new BuildOptions { Dialect = dialect };\n\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Type(SchemaValueType.Array)\n\t\t\t.Items(new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t)\n\t\t\t.Contains(new JsonSchemaBuilder().Const(4))\n\t\t\t// Introduced with Draft 2019-09\n\t\t\t.MinContains(2);\n\n\t\tvar instance = JsonDocument.Parse(\"[2, 3, 4, 5]\").RootElement;\n\n\t\tvar results = schema.Evaluate(instance);\n\n\t\tresults.AssertValid();\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class CrossDraftTests\n{\n\tpublic static IEnumerable ArrayItemsIsAllowedForDraft7Cases\n\t{" + }, + { + "title": "src/JsonSchema.Tests/CustomDialectTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/CustomDialectTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/CustomDialectTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Globalization;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\n/// \n/// Tests that verify custom keywords can be implemented and added into a dialect.\n/// \npublic class CustomDialectTests\n{\n\tpublic class MinDateKeyword : IKeywordHandler\n\t{\n\t\tpublic static readonly MinDateKeyword Instance = new();\n\n\t\tpublic string Name => \"minDate\";\n\n\t\tprivate MinDateKeyword()\n\t\t{\n\t\t}\n\n\t\tpublic object? ValidateKeywordValue(JsonElement value)\n\t\t{\n\t\t\tif (value.ValueKind is not JsonValueKind.String)\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\t\treturn DateTime.Parse(value.GetString()!, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);\n\t\t}\n\n\t\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t\t{\n\t\t}\n\n\t\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t\t{\n\t\t\tif (context.Instance.ValueKind is not JsonValueKind.String) return KeywordEvaluation.Ignore;\n\n\t\t\tvar dateString = context.Instance.GetString();\n\t\t\tvar date = DateTime.Parse(dateString!, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);\n\t\t\tvar expectedDate = (DateTime)keyword.Value!;\n\n\t\t\tif (date < expectedDate)\n\t\t\t{\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false,\n\t\t\t\t\tError = $\"Date must be on or after {expectedDate:O}\"\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\t\t}\n\t}\n\n\tpublic class Draft4ExclusiveMinimumKeyword : IKeywordHandler\n\t{\n\t\tpublic static readonly Draft4ExclusiveMinimumKeyword Instance = new();\n\n\t\tpublic string Name => \"exclusiveMinimum\";\n\n\t\tprivate Draft4ExclusiveMinimumKeyword()\n\t\t{\n\t\t}\n\n\t\tpublic object? ValidateKeywordValue(JsonElement value)\n\t\t{\n\t\t\tif (value.ValueKind is not (JsonValueKind.True or JsonValueKind.False))\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a boolean, found {value.ValueKind}\");\n\n\t\t\treturn value.GetBoolean();\n\t\t}\n\n\t\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t\t{\n\t\t\t// Store the minimum value if present in sibling keywords\n\t\t\tif (context.LocalSchema.TryGetProperty(\"minimum\", out var minimumValue))\n\t\t\t{\n\t\t\t\tkeyword.Value = ((bool)keyword.Value!, minimumValue);\n\t\t\t}\n\t\t}\n\n\t\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t\t{\n\t\t\tif (context.Instance.ValueKind is not JsonValueKind.Number) return KeywordEvaluation.Ignore;\n\n\t\t\tvar (isExclusive, minimum) = ((bool, JsonElement))keyword.Value!;\n\t\t\tif (!isExclusive)\n\t\t\t{\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = true\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tvar comparison = JsonMath.NumberCompare(context.Instance, minimum);\n\t\t\tif (comparison == 0)\n\t\t\t{\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false,\n\t\t\t\t\tError = \"minimum is exclusive\"\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\t\t}\n\t}", + "snippet": "using System;\nusing System.Globalization;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\n/// \n/// Tests that verify custom keywords can be implemented and added " + }, + { + "title": "src/JsonSchema.Tests/CustomDialectTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/CustomDialectTests.cs#L121-L236", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/CustomDialectTests.cs", + "startLine": 121, + "endLine": 236, + "content": "[Test]\n\tpublic void CustomKeywordInDialect_ValidatesCorrectly()\n\t{\n\t\tvar customDialect = Dialect.Draft201909.With([MinDateKeyword.Instance]);\n\t\tvar buildOptions = new BuildOptions { Dialect = customDialect };\n\n\t\tvar futureDate = DateTime.UtcNow.AddDays(1);\n\t\tvar builder = new JsonSchemaBuilder(buildOptions);\n\t\tbuilder.Add(\"minDate\", futureDate.ToString(\"yyyy-MM-dd'T'HH:mm:ss.FFFFFFFK\", CultureInfo.InvariantCulture));\n\t\tvar schema = builder.Build();\n\n\t\tvar validInstance = JsonDocument.Parse($\"\\\"{DateTime.UtcNow.AddDays(2):O}\\\"\").RootElement;\n\t\tvar invalidInstance = JsonDocument.Parse($\"\\\"{DateTime.UtcNow:O}\\\"\").RootElement;\n\n\t\tvar validResult = schema.Evaluate(validInstance);\n\t\tvar invalidResult = schema.Evaluate(invalidInstance);\n\n\t\tvalidResult.AssertValid();\n\t\tinvalidResult.AssertInvalid();\n\t}\n\n\t[TestCase(3, false)]\n\t[TestCase(8, true)]\n\t[TestCase(5, false)]\n\t[TestCase(5.1, true)]\n\tpublic void Draft4ExclusiveMinimum_CustomDialect(decimal instanceValue, bool isValid)\n\t{\n\t\tvar draft4Dialect = Dialect.Draft202012.With([Draft4ExclusiveMinimumKeyword.Instance]);\n\n\t\tvar schemaText = \"\"\"\n\t\t {\n\t\t \t\"minimum\": 5,\n\t\t \t\"exclusiveMinimum\": true\n\t\t }\n\t\t \"\"\";\n\t\tvar schema = JsonSchema.FromText(schemaText, new BuildOptions { Dialect = draft4Dialect });\n\n\t\tvar instance = JsonDocument.Parse(instanceValue.ToString(CultureInfo.InvariantCulture)).RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\n\t\tAssert.That(result.IsValid, Is.EqualTo(isValid));\n\t}\n\n\t[Test]\n\tpublic void MultipleCustomKeywords_InSameDialect()\n\t{\n\t\tvar maxDateKeyword = new MaxDateKeyword();\n\t\tvar customDialect = Dialect.Draft201909.With([MinDateKeyword.Instance, maxDateKeyword]);\n\t\tvar buildOptions = new BuildOptions { Dialect = customDialect };\n\n\t\tvar minDate = DateTime.UtcNow;\n\t\tvar maxDate = DateTime.UtcNow.AddDays(10);\n\n\t\tvar builder = new JsonSchemaBuilder(buildOptions);\n\t\tbuilder.Add(\"minDate\", minDate.ToString(\"yyyy-MM-dd'T'HH:mm:ss.FFFFFFFK\", CultureInfo.InvariantCulture));\n\t\tbuilder.Add(\"maxDate\", maxDate.ToString(\"yyyy-MM-dd'T'HH:mm:ss.FFFFFFFK\", CultureInfo.InvariantCulture));\n\t\tvar schema = builder.Build();\n\n\t\tvar validInstance = JsonDocument.Parse($\"\\\"{DateTime.UtcNow.AddDays(5):O}\\\"\").RootElement;\n\t\tvar tooEarlyInstance = JsonDocument.Parse($\"\\\"{DateTime.UtcNow.AddDays(-1):O}\\\"\").RootElement;\n\t\tvar tooLateInstance = JsonDocument.Parse($\"\\\"{DateTime.UtcNow.AddDays(11):O}\\\"\").RootElement;\n\n\t\tvar validResult = schema.Evaluate(validInstance);\n\t\tvar tooEarlyResult = schema.Evaluate(tooEarlyInstance);\n\t\tvar tooLateResult = schema.Evaluate(tooLateInstance);\n\n\t\tvalidResult.AssertValid();\n\t\ttooEarlyResult.AssertInvalid();\n\t\ttooLateResult.AssertInvalid();\n\t}\n\n\tprivate class MaxDateKeyword : IKeywordHandler\n\t{\n\t\tpublic string Name => \"maxDate\";\n\n\t\tpublic object? ValidateKeywordValue(JsonElement value)\n\t\t{\n\t\t\tif (value.ValueKind is not JsonValueKind.String)\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\t\treturn DateTime.Parse(value.GetString()!, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);\n\t\t}\n\n\t\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t\t{\n\t\t}\n\n\t\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t\t{\n\t\t\tif (context.Instance.ValueKind is not JsonValueKind.String) return KeywordEvaluation.Ignore;\n\n\t\t\tvar dateString = context.Instance.GetString();\n\t\t\tvar date = DateTime.Parse(dateString!, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);\n\t\t\tvar expectedDate = (DateTime)keyword.Value!;\n\n\t\t\tif (date > expectedDate)\n\t\t\t{\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false,\n\t\t\t\t\tError = $\"Date must be on or before {expectedDate:O}\"\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\t\t}\n\t}\n}", + "snippet": "[Test]\n\tpublic void CustomKeywordInDialect_ValidatesCorrectly()\n\t{\n\t\tvar customDialect = Dialect.Draft201909.With([MinDateKeyword.Instance]);\n\t\tvar buildOptions = new BuildOptions { Dialect = customDialect };\n\n\t\tvar futu" + }, + { + "title": "src/JsonSchema.Tests/DevTest.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/DevTest.cs#L1-L11", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/DevTest.cs", + "startLine": 1, + "endLine": 11, + "content": "using NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class DevTest\n{\n\t[Test]\n\tpublic void Test()\n\t{\n\t}\n}", + "snippet": "using NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class DevTest\n{\n\t[Test]\n\tpublic void Test()\n\t{\n\t}\n}" + }, + { + "title": "src/JsonSchema.Tests/FetchTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/FetchTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/FetchTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class FetchTests\n{\n\t[Test]\n\tpublic void LocalRegistryFindsRef()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new SchemaRegistry\n\t\t\t{\n\t\t\t\tFetch = (uri, registry) =>\n\t\t\t\t{\n\t\t\t\t\tif (uri.AbsoluteUri == \"https://json-everything.test/LocalRegistryFindsRef\")\n\t\t\t\t\t\treturn JsonSchema.FromText(\"{\\\"type\\\": \\\"string\\\"}\", new BuildOptions { SchemaRegistry = registry });\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tvar schema = JsonSchema.FromText(\"{\\\"$ref\\\":\\\"https://json-everything.test/LocalRegistryFindsRef\\\"}\", buildOptions);\n\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t};\n\n\t\tusing var json = JsonDocument.Parse(\"10\");\n\n\t\tvar results = schema.Evaluate(json.RootElement, options);\n\n\t\tresults.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void GlobalRegistryFindsRef()\n\t{\n\t\ttry\n\t\t{\n\t\t\tSchemaRegistry.Global.Fetch = (uri, registry) =>\n\t\t\t{\n\t\t\t\tif (uri.AbsoluteUri == \"https://json-everything.test/GlobalRegistryFindsRef\")\n\t\t\t\t\treturn JsonSchema.FromText(\"{\\\"type\\\": \\\"string\\\"}\", new BuildOptions { SchemaRegistry = registry });\n\t\t\t\treturn null;\n\t\t\t};\n\n\t\t\tvar buildOptions = new BuildOptions\n\t\t\t{\n\t\t\t\tSchemaRegistry = SchemaRegistry.Global\n\t\t\t};\n\t\t\tvar schema = JsonSchema.FromText(\"{\\\"$ref\\\":\\\"https://json-everything.test/GlobalRegistryFindsRef\\\"}\", buildOptions);\n\n\t\t\tvar options = new EvaluationOptions\n\t\t\t{\n\t\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t\t};\n\n\t\t\tusing var json = JsonDocument.Parse(\"10\");\n\n\t\t\tvar results = schema.Evaluate(json.RootElement, options);\n\n\t\t\tresults.AssertInvalid();\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tSchemaRegistry.Global.Fetch = null!;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void LocalRegistryMissesRef()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new SchemaRegistry\n\t\t\t{\n\t\t\t\tFetch = (uri, registry) =>\n\t\t\t\t{\n\t\t\t\t\tif (uri.AbsoluteUri == \"https://json-everything.test/LocalRegistryMissesRef2\")\n\t\t\t\t\t\treturn JsonSchema.FromText(\"{\\\"type\\\": \\\"string\\\"}\", new BuildOptions { SchemaRegistry = registry });\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tvar schema = JsonSchema.FromText(\"{\\\"$ref\\\":\\\"https://json-everything.test/LocalRegistryMissesRef1\\\"}\", buildOptions);\n\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t};\n\n\t\tusing var json = JsonDocument.Parse(\"10\");\n\n\t\tAssert.Throws(() => schema.Evaluate(json.RootElement, options));\n\t}\n\n\t[Test]\n\tpublic void GlobalRegistryMissesRef()\n\t{\n\t\ttry\n\t\t{\n\t\t\tSchemaRegistry.Global.Fetch = (uri, registry) =>\n\t\t\t{\n\t\t\t\tif (uri.AbsoluteUri == \"https://json-everything.test/GlobalRegistryMissesRef2\")\n\t\t\t\t\treturn JsonSchema.FromText(\"{\\\"type\\\": \\\"string\\\"}\", new BuildOptions { SchemaRegistry = registry });\n\t\t\t\treturn null;\n\t\t\t};\n\t\t\tvar schema = JsonSchema.FromText(\"{\\\"$ref\\\":\\\"https://json-everything.test/GlobalRegistryMissesRef1\\\"}\");\n\n\t\t\tvar options = new EvaluationOptions\n\t\t\t{\n\t\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t\t};\n\n\t\t\tusing var json = JsonDocument.Parse(\"10\");\n\n\t\t\tAssert.Throws(() => schema.Evaluate(json.RootElement, options));\n\t\t}", + "snippet": "using System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class FetchTests\n{\n\t[Test]\n\tpublic void LocalRegistryFindsRef()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new Sc" + }, + { + "title": "src/JsonSchema.Tests/FetchTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/FetchTests.cs#L121-L146", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/FetchTests.cs", + "startLine": 121, + "endLine": 146, + "content": "finally\n\t\t{\n\t\t\tSchemaRegistry.Global.Fetch = null!;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void RefContainsBadJson()\n\t{\n\t\ttry\n\t\t{\n\t\t\tSchemaRegistry.Global.Fetch = (_, registry) => JsonSchema.FromText(\"{\\\"type\\\": \\\"string\\\", \\\"invalid\\\"}\", new BuildOptions { SchemaRegistry = registry });\n\n\t\t\tvar buildOptions = new BuildOptions\n\t\t\t{\n\t\t\t\tSchemaRegistry = SchemaRegistry.Global\n\t\t\t};\n\n\t\t\tAssert.Catch(() => JsonSchema.FromText(\"{\\\"$ref\\\":\\\"https://json-everything.test/RefContainsBadJson\\\"}\", buildOptions));\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tSchemaRegistry.Global.Fetch = null!;\n\t\t}\n\t}\n}", + "snippet": "finally\n\t\t{\n\t\t\tSchemaRegistry.Global.Fetch = null!;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void RefContainsBadJson()\n\t{\n\t\ttry\n\t\t{\n\t\t\tSchemaRegistry.Global.Fetch = (_, registry) => JsonSchema.FromText(\"{\\\"type\\\": \\\"string\\\", \\\"invalid\\\"" + }, + { + "title": "src/JsonSchema.Tests/FormatTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/FormatTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/FormatTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\npublic class FormatTests\n{\n\t//private static readonly Uri _formatAssertionMetaSchemaId = new(\"https://json-everything/test/format-assertion\");\n\t//private static readonly JsonSchema _formatAssertionMetaSchema =\n\t//\tnew JsonSchemaBuilder()\n\t//\t\t.Schema(MetaSchemas.Draft202012Id)\n\t//\t\t.Id(_formatAssertionMetaSchemaId)\n\t//\t\t.Vocabulary(\n\t//\t\t\t(Vocabulary.Draft201909_Core.Id, true),\n\t//\t\t\t(Vocabulary.Draft202012_Applicator.Id, true),\n\t//\t\t\t(Vocabulary.Draft202012_MetaData.Id, true),\n\t//\t\t\t(Vocabulary.Draft202012_FormatAssertion.Id, false)\n\t//\t\t)\n\t//\t\t.DynamicAnchor(\"meta\")\n\t//\t\t.Title(\"format assertion meta-schema\")\n\t//\t\t.AllOf(\n\t//\t\t\tnew JsonSchemaBuilder().Ref(MetaSchemas.Core202012Id),\n\t//\t\t\tnew JsonSchemaBuilder().Ref(MetaSchemas.Applicator202012Id),\n\t//\t\t\tnew JsonSchemaBuilder().Ref(MetaSchemas.Metadata202012Id),\n\t//\t\t\tnew JsonSchemaBuilder().Ref(MetaSchemas.FormatAssertion202012Id)\n\t//\t\t)\n\t//\t\t.Type(SchemaValueType.Object | SchemaValueType.Boolean);\n\n\t[Test]\n\tpublic void UnknownFormat_Annotation_ReportsFormat()\n\t{\n\t\tvar schemaText = $@\"{{\n\t\"\"$schema\"\": \"\"{MetaSchemas.Draft202012Id}\"\",\n\t\"\"type\"\": \"\"string\"\",\n\t\"\"format\"\": \"\"something-dumb\"\"\n}}\";\n\t\tvar buildOptions = new BuildOptions { Dialect = Dialect.Draft202012 };\n\t\tvar schema = JsonSchema.FromText(schemaText, buildOptions);\n\t\tvar instance = JsonDocument.Parse(\"\\\"a value\\\"\").RootElement;\n\n\t\tvar results = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tresults.AssertValid();\n\t\tvar serialized = JsonSerializer.Serialize(results, TestEnvironment.SerializerOptions);\n\t\tAssert.That(serialized, Contains.Substring(\"something-dumb\"));\n\t}\n\n\t//[Test]\n\t//public void UnknownFormat_Assertion_FailsValidation()\n\t//{\n\t//\tvar options = new EvaluationOptions\n\t//\t{\n\t//\t\tOutputFormat = OutputFormat.Hierarchical,\n\t//\t\tOnlyKnownFormats = true\n\t//\t};\n\n\t//\tvar schemaText = $@\"{{\n\t//\t\"\"$schema\"\": \"\"{_formatAssertionMetaSchemaId}\"\",\n\t//\t\"\"type\"\": \"\"string\"\",\n\t//\t\"\"format\"\": \"\"something-dumb\"\"\n\t//}}\";\n\t//\tvar buildOptions = new BuildOptions { Dialect = Dialect.Draft202012 };\n\t//\tvar schema = JsonSchema.FromText(schemaText, buildOptions);\n\t//\tvar instance = JsonDocument.Parse(\"\\\"a value\\\"\").RootElement;\n\n\t//\tvar results = schema.Evaluate(instance, options);\n\n\t//\tresults.AssertInvalid();\n\t//\tvar serialized = JsonSerializer.Serialize(results, TestEnvironment.SerializerOptions);\n\t//\tAssert.That(serialized, Contains.Substring(\"something-dumb\"));\n\t//}\n\n\t//[Test]\n\t//public void UnknownFormat_AnnotationWithAssertionOption_FailsValidation()\n\t//{\n\t//\tvar schemaText = $@\"{{\n\t//\t\"\"$schema\"\": \"\"{MetaSchemas.Draft202012Id}\"\",\n\t//\t\"\"type\"\": \"\"string\"\",\n\t//\t\"\"format\"\": \"\"something-dumb\"\"\n\t//}}\";\n\t//\tvar buildOptions = new BuildOptions { Dialect = Dialect.Draft202012 };\n\t//\tvar schema = JsonSchema.FromText(schemaText, buildOptions);\n\t//\tvar instance = JsonDocument.Parse(\"\\\"a value\\\"\").RootElement;\n\n\t//\tvar results = schema.Evaluate(instance, new EvaluationOptions\n\t//\t{\n\t//\t\tOutputFormat = OutputFormat.Hierarchical,\n\t//\t\tRequireFormatValidation = true,\n\t//\t\tOnlyKnownFormats = true\n\t//\t});\n\n\t//\tresults.AssertInvalid();\n\t//\tvar serialized = JsonSerializer.Serialize(results, TestEnvironment.SerializerOptions);\n\t//\tAssert.That(serialized, Contains.Substring(\"something-dumb\"));\n\t//}\n\n\tprivate class RegexBasedFormat : RegexFormat\n\t{\n\t\tpublic RegexBasedFormat()\n\t\t\t: base(\"hexadecimal\", \"^[0-9a-fA-F]+$\")\n\t\t{\n\t\t}\n\t}\n\n\t[TestCase(\"\\\"1dd7fe33f97f42cf89c5789018bae64d\\\"\", true)]\n\t[TestCase(\"\\\"nwvoiwe;oiabe23oi32\\\"\", false)]\n\t[TestCase(\"true\", true)]\n\tpublic void RegexBasedFormatWorksProperly(string jsonText, bool isValid)\n\t{\n\t\tFormatRegistry.Global.Register(new RegexBasedFormat());\n\n\t\tvar json = JsonDocument.Parse(jsonText).RootElement;\n\t\tJsonSchema schema = new JsonSchemaBuilder()\n\t\t\t.Format(\"hexadecimal\");\n\n\t\tvar results = schema.Evaluate(json, new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical,", + "snippet": "using System;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\npublic class FormatTests\n{\n\t//private static readonly Uri _formatAssertionMetaSchemaId = new(\"https://json-ev" + }, + { + "title": "src/JsonSchema.Tests/FormatTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/FormatTests.cs#L121-L127", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/FormatTests.cs", + "startLine": 121, + "endLine": 127, + "content": "RequireFormatValidation = true\n\t\t});\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(results, TestEnvironment.TestOutputSerializerOptions));\n\t\tAssert.That(results.IsValid, Is.EqualTo(isValid));\n\t}\n}", + "snippet": "RequireFormatValidation = true\n\t\t});\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(results, TestEnvironment.TestOutputSerializerOptions));\n\t\tAssert.That(results.IsValid, Is.EqualTo(isValid));\n\t}\n}" + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (1/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Threading.Tasks;\nusing Json.Schema.Serialization;\nusing NUnit.Framework;\nusing TestHelpers;\n#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.\n\nnamespace Json.Schema.Tests;\n\npublic class GithubTests\n{\n\tprivate static string GetFile(int issue, string name)\n\t{\n\t\treturn Path.Combine(TestContext.CurrentContext.WorkDirectory, \"Files\", $\"Issue{issue}_{name}.json\")\n\t\t\t.AdjustForPlatform();\n\t}\n\n\tprivate static string GetResource(int issue, string name)\n\t{\n\t\treturn File.ReadAllText(GetFile(issue, name));\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/18\n\t[Test]\n\tpublic void Issue18_SomethingNotValidatingRight()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar instance = JsonDocument.Parse(\"\"\"\n\t\t\t{\n\t\t\t \"prop1\": {\n\t\t\t \"name\": \"a\",\n\t\t\t \"version\": 1\n\t\t\t },\n\t\t\t \"prop2\": {},\n\t\t\t \"prop4\": \"a\",\n\t\t\t \"prop5\": {},\n\t\t\t \"prop6\": {\n\t\t\t \"firstId\": \"428de96d-d5b2-4d12-8e88-37827099dd02\",\n\t\t\t \"secondId\": \"428de96d-d5b2-4d12-8e88-37827099dd02\",\n\t\t\t \"version\": \"test-version\",\n\t\t\t \"thirdId\": \"428de96d-d5b2-4d12-8e88-37827099dd02\",\n\t\t\t \"type\": \"test\",\n\t\t\t \"name\": \"testApp\",\n\t\t\t \"receiptTimestamp\": \"2019-02-05T12:36:31.2812022Z\",\n\t\t\t \"timestamp\": \"2012-04-21T12:36:31.2812022Z\",\n\t\t\t \"extra_key\": \"extra_val\"\n\t\t\t },\n\t\t\t \"prop3\": {\n\t\t\t \"prop5\": {},\n\t\t\t \"metadata\": {},\n\t\t\t \"deleteAfter\": 3,\n\t\t\t \"allowExport\": true\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\tvar schema = JsonSchema.FromText(\"\"\"\n\t\t\t{\n\t\t\t\t\"$schema\": \"http://json-schema.org/draft-07/schema#\",\n\t\t\t\t\"type\": \"object\",\n\t\t\t\t\"required\": [\"prop1\", \"prop2\", \"prop3\", \"prop4\", \"prop5\", \"prop6\"],\n\t\t\t\t\"properties\": {\n\t\t\t\t \"prop1\": {\n\t\t\t\t \"type\": \"object\",\n\t\t\t\t \"required\": [\"name\", \"version\"],\n\t\t\t\t \"additionalProperties\": false,\n\t\t\t\t \"properties\": {\n\t\t\t\t \"name\": {\n\t\t\t\t \"type\": \"string\",\n\t\t\t\t \"pattern\": \"^[-_]?([a-zA-Z][-_]?)+$\"\n\t\t\t\t },\n\t\t\t\t \"version\": {\n\t\t\t\t \"type\": \"integer\",\n\t\t\t\t \"minimum\": 1\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t },\n\t\t\t\t \"prop2\": {\n\t\t\t\t \"$ref\": \"http://json-schema.org/draft-07/schema#\"\n\t\t\t\t },\n\t\t\t\t \"prop3\": {\n\t\t\t\t \"type\": \"object\",\n\t\t\t\t \"required\": [\n\t\t\t\t \"prop5\",\n\t\t\t\t \"metadata\"\n\t\t\t\t ],\n\t\t\t\t \"additionalProperties\": false,\n\t\t\t\t \"properties\": {\n\t\t\t\t \"prop5\": {\n\t\t\t\t \"type\": \"object\"\n\t\t\t\t },\n\t\t\t\t \"metadata\": {\n\t\t\t\t \"type\": \"object\"\n\t\t\t\t },\n\t\t\t\t \"deleteAfter\": {\n\t\t\t\t \"type\": \"integer\"\n\t\t\t\t },\n\t\t\t\t \"allowExport\": {\n\t\t\t\t \"type\": \"boolean\"\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t },\n\t\t\t\t \"prop4\": {\n\t\t\t\t \"type\": \"string\",\n\t\t\t\t \"pattern\": \"^[-_]?([a-zA-Z][-_]?)+$\"\n\t\t\t\t },\n\t\t\t\t \"prop5\": {\n\t\t\t\t \"type\": \"object\"\n\t\t\t\t },\n\t\t\t\t \"prop6\": {\n\t\t\t\t \"type\": \"object\",\n\t\t\t\t \"required\": [\n\t\t\t\t \"firstId\",\n\t\t\t\t \"secondId\",\n\t\t\t\t \"version\",\n\t\t\t\t \"thirdId\",\n\t\t\t\t \"type\",", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Threading.Tasks;\nusing Json.Schema.Serialization;\nusing NUnit.Framework;\nusing TestHelpers;\n#pragma" + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (2/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 121, + "endLine": 240, + "content": "\"name\",\n\t\t\t\t \"receiptTimestamp\",\n\t\t\t\t \"timestamp\"\n\t\t\t\t ],\n\t\t\t\t \"properties\": {\n\t\t\t\t \"firstId\": {\n\t\t\t\t \"type\": \"string\",\n\t\t\t\t \"pattern\": \"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\"\n\t\t\t\t },\n\t\t\t\t \"secondId\": {\n\t\t\t\t \"type\": \"string\",\n\t\t\t\t \"pattern\": \"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\"\n\t\t\t\t },\n\t\t\t\t \"type\": {\n\t\t\t\t \"type\": \"string\",\n\t\t\t\t \"enum\": [\"test\", \"lab\", \"stage\", \"prod\"]\n\t\t\t\t },\n\t\t\t\t \"thirdId\": {\n\t\t\t\t \"type\": \"string\",\n\t\t\t\t \"pattern\": \"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\"\n\t\t\t\t },\n\t\t\t\t \"version\": {\n\t\t\t\t \"type\": \"string\",\n\t\t\t\t \"minLength\": 1\n\t\t\t\t },\n\t\t\t\t \"name\": {\n\t\t\t\t \"type\": \"string\",\n\t\t\t\t \"minLength\": 1\n\t\t\t\t },\n\t\t\t\t \"receiptTimestamp\": {\n\t\t\t\t \"type\": \"string\",\n\t\t\t\t \"format\": \"date-time\"\n\t\t\t\t },\n\t\t\t\t \"timestamp\": {\n\t\t\t\t \"type\": \"string\",\n\t\t\t\t \"format\": \"date-time\"\n\t\t\t\t }\n\t\t\t\t },\n\t\t\t\t \"additionalProperties\": {\n\t\t\t\t \"type\": \"string\"\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t},\n\t\t\t\t\"additionalProperties\": false\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/19\n\t[Test]\n\tpublic void Issue19_Draft4ShouldInvalidateAsUnrecognizedSchema_NoOption()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\n\t\tAssert.Throws(() => JsonSchema.FromText(\"\"\"{\"$schema\":\"http://json-schema.org/draft-04/schema#\",\"type\":\"string\"}\"\"\", buildOptions));\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/19\n\t[TestCase(\"http://json-schema.org/draft-07/schema#\", @\"{}\", true)]\n\t[TestCase(\"http://json-schema.org/draft-07/schema#\", @\"{\"\"abc\"\": 1}\", false)]\n\t[TestCase(\"http://json-schema.org/draft-07/schema#\", @\"{\"\"abc\"\": 1, \"\"d7\"\": 7}\", true)]\n\t[TestCase(\"http://json-schema.org/draft-07/schema#\", @\"{\"\"abc\"\": 1, \"\"d9\"\": 9}\", false)]\n\t[TestCase(\"http://json-schema.org/draft-07/schema#\", @\"{\"\"abc\"\": 1, \"\"d7\"\": 7, \"\"d9\"\": 9}\", true)]\n\t[TestCase(\"https://json-schema.org/draft/2019-09/schema\", @\"{}\", true)]\n\t[TestCase(\"https://json-schema.org/draft/2019-09/schema\", @\"{\"\"abc\"\": 1}\", false)]\n\t[TestCase(\"https://json-schema.org/draft/2019-09/schema\", @\"{\"\"abc\"\": 1, \"\"d7\"\": 7}\", false)]\n\t[TestCase(\"https://json-schema.org/draft/2019-09/schema\", @\"{\"\"abc\"\": 1, \"\"d9\"\": 9}\", true)]\n\t[TestCase(\"https://json-schema.org/draft/2019-09/schema\", @\"{\"\"abc\"\": 1, \"\"d7\"\": 7, \"\"d9\"\": 9}\", true)]\n\tpublic void Issue19_SchemaShouldOnlyUseSpecifiedDraftKeywords(string metaSchemaId, string instance, bool isValid)\n\t{\n\t\tvar dialect = metaSchemaId switch\n\t\t{\n\t\t\t\"http://json-schema.org/draft-07/schema#\" => Dialect.Draft07,\n\t\t\t\"https://json-schema.org/draft/2019-09/schema\" => Dialect.Draft201909,\n\t\t\t_ => throw new ArgumentException($\"Unknown meta-schema: {metaSchemaId}\")\n\t\t};\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new(), Dialect = dialect };\n\t\tvar schema = JsonSchema.FromText(\"\"\"\n\t\t\t{\n\t\t\t \"dependencies\": {\n\t\t\t \"abc\": [ \"d7\" ]\n\t\t\t },\n\t\t\t \"dependentRequired\": {\n\t\t\t \"abc\": [ \"d9\" ]\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\t\tvar opts = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t};\n\t\tvar element = JsonDocument.Parse(instance).RootElement;\n\n\t\tvar val = schema.Evaluate(element, opts);\n\t\tTestConsole.WriteLine(\"Elem `{0}` got validation `{1}`\", instance, val.IsValid);\n\t\tif (isValid) val.AssertValid();\n\t\telse val.AssertInvalid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/29\n\t[Test]\n\tpublic void Issue29_SchemaFromFileWithoutIdShouldInheritUriFromFilePath()\n\t{\n\t\tvar schemaFile = Path.Combine(TestContext.CurrentContext.WorkDirectory, \"Files\", \"issue29-schema-without-id.json\")\n\t\t\t.AdjustForPlatform();\n\n\t\tvar jsonStr = \"\"\"\n\t\t\t{\n\t\t\t \"abc\": {\n\t\t\t \"abc\": {\n\t\t\t \"abc\": \"abc\"\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\";\n\t\tvar schema = JsonSchema.FromFile(schemaFile);", + "snippet": "\"name\",\n\t\t\t\t \"receiptTimestamp\",\n\t\t\t\t \"timestamp\"\n\t\t\t\t ],\n\t\t\t\t \"properties\": {\n\t\t\t\t \"firstId\": {\n\t\t\t\t \"type\": \"string\",\n\t\t\t\t \"pattern\": \"[0-9a-f]{8}-[0" + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (3/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 241, + "endLine": 360, + "content": "var json = JsonDocument.Parse(jsonStr).RootElement;\n\t\tvar validation = schema.Evaluate(json, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tvalidation.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/29\n\t[Test]\n\tpublic void Issue29_SchemaFromFileWithIdShouldKeepUriFromId()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schemaFile = Path.Combine(TestContext.CurrentContext.WorkDirectory, \"Files\", \"issue29-schema-with-id.json\")\n\t\t\t.AdjustForPlatform();\n\n\t\tvar jsonStr = \"\"\"\n\t\t\t{\n\t\t\t \"abc\": {\n\t\t\t \"abc\": {\n\t\t\t \"abc\": \"abc\"\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\";\n\t\tvar schema = JsonSchema.FromFile(schemaFile, buildOptions);\n\t\tvar json = JsonDocument.Parse(jsonStr).RootElement;\n\t\tvar validation = schema.Evaluate(json, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tvalidation.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/29\n\t[Test]\n\tpublic void Issue29_SchemaWithOnlyFileNameIdShouldUseDefaultBaseUri()\n\t{\n\t\tvar schemaStr = \"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n\t\t\t \"$id\": \"mySchema.json\",\n\t\t\t \"properties\": {\n\t\t\t \"abc\": { \"$ref\": \"mySchema.json\" }\n\t\t\t },\n\t\t\t \"additionalProperties\": false\n\t\t\t}\n\t\t\t\"\"\";\n\t\tvar jsonStr = \"\"\"\n\t\t\t{\n\t\t\t \"abc\": {\n\t\t\t \"abc\": {\n\t\t\t \"abc\": \"abc\"\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\";\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = JsonSchema.FromText(schemaStr, buildOptions);\n\t\tvar json = JsonDocument.Parse(jsonStr).RootElement;\n\t\tvar validation = schema.Evaluate(json, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tvalidation.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/79\n\t[Test]\n\tpublic void Issue79_RefsTryingToResolveParent()\n\t{\n\t\tvar schema1Str = \"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n\t\t\t \"$id\": \"schema1.json\",\n\t\t\t \"definitions\": {\n\t\t\t \"myDef\": {\n\t\t\t \"properties\": {\n\t\t\t \"abc\": { \"type\": \"string\" }\n\t\t\t }\n\t\t\t }\n\t\t\t },\n\t\t\t \"$ref\": \"#/definitions/myDef\"\n\t\t\t}\n\t\t\t\"\"\";\n\t\tvar schema2Str = \"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n\t\t\t \"$id\": \"schema2.json\",\n\t\t\t \"$ref\": \"schema1.json\"\n\t\t\t}\n\t\t\t\"\"\";\n\t\tvar jsonStr = \"\"\"{ \"abc\": \"s\" }\"\"\";\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema1 = JsonSchema.FromText(schema1Str, buildOptions);\n\t\tvar schema2 = JsonSchema.FromText(schema2Str, buildOptions);\n\t\tvar json = JsonDocument.Parse(jsonStr).RootElement;\n\t\tvar uri1 = new Uri(\"https://json-everything.lib/schema1.json\");\n\t\tvar uri2 = new Uri(\"https://json-everything.lib/schema2.json\");\n\t\tvar map = new Dictionary\n\t\t{\n\t\t\t{ uri1, schema1 },\n\t\t\t{ uri2, schema2 },\n\t\t};\n\t\tbuildOptions.SchemaRegistry.Fetch = (uri, _) =>\n\t\t{\n\t\t\tAssert.That(map.TryGetValue(uri, out var ret), Is.True, $\"Unexpected uri: {uri}\");\n\t\t\treturn ret;\n\t\t};\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t};\n\t\tvar result = schema2.Evaluate(json, options);\n\t\tresult.AssertValid();\n\t\tAssert.That(result.Details![0].SchemaLocation.OriginalString, Is.EqualTo(\"https://json-everything.lib/schema1.json#\"));\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/79\n\t[Test]\n\tpublic void Issue79_RefsTryingToResolveParent_Explanation()\n\t{\n\t\tvar schemaText = \"\"\"\n\t\t\t{\n\t\t\t \"$id\": \"https://mydomain.com/outer\",\n\t\t\t \"properties\": {", + "snippet": "var json = JsonDocument.Parse(jsonStr).RootElement;\n\t\tvar validation = schema.Evaluate(json, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tvalidation.AssertValid();\n\t}\n\n\t// https://github.com/js" + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (4/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 361, + "endLine": 480, + "content": "\"foo\": {\n\t\t\t \"$id\": \"https://mydomain.com/foo\",\n\t\t\t \"properties\": {\n\t\t\t \"inner1\": {\n\t\t\t \"$anchor\": \"bar\",\n\t\t\t \"type\": \"string\"\n\t\t\t },\n\t\t\t \"inner2\": {\n\t\t\t \"$ref\": \"#bar\"\n\t\t\t }\n\t\t\t }\n\t\t\t },\n\t\t\t \"bar\": {\n\t\t\t \"$anchor\": \"bar\",\n\t\t\t \"type\": \"integer\"\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\";\n\t\tvar passingText = \"\"\"\n\t\t\t{\n\t\t\t \"foo\": {\n\t\t\t \"inner2\": \"value\"\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\";\n\t\tvar failingText = \"\"\"\n\t\t\t{\n\t\t\t \"foo\": {\n\t\t\t \"inner2\": 42\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = JsonSchema.FromText(schemaText, buildOptions);\n\t\tvar passing = JsonDocument.Parse(passingText).RootElement;\n\t\tvar failing = JsonDocument.Parse(failingText).RootElement;\n\n\t\tschema.Evaluate(passing, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical }).AssertValid();\n\t\tschema.Evaluate(failing, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical }).AssertInvalid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/97\n\t[Test]\n\tpublic void Issue97_IdentifyCircularReferences()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tAssert.Throws(() => new JsonSchemaBuilder(buildOptions)\n\t\t\t.Ref(\"#/$defs/string\")\n\t\t\t.Defs((\"string\", new JsonSchemaBuilder().Ref(\"#/$defs/string\")))\n\t\t\t.Build());\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/97\n\t[Test]\n\tpublic void Issue97_IdentifyComplexCircularReferences()\n\t{\n\t\tAssert.Throws(() => new JsonSchemaBuilder()\n\t\t\t.Ref(\"#/$defs/a\")\n\t\t\t.Defs(\n\t\t\t\t(\"a\", new JsonSchemaBuilder().Ref(\"#/$defs/b\")),\n\t\t\t\t(\"b\", new JsonSchemaBuilder().Ref(\"#/$defs/a\"))\n\t\t\t)\n\t\t\t.Build());\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/191\n\t[Test]\n\tpublic void Issue191_SelfReferentialCustomMetaschemaShouldError()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\n\t\tvar metaSchemaText = GetResource(191, \"MetaSchema\");\n\n\t\tAssert.Throws(() => JsonSchema.FromText(metaSchemaText, buildOptions));\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/208\n\t//[Test]\n\t//public void Issue208_BundlingNotWorking()\n\t//{\n\t//\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t//\tJsonSchema externalSchema = new JsonSchemaBuilder(buildOptions)\n\t//\t\t.Schema(MetaSchemas.Draft202012Id)\n\t//\t\t.Id(\"https://my-external-schema\")\n\t//\t\t.Type(SchemaValueType.Object)\n\t//\t\t.Properties(\n\t//\t\t\t(\"first\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t//\t\t)\n\t//\t\t.Build();\n\n\t//\tbuildOptions.SchemaRegistry.Register(new Uri(\"https://my-external-schema\"), externalSchema);\n\n\t//\tJsonSchema mySchema = new JsonSchemaBuilder(buildOptions)\n\t//\t\t.Schema(MetaSchemas.Draft202012Id)\n\t//\t\t.Id(\"https://my-schema\")\n\t//\t\t.Type(SchemaValueType.Object)\n\t//\t\t.Properties(\n\t//\t\t\t(\"first\", new JsonSchemaBuilder().Ref(\"https://my-external-schema\")),\n\t//\t\t\t(\"second\", new JsonSchemaBuilder()\n\t//\t\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t//\t\t\t\t.Id(\"https://my-inner-schema\")\n\t//\t\t\t\t.Type(SchemaValueType.Object)\n\t//\t\t\t\t.Properties(\n\t//\t\t\t\t\t(\"second\", new JsonSchemaBuilder().Ref(\"#/$defs/my-inner-ref\"))\n\t//\t\t\t\t)\n\t//\t\t\t\t.Defs(\n\t//\t\t\t\t\t(\"my-inner-ref\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t//\t\t\t\t)\n\t//\t\t\t)\n\t//\t\t)\n\t//\t\t.Build();\n\n\t//\tvar instance = JsonDocument.Parse(\"{\\\"first\\\":{\\\"first\\\":\\\"first\\\"},\\\"second\\\":{\\\"second\\\":\\\"second\\\"}}\").RootElement;\n\n\t//\tvar options = new EvaluationOptions\n\t//\t{\n\t//\t\tOutputFormat = OutputFormat.Hierarchical\n\t//\t};", + "snippet": "\"foo\": {\n\t\t\t \"$id\": \"https://mydomain.com/foo\",\n\t\t\t \"properties\": {\n\t\t\t \"inner1\": {\n\t\t\t \"$anchor\": \"bar\",\n\t\t\t \"type\": \"string\"\n\t\t\t },\n\t\t\t \"inner2\": {\n\t\t\t \"$ref\": " + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (5/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 481, + "endLine": 600, + "content": "//\tmySchema.Evaluate(instance, options).AssertValid();\n\n\t//}\n\n\t// https://github.com/json-everything/json-everything/issues/212\n\t[Test]\n\tpublic void Issue212_CouldNotResolveAnchorReference_FromFile()\n\t{\n\t\t// This validation fails because the file uses `id` instead of `$id`.\n\t\t// See https://github.com/json-everything/json-everything/issues/212#issuecomment-1033423550\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar path = Path.Combine(TestContext.CurrentContext.WorkDirectory, \"Files\", \"issue212_schema.json\")\n\t\t\t.AdjustForPlatform();\n\t\tvar schema = JsonSchema.FromFile(path, buildOptions);\n\n\t\tvar instance = JsonDocument.Parse(\"{\\\"ContentDefinitionId\\\": \\\"fa81bc1d-3efe-4192-9e03-31e9898fef90\\\"}\").RootElement;\n\n\t\tAssert.Throws(() => schema.Evaluate(instance));\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/212\n\t[Test]\n\tpublic void Issue212_CouldNotResolveAnchorReference_Inline()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft7Id)\n\t\t\t.Id(\"http://messagebroker.fff.pl/rpn/dci/kkt.json\")\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Title(\"JSON Schema \")\n\t\t\t.Definitions(\n\t\t\t\t(\"#guid\", new JsonSchemaBuilder()\n\t\t\t\t\t.Id(\"#guid\")\n\t\t\t\t\t.Title(\"Definicja obligatoryjnego GUID (regex)\")\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.Examples(\n\t\t\t\t\t\t\"09C9A8DA-B40F-4E3A-9746-7B10AFEC2C4F\",\n\t\t\t\t\t\t\"2d9bbb00-878f-49b0-9d48-767ce3e12dee\"\n\t\t\t\t\t)\n\t\t\t\t\t.MinLength(36)\n\t\t\t\t\t.MaxLength(36)\n\t\t\t\t\t.Pattern(\"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$\")\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Required(\"ContentDefinitionId\")\n\t\t\t.Properties(\n\t\t\t\t(\"ContentDefinitionId\", new JsonSchemaBuilder()\n\t\t\t\t\t.Ref(\"#guid\")\n\t\t\t\t\t.Title(\"Identyfikator definicji \")\n\t\t\t\t)\n\t\t\t)\n\t\t\t.AdditionalProperties(false)\n\t\t\t.Build();\n\n\t\tvar instance = JsonDocument.Parse(\"{\\\"ContentDefinitionId\\\": \\\"fa81bc1d-3efe-4192-9e03-31e9898fef90\\\"}\").RootElement;\n\n\t\tvar res = schema.Evaluate(instance, new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t});\n\t\tres.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/216\n\t[Test]\n\tpublic void Issue216_AdditionalPropertiesShouldRelyOnDeclarationsForDraft7()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft7Id)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"bar\", new JsonSchemaBuilder().Type(SchemaValueType.String))\n\t\t\t)\n\t\t\t.AdditionalProperties(false)\n\t\t\t.Build();\n\n\t\tvar instance = JsonDocument.Parse(\"{\\\"foo\\\":1,\\\"bar\\\":false}\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tresult.AssertInvalid();\n\t\tvar nodes = new List { result };\n\t\twhile (nodes.Count != 0)\n\t\t{\n\t\t\tvar node = nodes.First();\n\t\t\tnodes.Remove(node);\n\t\t\tAssert.That(node.EvaluationPath.ToString(), Is.Not.EqualTo(\"#/additionalProperties\"));\n\t\t\tif (node.Details != null) nodes.AddRange(node.Details);\n\t\t}\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/226\n\t[Test]\n\tpublic void Issue226_MessageInValidResult()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schemaText = GetResource(226, \"schema\");\n\t\tvar instanceText = GetResource(226, \"instance\");\n\n\t\tvar schema = JsonSchema.FromText(schemaText, buildOptions);\n\t\tvar instance = JsonDocument.Parse(instanceText).RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List });\n\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/352\n\t[Test]\n\tpublic void Issue352_ConcurrentValidationsWithReferences()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = JsonSchema.FromText(\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"id\": {", + "snippet": "//\tmySchema.Evaluate(instance, options).AssertValid();\n\n\t//}\n\n\t// https://github.com/json-everything/json-everything/issues/212\n\t[Test]\n\tpublic void Issue212_CouldNotResolveAnchorReference_FromFile()\n\t{\n\t\t// This validat" + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (6/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 601, + "endLine": 720, + "content": "\"type\": \"integer\"\n\t\t\t },\n\t\t\t \"interval1\": {\n\t\t\t \"$ref\": \"#/components/schemas/interval\"\n\t\t\t }\n\t\t\t },\n\t\t\t \"components\": {\n\t\t\t \"schemas\": {\n\t\t\t \"interval\": {\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"from\": {\n\t\t\t \"type\": \"number\"\n\t\t\t },\n\t\t\t \"to\": {\n\t\t\t \"type\": \"number\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\n\t\tvar instanceJson = \"\"\"{\"id\": 123, \"interval1\": {\"to\": 3.0}}\"\"\";\n\t\tvar instance = JsonDocument.Parse(instanceJson).RootElement;\n\n\t\t// verify it runs once\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.List,\n\t\t\tRequireFormatValidation = true\n\t\t});\n\t\tresult.AssertValid();\n\n\t\t// run in parallel\n\t\tvar numberOfMessages = 100;\n\t\tvar jsonMessages = new List();\n\t\tfor (int j = 0; j < numberOfMessages; j++)\n\t\t{\n\t\t\tjsonMessages.Add(JsonDocument.Parse(instanceJson).RootElement);\n\t\t}\n\t\tParallel.ForEach(jsonMessages, json =>\n\t\t{\n\t\t\tEvaluationResults r;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tr = schema.Evaluate(json, new EvaluationOptions\n\t\t\t\t{\n\t\t\t\t\tOutputFormat = OutputFormat.List,\n\t\t\t\t\tRequireFormatValidation = true\n\t\t\t\t});\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tTestConsole.WriteLine(e);\n\t\t\t\tthrow;\n\t\t\t}\n\n\t\t\tr.AssertValid();\n\t\t});\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/417\n\t//[Test]\n\t//public void Issue417_BundleWithItemsFails()\n\t//{\n\t//\t// items: true\n\t//\tvar singleItemSchema = new JsonSchemaBuilder()\n\t//\t\t.Items(true)\n\t//\t\t.Build();\n\t//\tsingleItemSchema.Bundle(); // throws\n\t//\t// items: [true, true]\n\t//\tvar multiItemSchema = new JsonSchemaBuilder()\n\t//\t\t.Items([true, true])\n\t//\t\t.Build();\n\t//\tmultiItemSchema.Bundle(); // throws\n\t//}\n\n\t// https://github.com/json-everything/json-everything/issues/419\n\t[Test]\n\tpublic void Issue419_SecondLevelReferences()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\t_ = JsonSchema.FromFile(GetFile(419, \"level2\"), buildOptions);\n\n\t\t_ = JsonSchema.FromFile(GetFile(419, \"level1\"), buildOptions);\n\n\t\tvar rootSchema = JsonSchema.FromFile(GetFile(419, \"root\"), buildOptions);\n\n\t\tvar config = JsonDocument.Parse(GetResource(419, \"config\")).RootElement;\n\n\t\tvar result = rootSchema.Evaluate(config);\n\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/426\n\t[Test]\n\tpublic void Issue426_FileFragmentRefs()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = JsonSchema.FromFile(GetFile(426, \"schema\"), buildOptions);\n\t\t\n\t\tvar data = JsonDocument.Parse(File.ReadAllText(GetFile(426, \"data\"))).RootElement;\n\t\t\n\t\tvar result = schema.Evaluate(data);\n\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/432\n\t[Test]\n\tpublic void Issue432_UnresolvedLocalRef()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = JsonSchema.FromText(\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"http://json-schema.org/draft-06/schema#\",\n\t\t\t \"$ref\": \"#/definitions/Order\",", + "snippet": "\"type\": \"integer\"\n\t\t\t },\n\t\t\t \"interval1\": {\n\t\t\t \"$ref\": \"#/components/schemas/interval\"\n\t\t\t }\n\t\t\t },\n\t\t\t \"components\": {\n\t\t\t \"schemas\": {\n\t\t\t \"interval\": {\n\t\t\t " + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (7/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L721-L840", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 721, + "endLine": 840, + "content": "\"definitions\": {\n\t\t\t \"Order\": {\n\t\t\t \"type\": \"object\",\n\t\t\t \"additionalProperties\": true,\n\t\t\t \"properties\": {\n\t\t\t \"orderId\": {\n\t\t\t \"type\": \"string\",\n\t\t\t \"format\": \"uuid\"\n\t\t\t }\n\t\t\t },\n\t\t\t \"required\": [\n\t\t\t \"orderId\"\n\t\t\t ],\n\t\t\t \"title\": \"Order\"\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\t\tvar instance = JsonDocument.Parse(\"\"\"{ \"orderId\": \"3cb65f2d-4049-43c1-b185-1943765acd9\" }\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\t\t\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/432\n\t[Test]\n\tpublic void Issue432_UnresolvedLocalRef_Again()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = JsonSchema.FromText(\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"http://json-schema.org/draft-06/schema#\",\n\t\t\t \"$ref\": \"#/definitions/Order\",\n\t\t\t \"definitions\": {\n\t\t\t \"Order\": {\n\t\t\t \"type\": \"object\",\n\t\t\t \"additionalProperties\": true,\n\t\t\t \"properties\": {\n\t\t\t \"orderId\": {\n\t\t\t \"type\": \"string\",\n\t\t\t \"format\": \"uuid\"\n\t\t\t },\n\t\t\t \"customer\": {\n\t\t\t \"$ref\": \"#/definitions/Customer\"\n\t\t\t }\n\t\t\t },\n\t\t\t \"required\": [\n\t\t\t \"customer\",\n\t\t\t \"orderId\"\n\t\t\t ],\n\t\t\t \"title\": \"Order\"\n\t\t\t },\n\t\t\t \"Customer\": {\n\t\t\t \"type\": \"object\",\n\t\t\t \"additionalProperties\": false,\n\t\t\t \"properties\": {\n\t\t\t \"name\": {\n\t\t\t \"type\": \"string\"\n\t\t\t }\n\t\t\t },\n\t\t\t \"required\": [\n\t\t\t \"name\"\n\t\t\t ],\n\t\t\t \"title\": \"Customer\"\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\", buildOptions);\n\t\tvar instance = JsonDocument.Parse(\"\"\"\n\t\t\t{\n\t\t\t \"orderId\": \"3cb65f2d-4049-4c1-b185-194365acdf99\",\n\t\t\t \"customer\": {\n\t\t\t \"name\": \"Some Customer\"\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance);\n\t\t\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/435\n\t[Test]\n\tpublic void Issue435_NonCircularRefThrowing()\n\t{\n\t\tvar schema = JsonSchema.FromText(\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\n\t\t\t \"type\": \"array\",\n\t\t\t \"items\": { \"$ref\": \"#/$defs/DerivedType\" },\n\n\t\t\t \"$defs\": {\n\n\t\t\t \"BaseType\": {\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"field1\": { \"type\": \"string\" }\n\t\t\t }\n\t\t\t },\n\n\t\t\t \"DerivedType\": {\n\t\t\t \"allOf\": [\n\t\t\t { \"$ref\": \"#/$defs/BaseType\" },\n\t\t\t { \"properties\": { \"field2\": { \"type\": \"string\" } } }\n\t\t\t ]\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\");\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"\n\t\t\t[\n\t\t\t {\n\t\t\t \"field1\": \"foo\",\n\t\t\t \"field2\": \"bar\"\n\t\t\t }\n\t\t\t]", + "snippet": "\"definitions\": {\n\t\t\t \"Order\": {\n\t\t\t \"type\": \"object\",\n\t\t\t \"additionalProperties\": true,\n\t\t\t \"properties\": {\n\t\t\t \"orderId\": {\n\t\t\t \"type\": \"string\",\n\t\t\t \"format\": \"uuid\"\n\t\t\t " + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (8/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L841-L960", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 841, + "endLine": 960, + "content": "\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions{OutputFormat = OutputFormat.List});\n\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/435\n\t[Test]\n\tpublic void Issue435_NonCircularRefThrowing_File()\n\t{\n\t\tvar file = GetFile(435, \"schema\");\n\n\t\tvar schema = JsonSchema.FromFile(file);\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"\n\t\t\t[\n\t\t\t {\n\t\t\t \"field1\": \"foo\",\n\t\t\t \"field2\": \"bar\"\n\t\t\t }\n\t\t\t]\n\t\t\t\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions{OutputFormat = OutputFormat.List});\n\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/506\n\t[Test]\n\tpublic void Issue506_ReffingIntoAdditionalProperties()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Id(\"https://test.example/schema\")\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.AdditionalProperties(new JsonSchemaBuilder()\n\t\t\t\t.Title(\"DictTemplate\")\n\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t.Properties(\n\t\t\t\t\t(\"Enabled\", new JsonSchemaBuilder().Type(SchemaValueType.Boolean))\n\t\t\t\t)\n\t\t\t).Build();\n\n\t\tbuildOptions.SchemaRegistry.Register(schema);\n\n\t\t// Create a schema that refs into the additionalProperties\n\t\tvar refSchema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Ref(\"https://test.example/schema#/additionalProperties\")\n\t\t\t.Build();\n\n\t\t// Verify the ref resolves correctly\n\t\tvar instance = JsonDocument.Parse(\"\"\"{\"Enabled\": true}\"\"\").RootElement;\n\t\tvar result = refSchema.Evaluate(instance);\n\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/516\n\t[Test]\n\tpublic void Issue516_UnrecognizedKeywordsViaBuilder()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new(),\n\t\t\tDialect = Dialect.Draft202012\n\t\t};\n\t\tvar builder = new JsonSchemaBuilder(buildOptions);\n\t\tbuilder.Unrecognized(\"foo\", null);\n\t\tbuilder.Unrecognized(\"bar\", null);\n\t\tvar actual = builder.Build();\n\n\t\tvar text = \"{\\\"foo\\\":null,\\\"bar\\\":null}\";\n\n\t\tAssert.That(JsonSerializer.Serialize(actual, TestEnvironment.SerializerOptions), Is.EqualTo(text));\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/517\n\t[TestCase(\"\"\"{\"additionalItems\":\"not-a-schema\"}\"\"\", 0, 33)]\n\t[TestCase(\"\"\"{\"additionalProperties\":\"not-a-schema\"}\"\"\", 0, 38)]\n\t[TestCase(\"\"\"{\"allOf\":[\"not-a-schema\"]}\"\"\", 0, 24)]\n\t[TestCase(\"\"\"{\"anyOf\":[\"not-a-schema\"]}\"\"\", 0, 24)]\n\t[TestCase(\"\"\"{\"contains\":\"not-a-schema\"}\"\"\", 0, 26)]\n\t[TestCase(\"\"\"{\"contentSchema\":\"not-a-schema\"}\"\"\", 0, 31)]\n\t[TestCase(\"\"\"{\"definitions\":{\"myDef\":\"not-a-schema\"}}\"\"\", 0, 38)]\n\t[TestCase(\"\"\"{\"$defs\":{\"myDef\":\"not-a-schema\"}}\"\"\", 0, 32)]\n\t[TestCase(\"\"\"{\"dependencies\":{\"myDep\":\"not-a-schema\"}}\"\"\", 0, 39)]\n\t[TestCase(\"\"\"{\"not\":\"not-a-schema\"}\"\"\", 0, 21)]\n\t[TestCase(\"\"\"{\"properties\":{\"abc\": \"not-a-schema\"}}\"\"\", 0, 36)]\n\t[TestCase(\"\"\"{\"additionalItems\":{\"properties\":{\"abc\": \"not-a-schema\"}}}\"\"\", 0, 55)]\n\t[TestCase(\"\"\"\n{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"required\": [ { \"abc\": null } ]\n \"properties\": {\n \"abc\": { \"$ref\": \"mySchema.json\" }\n },\n \"additionalProperties\": false\n}\n\"\"\", 2, 17)]\n\t[Ignore(\"These tests are no longer valid since we're not deserializing schemas anymore.\")]\n\tpublic void Issue517_IncorrectJsonExceptionLineAndBytePosition(string schemaStr, int expectedLineNumber, int expectedBytePositionInLine)\n\t{\n\t\t// Reminder: per the JsonException documentation, expectedLineNumber & expectedBytePositionInLine are 0-based\n\t\tvar exception = Assert.Throws(() => JsonSerializer.Deserialize(schemaStr, TestEnvironment.SerializerOptions));\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(exception, Is.Not.Null);\n\t\t\tTestConsole.WriteLine(\"Expected error\");\n\t\t\tTestConsole.WriteLine(schemaStr.Split('\\n')[expectedLineNumber]);\n\t\t\tTestConsole.WriteLine(new string('-', expectedBytePositionInLine - 1) + '^');\n\t\t\tTestConsole.WriteLine();\n\t\t\tTestConsole.WriteLine(\"Actual error\");\n\t\t\tTestConsole.WriteLine(schemaStr.Split('\\n')[exception!.LineNumber ?? 0]);\n\t\t\tTestConsole.WriteLine(new string('-', (int)(exception.BytePositionInLine ?? 0) - 1) + '^');\n\t\t\tAssert.That(exception.LineNumber, Is.EqualTo(expectedLineNumber));\n\t\t\tAssert.That(exception.BytePositionInLine, Is.EqualTo(expectedBytePositionInLine));\n\t\t});\n\t}", + "snippet": "\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions{OutputFormat = OutputFormat.List});\n\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/435\n\t[Test]" + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (9/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L961-L1080", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 961, + "endLine": 1080, + "content": "// https://github.com/json-everything/json-everything/issues/600\n\t[Test]\n\tpublic void Issue600_BaseDocumentOutputSchemaLocation()\n\t{\n\t\tvar file = GetFile(600, \"schema\");\n\t\tvar text = File.ReadAllText(file);\n\n\t\tvar baseDocumentJson = JsonDocument.Parse(text).RootElement;\n\t\tvar baseDocument = new JsonElementBaseDocument(baseDocumentJson, new Uri(\"http://localhost/v1\"));\n\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tbuildOptions.SchemaRegistry.Register(baseDocument);\n\n\t\t// Create a schema that refs into the base document at the schema location\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Ref(\"http://localhost/v1#/components/parameters/user/content/application~1json/schema\")\n\t\t\t.Build();\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"{\"foo-name\": \"foo\", \"last-name\": \"bar\"}\"\"\").RootElement;\n\n\t\tvar options = new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical };\n\t\tvar result = schema.Evaluate(instance, options);\n\n\t\tresult.AssertInvalid();\n\n\t\tvar targetSchemaLocation = result.Details![0].Details![0].Details![0].SchemaLocation;\n\n\t\tAssert.That(targetSchemaLocation.OriginalString, Is.EqualTo(\"http://localhost/v1#/components/schemas/user/properties/last-name\"));\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/881\n\t[Test]\n\tpublic void Issue881_UsingSchema201909DateTimeValidationPassesWithOneOfSchema()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar file = GetFile(881, \"schema\");\n\n\t\tvar schema = JsonSchema.FromFile(file, buildOptions);\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"{\"oneOfDates\": \"2025-01-02T23:03:22.222Z\"}\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List, RequireFormatValidation = true });\n\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/881\n\t[Test]\n\tpublic void Issue881_UsingSchema201909DateValidationPassesWithOneOfSchema()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar file = GetFile(881, \"schema\");\n\n\t\tvar schema = JsonSchema.FromFile(file, buildOptions);\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"{\"oneOfDates\": \"2025-01-02\"}\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List, RequireFormatValidation = true });\n\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/881\n\t[Test]\n\tpublic void Issue881_UsingSchema201909DateValidationFailsAgainstDateTimeFormat()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar file = GetFile(881, \"schema\");\n\n\t\tvar schema = JsonSchema.FromFile(file, buildOptions);\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"{\"dateWithDateFormat\": \"2025-01-02T23:03:22.222Z\"}\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List, RequireFormatValidation = true });\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/881\n\t[Test]\n\tpublic void Issue881_UsingSchema201909DateValidationPassesAgainstDateFormat()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar file = GetFile(881, \"schema\");\n\n\t\tvar schema = JsonSchema.FromFile(file, buildOptions);\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"{\"dateWithDateFormat\": \"2025-01-02\"}\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List, RequireFormatValidation = true });\n\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/881\n\t[Test]\n\tpublic void Issue881_UsingSchema201909TimeValidationFailsAgainstDateTimeFormat()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar file = GetFile(881, \"schema\");\n\n\t\tvar schema = JsonSchema.FromFile(file, buildOptions);\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"{\"timeWithTimeFormat\": \"2025-01-02T23:03:22.222Z\"}\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List, RequireFormatValidation = true });\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/881\n\t[Test]\n\tpublic void Issue881_UsingSchema201909TimeValidationPassesAgainstTimeFormat()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\tvar file = GetFile(881, \"schema\");\n\n\t\tvar schema = JsonSchema.FromFile(file, buildOptions);", + "snippet": "// https://github.com/json-everything/json-everything/issues/600\n\t[Test]\n\tpublic void Issue600_BaseDocumentOutputSchemaLocation()\n\t{\n\t\tvar file = GetFile(600, \"schema\");\n\t\tvar text = File.ReadAllText(file);\n\n\t\tvar baseDo" + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (10/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L1081-L1200", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 1081, + "endLine": 1200, + "content": "var instance = JsonDocument.Parse(\"\"\"{\"timeWithTimeFormat\": \"23:03:22Z\"}\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List, RequireFormatValidation = true });\n\n\t\tresult.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/664\n\t[Test]\n\tpublic void Issue664_UIntConstNotValidating()\n\t{\n\t\tvar schema = new JsonSchemaBuilder()\n\t\t\t.Title(\"Schema with const UInt\")\n\t\t\t.Properties((\"prop\", new JsonSchemaBuilder().Const((uint)1)))\n\t\t\t.AdditionalProperties(false)\n\t\t\t.Build();\n\n\n\t\tvar json = \"\"\"{\"prop\":1}\"\"\";\n\t\tvar jsonDocumentInstance = JsonDocument.Parse(json).RootElement;\n\n\n\t\tvar schemaText = JsonSerializer.Serialize(schema, TestSerializerContext.Default.JsonSchema);\n\t\tvar schemaFromString = JsonSchema.FromText(schemaText);\n\n\t\tvar directEvaluationResult = schema.Evaluate(jsonDocumentInstance, new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.List,\n\t\t\tRequireFormatValidation = true\n\t\t});\n\n\t\tvar evaluationResultFromSchema = schemaFromString.Evaluate(jsonDocumentInstance, new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.List,\n\t\t\tRequireFormatValidation = true\n\t\t});\n\n\t\tdirectEvaluationResult.AssertValid();\n\t\tevaluationResultFromSchema.AssertValid();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/791\n\t[Test]\n\tpublic void Issue791_DecoratedClass()\n\t{\n\t\tVerify791();\n\n\t\tRun791();\n\t}\n\n\t// https://github.com/json-everything/json-everything/issues/791\n\t[Test]\n\tpublic void Issue791_UndecoratedClass()\n\t{\n\t\tValidatingJsonConverter.MapType(Model791Schema);\n\t\tRun791();\n\t}\n\n\tprivate static void Verify791()\n\t{\n\t\tvar jsonText = \"\"\"{ \"Foo\": \"foo\", \"Bar\": -42 }\"\"\";\n\t\tvar node = JsonDocument.Parse(jsonText).RootElement;\n\n\t\tvar results = Model791Schema.Evaluate(node, new EvaluationOptions { OutputFormat = OutputFormat.List });\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(results, TestEnvironment.TestOutputSerializerOptions));\n\t}\n\n\tprivate static void Run791()\n\t{\n\t\tvar jsonText = \"\"\"{ \"Foo\": \"foo\", \"Bar\": -42 }\"\"\";\n\t\tvar converter = new ValidatingJsonConverter { EvaluationOptions = { OutputFormat = OutputFormat.List } };\n\t\tvar options = new JsonSerializerOptions(TestEnvironment.TestOutputSerializerOptions) { Converters = { converter } };\n\t\tvar ex = Assert.Throws(() => JsonSerializer.Deserialize(jsonText, options));\n\t\tvar result = ex.Data[\"validation\"] as EvaluationResults;\n\t\tAssert.That(result, Is.Not.Null);\n\t\tAssert.That(result.Details, Has.Count.GreaterThan(0));\n\t}\n\n#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.\n\t// ReSharper disable ClassNeverInstantiated.Local\n\t[JsonSchema(typeof(GithubTests), nameof(Model791Schema))]\n\tpublic class Model791\n\t{\n\t\tpublic string Foo { get; set; }\n\t\tpublic int Bar { get; set; }\n\t\tpublic DateTime Baz { get; set; }\n\t}\n\n\tpublic class Model791Undecorated\n\t{\n\t\tpublic string Foo { get; set; }\n\t\tpublic int Bar { get; set; }\n\t\tpublic DateTime Baz { get; set; }\n\t}\n\t// ReSharper restore ClassNeverInstantiated.Local\n#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.\n\n\tpublic static readonly JsonSchema Model791Schema =\n\t\tnew JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(nameof(Model791.Foo), new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.MinLength(10)\n\t\t\t\t\t.MaxLength(50)\n\t\t\t\t),\n\t\t\t\t(nameof(Model791.Bar), new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Minimum(0)\n\t\t\t\t),\n\t\t\t\t(nameof(Model791.Baz), new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.Format(Formats.DateTime)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Required(nameof(Model791.Baz))\n\t\t\t.Build();\n\n\t[Test]\n\tpublic void Issue965_StackOverflow()", + "snippet": "var instance = JsonDocument.Parse(\"\"\"{\"timeWithTimeFormat\": \"23:03:22Z\"}\"\"\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List, RequireFormatValidation = true" + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (11/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L1201-L1320", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 1201, + "endLine": 1320, + "content": "{\n\t\tvar schemaJson = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n\t\t\t \"$id\": \"https://json-everything.test/overflow\",\n\t\t\t \"$ref\": \"#/$defs/modelDefinition\",\n\t\t\t \"$defs\": {\n\t\t\t \"modelDefinition\": {\n\t\t\t \"type\": \"object\",\n\t\t\t \"additionalProperties\": {\n\t\t\t \"$ref\": \"#/$defs/modelDefinition\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t};\n\t\tvar schema = JsonSchema.Build(schemaJson, buildOptions);\n\t}\n\n\t[Test]\n\tpublic void Issue965_StackOverflow_Definitions()\n\t{\n\t\tvar schemaJson = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n\t\t\t \"$id\": \"https://json-everything.test/overflow\",\n\t\t\t \"$ref\": \"#/definitions/modelDefinition\",\n\t\t\t \"definitions\": {\n\t\t\t \"modelDefinition\": {\n\t\t\t \"type\": \"object\",\n\t\t\t \"additionalProperties\": {\n\t\t\t \"$ref\": \"#/definitions/modelDefinition\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t};\n\t\tvar schema = JsonSchema.Build(schemaJson, buildOptions);\n\t}\n\n\t[Test]\n\tpublic void Issue966_AdditionalPropertiesThroughRef()\n\t{\n\t\tvar schemaJson = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$id\": \"ID\",\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema#\",\n\t\t\t \"title\": \"TITLE\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"incident\": {\n\t\t\t \"$ref\": \"#/$defs/Incident\"\n\t\t\t }\n\t\t\t },\n\t\t\t \"$defs\": {\n\t\t\t \"Incident\": {\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"incidentType\": {\n\t\t\t \"$ref\": \"#/$defs/IncidentType\"\n\t\t\t }\n\t\t\t },\n\t\t\t \"additionalProperties\": false\n\t\t\t },\n\t\t\t \"IncidentType\": {\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"incidentClassification\": {\n\t\t\t \"type\": \"array\",\n\t\t\t \"items\": {\n\t\t\t \"type\": \"string\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"incident\": {\n\t\t\t \"incidentType\": {\n\t\t\t \"incidentClassification\": [\n\t\t\t \"something\",\n\t\t\t \"something-else\"\n\t\t\t ]\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t};\n\t\tvar schema = JsonSchema.Build(schemaJson, buildOptions);\n\n\t\tvar evaluationOptions = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t};\n\t\tvar results = schema.Evaluate(instance, evaluationOptions);\n\n\t\tresults.AssertValid();\n\t}", + "snippet": "{\n\t\tvar schemaJson = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n\t\t\t \"$id\": \"https://json-everything.test/overflow\",\n\t\t\t \"$ref\": \"#/$defs/modelDefinition\",\n\t\t\t \"$defs\": {" + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (12/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L1321-L1440", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 1321, + "endLine": 1440, + "content": "[Test]\n\tpublic void Issue973_FetchFiles()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t\t{\n\t\t\t\tFetch = (uri, self) =>\n\t\t\t\t{\n\t\t\t\t\tif (uri.IsFile)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn JsonSchema.FromFile(uri.AbsolutePath, new()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tSchemaRegistry = self,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tvar schemaFile = GetFile(973, \"schema\");\n\t\tvar instance = JsonDocument.Parse(\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"propA\": \"a string\",\n\t\t\t \"propB\": 42\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\n\t\tvar schema = JsonSchema.FromFile(schemaFile, buildOptions);\n\t\tvar results = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tresults.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void Issue1042_NestedRecursion()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t};\n\n\t\tvar schema = new JsonSchemaBuilder(buildOptions).AllOf(new JsonSchemaBuilder().Ref(\"#\"));\n\t\tvar instance = JsonDocument.Parse(\"{}\");\n\n\t\tAssert.Throws(() => schema.Evaluate(instance.RootElement));\n\t}\n\n\t[Test]\n\tpublic void Issue1044_DefsBeforeId()\n\t{\n\t\tconst string schemaText =\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$defs\": { \"a\": { \"type\": \"string\" }, \"b\": { \"type\": \"integer\" } },\n\t\t\t \"$id\": \"https://example.com/id-after-defs.json\",\n\t\t\t \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": { \"x\": { \"$ref\": \"#/$defs/a\" }, \"y\": { \"$ref\": \"#/$defs/b\" } }\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tvar options = new BuildOptions { SchemaRegistry = new SchemaRegistry() };\n\t\tvar schema = JsonSchema.FromText(schemaText, options);\n\n\t\t// The internal `#/$defs/...` refs resolve against the base URI that `$id` establishes;\n\t\t// if that base were wrong (the pre-fix placeholder) they would not resolve correctly.\n\t\tvar valid = schema.Evaluate(JsonDocument.Parse(@\"{ \"\"x\"\": \"\"hello\"\", \"\"y\"\": 5 }\").RootElement);\n\t\tAssert.That(valid.IsValid, Is.True);\n\n\t\tvar invalid = schema.Evaluate(JsonDocument.Parse(@\"{ \"\"x\"\": 5, \"\"y\"\": \"\"nope\"\" }\").RootElement);\n\t\tAssert.That(invalid.IsValid, Is.False);\n\t}\n\n\t[Test]\n\tpublic void Issue1044_PropertiesBeforeId()\n\t{\n\t\t// No `$defs` and no `$ref`: two subschemas under `properties` built before a late\n\t\t// `$id` are by themselves enough to trigger the registration collision.\n\t\tconst string schemaText = \n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"properties\": { \"a\": { \"type\": \"string\" }, \"b\": { \"type\": \"number\" } },\n\t\t\t \"$id\": \"https://example.com/props-before-id.json\",\n\t\t\t \"type\": \"object\"\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tvar options = new BuildOptions { SchemaRegistry = new SchemaRegistry() };\n\t\tAssert.DoesNotThrow(() => JsonSchema.FromText(schemaText, options));\n\t}\n\n\t[Test]\n\tpublic void Issue1044_IdPosition()\n\t{\n\t\t// `$id` before vs after the subschema keywords must build and evaluate equivalently.\n\t\tconst string idFirst =\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$id\": \"https://example.com/order-a.json\",\n\t\t\t \"$defs\": { \"s\": { \"type\": \"string\" } },\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": { \"x\": { \"$ref\": \"#/$defs/s\" } }\n\t\t\t}\n\t\t\t\"\"\";\n\t\tconst string idLast =\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"$defs\": { \"s\": { \"type\": \"string\" } },\n\t\t\t \"properties\": { \"x\": { \"$ref\": \"#/$defs/s\" } },\n\t\t\t \"type\": \"object\",\n\t\t\t \"$id\": \"https://example.com/order-b.json\"\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tvar a = JsonSchema.FromText(idFirst, new BuildOptions { SchemaRegistry = new SchemaRegistry() });\n\t\tvar b = JsonSchema.FromText(idLast, new BuildOptions { SchemaRegistry = new SchemaRegistry() });", + "snippet": "[Test]\n\tpublic void Issue973_FetchFiles()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t\t{\n\t\t\t\tFetch = (uri, self) =>\n\t\t\t\t{\n\t\t\t\t\tif (uri.IsFile)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn JsonSchema.FromFile(uri.Abso" + }, + { + "title": "src/JsonSchema.Tests/GithubTests.cs (13/13)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/GithubTests.cs#L1441-L1450", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/GithubTests.cs", + "startLine": 1441, + "endLine": 1450, + "content": "var good = JsonDocument.Parse(@\"{ \"\"x\"\": \"\"ok\"\" }\").RootElement;\n\t\tAssert.That(a.Evaluate(good).IsValid, Is.True);\n\t\tAssert.That(b.Evaluate(good).IsValid, Is.True);\n\n\t\tvar bad = JsonDocument.Parse(@\"{ \"\"x\"\": 1 }\").RootElement;\n\t\tAssert.That(a.Evaluate(bad).IsValid, Is.False);\n\t\tAssert.That(b.Evaluate(bad).IsValid, Is.False);\n\t}\n}", + "snippet": "var good = JsonDocument.Parse(@\"{ \"\"x\"\": \"\"ok\"\" }\").RootElement;\n\t\tAssert.That(a.Evaluate(good).IsValid, Is.True);\n\t\tAssert.That(b.Evaluate(good).IsValid, Is.True);\n\n\t\tvar bad = JsonDocument.Parse(@\"{ \"\"x\"\": 1 }\").RootEl" + }, + { + "title": "src/JsonSchema.Tests/JsonMathTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/JsonMathTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/JsonMathTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class JsonMathTests\n{\n\t[TestCase(\"42\", \"42\", 0)]\n\t[TestCase(\"3.14159\", \"3.14159\", 0)]\n\t[TestCase(\"1.0\", \"1\", 0)]\n\t[TestCase(\"0.5\", \"0.50\", 0)]\n\t[TestCase(\"1.23e2\", \"123\", 0)]\n\t[TestCase(\"1.23e-2\", \"0.0123\", 0)]\n\t[TestCase(\"0\", \"0.0\", 0)]\n\t[TestCase(\"5\", \"10\", -1)]\n\t[TestCase(\"3.14\", \"3.15\", -1)]\n\t[TestCase(\"0.5\", \"5\", -1)]\n\t[TestCase(\"1e2\", \"1e3\", -1)]\n\t[TestCase(\"0.001\", \"0.01\", -1)]\n\t[TestCase(\"100\", \"50\", 1)]\n\t[TestCase(\"7.89\", \"7.88\", 1)]\n\t[TestCase(\"5e10\", \"5e9\", 1)]\n\t[TestCase(\"-42\", \"-42\", 0)]\n\t[TestCase(\"-10\", \"-5\", -1)]\n\t[TestCase(\"-5\", \"-10\", 1)]\n\t[TestCase(\"-5\", \"5\", -1)]\n\t[TestCase(\"5\", \"-5\", 1)]\n\t[TestCase(\"-3.14\", \"-3.15\", 1)]\n\t[TestCase(\"-1e5\", \"-1e4\", -1)]\n\t[TestCase(\"0\", \"1\", -1)]\n\t[TestCase(\"0\", \"-1\", 1)]\n\t[TestCase(\"999999999999999\", \"1000000000000000\", -1)]\n\t[TestCase(\"0.0000001\", \"0.0000002\", -1)]\n\t[TestCase(\"1.5e+10\", \"15000000000\", 0)]\n\t[TestCase(\"5e2\", \"500\", 0)]\n\t[TestCase(\"123\", \"124\", -1)]\n\t[TestCase(\"999\", \"998\", 1)]\n\t[TestCase(\"1.234567890123456\", \"1.234567890123457\", -1)]\n\t[TestCase(\"5.0\", \"5.00\", 0)]\n\t[TestCase(\"1e308\", \"1e307\", 1)]\n\t[TestCase(\"1e-308\", \"1e-307\", -1)]\n\t[TestCase(\"10\", \"10.5\", -1)]\n\t[TestCase(\"0.00001\", \"1e-5\", 0)]\n\t[TestCase(\"0\", \"-0\", 0)]\n\t[TestCase(\"1.0000000000000001\", \"1.0000000000000002\", -1)]\n\t[TestCase(\"12345678901234567890\", \"12345678901234567891\", -1)]\n\t[TestCase(\"123\", \"1234\", -1)]\n\t[TestCase(\"1.5E10\", \"1.5e10\", 0)]\n\t[TestCase(\"0.1\", \"0.2\", -1)]\n\t[TestCase(\"0.12\", \"0.13\", -1)]\n\t[TestCase(\"0.12\", \"0\", 1)]\n\t[TestCase(\"0.0\", \"0.6\", -1)]\n\tpublic void NumberCompare(string aJson, string bJson, int expected)\n\t{\n\t\tvar a = JsonDocument.Parse(aJson).RootElement;\n\t\tvar b = JsonDocument.Parse(bJson).RootElement;\n\t\t\n\t\tAssert.That(JsonMath.NumberCompare(a, b), Is.EqualTo(expected));\n\t}\n\n\t[TestCase(\"10\", \"5\", true)]\n\t[TestCase(\"10\", \"3\", false)]\n\t[TestCase(\"100\", \"10\", true)]\n\t[TestCase(\"100\", \"7\", false)]\n\t[TestCase(\"15\", \"3\", true)]\n\t[TestCase(\"15\", \"4\", false)]\n\t[TestCase(\"0\", \"5\", true)]\n\t[TestCase(\"5\", \"0\", false)]\n\t[TestCase(\"0\", \"0\", false)]\n\t[TestCase(\"1\", \"1\", true)]\n\t[TestCase(\"42\", \"1\", true)]\n\t[TestCase(\"1\", \"2\", false)]\n\t[TestCase(\"0.5\", \"0.25\", true)]\n\t[TestCase(\"0.5\", \"0.3\", false)]\n\t[TestCase(\"1.5\", \"0.5\", true)]\n\t[TestCase(\"1.5\", \"0.4\", false)]\n\t[TestCase(\"3.6\", \"1.2\", true)]\n\t[TestCase(\"3.6\", \"1.1\", false)]\n\t[TestCase(\"0.1\", \"0.05\", true)]\n\t[TestCase(\"0.1\", \"0.03\", false)]\n\t[TestCase(\"100\", \"0.5\", true)]\n\t[TestCase(\"100\", \"0.3\", false)]\n\t[TestCase(\"1e2\", \"10\", true)]\n\t[TestCase(\"1e2\", \"7\", false)]\n\t[TestCase(\"1e3\", \"1e2\", true)]\n\t[TestCase(\"1e3\", \"3e2\", false)]\n\t[TestCase(\"5e10\", \"5e9\", true)]\n\t[TestCase(\"5e10\", \"3e9\", false)]\n\t[TestCase(\"1.23e2\", \"41\", true)]\n\t[TestCase(\"1.23e2\", \"40\", false)]\n\t[TestCase(\"0.001\", \"0.0005\", true)]\n\t[TestCase(\"0.001\", \"0.0003\", false)]\n\t[TestCase(\"-10\", \"5\", true)]\n\t[TestCase(\"-10\", \"3\", false)]\n\t[TestCase(\"10\", \"-5\", true)]\n\t[TestCase(\"10\", \"-3\", false)]\n\t[TestCase(\"-10\", \"-5\", true)]\n\t[TestCase(\"-10\", \"-3\", false)]\n\t[TestCase(\"1000000\", \"1000\", true)]\n\t[TestCase(\"1000000\", \"999\", false)]\n\t[TestCase(\"99999\", \"33333\", true)]\n\t[TestCase(\"99999\", \"33334\", false)]\n\t[TestCase(\"0.0000001\", \"0.00000005\", true)]\n\t[TestCase(\"0.0000001\", \"0.00000003\", false)]\n\t[TestCase(\"144\", \"12\", true)]\n\t[TestCase(\"144\", \"13\", false)]\n\t[TestCase(\"256\", \"16\", true)]\n\t[TestCase(\"256\", \"15\", false)]\n\t[TestCase(\"1024\", \"32\", true)]\n\t[TestCase(\"1024\", \"31\", false)]\n\t[TestCase(\"7.5\", \"2.5\", true)]\n\t[TestCase(\"7.5\", \"2.0\", false)]\n\t[TestCase(\"12.5\", \"2.5\", true)]\n\t[TestCase(\"12.5\", \"3.0\", false)]\n\t[TestCase(\"0.125\", \"0.025\", true)]\n\t[TestCase(\"0.125\", \"0.03\", false)]\n\t[TestCase(\"1000\", \"125\", true)]\n\t[TestCase(\"1000\", \"111\", false)]\n\t[TestCase(\"9999\", \"3\", true)]\n\t[TestCase(\"9999\", \"4\", false)]", + "snippet": "using System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class JsonMathTests\n{\n\t[TestCase(\"42\", \"42\", 0)]\n\t[TestCase(\"3.14159\", \"3.14159\", 0)]\n\t[TestCase(\"1.0\", \"1\", 0)]\n\t[TestCase(\"0.5\", \"0.5" + }, + { + "title": "src/JsonSchema.Tests/JsonMathTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/JsonMathTests.cs#L121-L145", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/JsonMathTests.cs", + "startLine": 121, + "endLine": 145, + "content": "[TestCase(\"1.00\", \"0.25\", true)]\n\t[TestCase(\"1.00\", \"0.3\", false)]\n\t[TestCase(\"50\", \"0.5\", true)]\n\t[TestCase(\"50\", \"0.7\", false)]\n\t[TestCase(\"1.2345678901234567890\", \"0.12345678901234567890\", true)]\n\t[TestCase(\"1.2345678901234567890\", \"0.11111111111111111111\", false)]\n\t[TestCase(\"9999999999999999999\", \"3333333333333333333\", true)]\n\t[TestCase(\"9999999999999999999\", \"3333333333333333334\", false)]\n\t[TestCase(\"0.123456789012345678901234567890\", \"0.00123456789012345678901234567890\", true)]\n\t[TestCase(\"0.123456789012345678901234567890\", \"0.00111111111111111111111111111111\", false)]\n\t[TestCase(\"999999999999999999999999999999\", \"111111111111111111111111111111\", true)]\n\t[TestCase(\"999999999999999999999999999999\", \"111111111111111111111111111112\", false)]\n\t[TestCase(\"1e20\", \"1e10\", true)]\n\t[TestCase(\"1e20\", \"3e10\", false)]\n\t[TestCase(\"1.23456789e15\", \"123456789\", true)]\n\t[TestCase(\"1.23456789e15\", \"123456788\", false)]\n\tpublic void Divides(string dividendJson, string divisorJson, bool expected)\n\t{\n\t\tvar dividend = JsonDocument.Parse(dividendJson).RootElement;\n\t\tvar divisor = JsonDocument.Parse(divisorJson).RootElement;\n\t\t\n\t\tAssert.That(JsonMath.Divides(dividend, divisor), Is.EqualTo(expected));\n\t}\n}", + "snippet": "[TestCase(\"1.00\", \"0.25\", true)]\n\t[TestCase(\"1.00\", \"0.3\", false)]\n\t[TestCase(\"50\", \"0.5\", true)]\n\t[TestCase(\"50\", \"0.7\", false)]\n\t[TestCase(\"1.2345678901234567890\", \"0.12345678901234567890\", true)]\n\t[TestCase(\"1.2345678" + }, + { + "title": "src/JsonSchema.Tests/LearnJsonEverythingTestFixture.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/LearnJsonEverythingTestFixture.cs#L1-L60", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/LearnJsonEverythingTestFixture.cs", + "startLine": 1, + "endLine": 60, + "content": "#if DEBUG\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class LearnJsonEverythingTestFixture\n{\n\tpublic static IEnumerable TestCases\n\t{\n\t\tget\n\t\t{\n\t\t\tyield return new TestCaseData(JsonDocument.Parse(\"\"\"{\"instance\": \"foo\",\"values\": [\"foo\", \"bar\", \"baz\", \"quux\"],\"isValid\": true}\"\"\").RootElement);\n\t\t\tyield return new TestCaseData(JsonDocument.Parse(\"\"\"{\"instance\": \"foo\",\"values\": [\"foo\", \"bar\"],\"isValid\": false}\"\"\").RootElement);\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(TestCases))]\n\t[Ignore(\"Dev test for learning site\")]\n\tpublic void RunCases(JsonElement data)\n\t{\n\t\tvar result = Run(data);\n\t\tvar expected = data.GetProperty(\"isValid\").GetBoolean();\n\t\tAssert.That(result.IsValid, Is.EqualTo(expected));\n\t}\n\n\tprivate static EvaluationResults Run(JsonElement test)\n\t{\n\t\tvar instance = test.GetProperty(\"instance\");\n\t\tvar values = test.GetProperty(\"values\");\n\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new(),\n\t\t\tDialect = Dialect.Draft201909\n\t\t};\n\n\t\tvar metaSchemaId = new Uri(\"https://learn.json-everything.net/schemas/meta-schema\");\n\t\tJsonSchema metaSchema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Id(metaSchemaId)\n\t\t\t.Vocabulary(\n\t\t\t\t(Vocabulary.Draft202012_Core.Id, true),\n\t\t\t\t(Vocabulary.Draft202012_Applicator.Id, true),\n\t\t\t\t(Vocabulary.Draft202012_Validation.Id, true)\n\t\t\t)\n\t\t\t.Properties(\n\t\t\t\t(\"enum\", new JsonSchemaBuilder().MinItems(3))\n\t\t\t);\n\n\t\tJsonSchema schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(metaSchemaId)\n\t\t\t.Enum(values.EnumerateArray().Select(x => x.GetString()!));\n\n\t\treturn schema.Evaluate(instance);\n\t}\n}\n#endif", + "snippet": "#if DEBUG\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class LearnJsonEverythingTestFixture\n{\n\tpublic static IEnu" + }, + { + "title": "src/JsonSchema.Tests/LocalizationTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/LocalizationTests.cs#L1-L114", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/LocalizationTests.cs", + "startLine": 1, + "endLine": 114, + "content": "using System.Globalization;\nusing System.Text.Json;\nusing System.Threading.Tasks;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class LocalizationTests\n{\n\t[Test, SetCulture(\"en-US\")]\n\tpublic void MinimumReturnsDefaultErrorMessage()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.Minimum(10);\n\n\t\tvar instance = JsonDocument.Parse(\"5\").RootElement;\n\n\t\tvar results = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tvar message = results.Errors![\"minimum\"];\n\n\t\tAssert.That(message, Is.EqualTo(\"5 should be at least 10\"));\n\t}\n\n\t[Test]\n\t[Ignore(\"Can't test localization since resource file is in a separate dll now.\")]\n\tpublic void MinimumReturnsDefaultErrorMessageButInSpanish()\n\t{\n\t\ttry\n\t\t{\n\t\t\tErrorMessages.Culture = CultureInfo.GetCultureInfo(\"es-es\");\n\n\t\t\tJsonSchema schema = new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Number)\n\t\t\t\t.Minimum(10);\n\n\t\t\tvar instance = JsonDocument.Parse(\"5\").RootElement;\n\n\t\t\tvar results = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\t\tvar message = results.Errors![\"minimum\"];\n\n\t\t\tAssert.That(message, Is.EqualTo(\"5 es menor o igual que 10\"));\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tErrorMessages.Culture = null;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void MinimumReturnsCustomErrorMessage()\n\t{\n\t\ttry\n\t\t{\n\t\t\tErrorMessages.Minimum = \"This is a custom error message with [[received]] and [[limit]]\";\n\n\t\t\tJsonSchema schema = new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Number)\n\t\t\t\t.Minimum(10);\n\n\t\t\tvar instance = JsonDocument.Parse(\"5\").RootElement;\n\n\t\t\tvar results = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\t\tvar message = results.Errors![\"minimum\"];\n\n\t\t\tAssert.That(message, Is.EqualTo(\"This is a custom error message with 5 and 10\"));\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tErrorMessages.Minimum = null!;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic async Task DifferentCulturesInParallel()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Number)\n\t\t\t.Minimum(10);\n\t\tvar instance = JsonDocument.Parse(\"5\").RootElement;\n\n\t\tstring RunWithCulture(CultureInfo culture)\n\t\t{\n\t\t\tvar results = schema.Evaluate(instance, new EvaluationOptions\n\t\t\t{\n\t\t\t\tOutputFormat = OutputFormat.Hierarchical,\n\t\t\t\tCulture = culture\n\t\t\t});\n\n\t\t\treturn results.Errors![\"minimum\"];\n\t\t}\n\n\t\ttry\n\t\t{\n\t\t\tvar messages = await Task.WhenAll(\n\t\t\t\tTask.Run(() => RunWithCulture(CultureInfo.GetCultureInfo(\"es\"))),\n\t\t\t\tTask.Run(() => RunWithCulture(CultureInfo.GetCultureInfo(\"en-us\")))\n\t\t\t);\n\n\t\t\tAssert.Multiple(() =>\n\t\t\t{\n\t\t\t\tAssert.That(messages[0], Is.EqualTo(\"5 es menor o igual que 10\"));\n\t\t\t\tAssert.That(messages[1], Is.EqualTo(\"5 should be at least 10\"));\n\t\t\t});\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tErrorMessages.Culture = null;\n\t\t}\n\t}\n}", + "snippet": "using System.Globalization;\nusing System.Text.Json;\nusing System.Threading.Tasks;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class LocalizationTests\n{\n\t[Test, SetCulture(\"en-US\")]\n\tpublic void MinimumRe" + }, + { + "title": "src/JsonSchema.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Tests/obj/Debug/net10.0/JsonSchema.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Debug/net10.0/JsonSchema.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Debug/net10.0/JsonSchema.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Tests/obj/Debug/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Debug/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Debug/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETFramework,Version=v4.8.1\", FrameworkDisplayName = \".NET Framework 4.8.1\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETFramework,Version=v4.8.1\", FrameworkDisplayName = \".NET Framework 4.8.1\")]" + }, + { + "title": "src/JsonSchema.Tests/obj/Debug/net481/JsonSchema.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Debug/net481/JsonSchema.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Debug/net481/JsonSchema.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Tests/obj/Debug/net8.0/JsonSchema.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Debug/net8.0/JsonSchema.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Debug/net8.0/JsonSchema.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Tests/obj/Debug/net9.0/JsonSchema.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Debug/net9.0/JsonSchema.Tests.AssemblyInfo.cs#L1-L23", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Debug/net9.0/JsonSchema.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 23, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+6f7c4cc65192539b1f711a15f2e8b453fad7f28c\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n//\n// Changes to this file may cause incorrect behavior and will be lost " + }, + { + "title": "src/JsonSchema.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema.Tests/obj/Release/net10.0/JsonSchema.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Release/net10.0/JsonSchema.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Release/net10.0/JsonSchema.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Tests/obj/Release/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Release/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Release/net481/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETFramework,Version=v4.8.1\", FrameworkDisplayName = \".NET Framework 4.8.1\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETFramework,Version=v4.8.1\", FrameworkDisplayName = \".NET Framework 4.8.1\")]" + }, + { + "title": "src/JsonSchema.Tests/obj/Release/net481/JsonSchema.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Release/net481/JsonSchema.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Release/net481/JsonSchema.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema.Tests/obj/Release/net8.0/JsonSchema.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Release/net8.0/JsonSchema.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Release/net8.0/JsonSchema.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema.Tests/obj/Release/net9.0/JsonSchema.Tests.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/obj/Release/net9.0/JsonSchema.Tests.AssemblyInfo.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/obj/Release/net9.0/JsonSchema.Tests.AssemblyInfo.cs", + "startLine": 1, + "endLine": 24, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"1.0.0.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"1.0.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Tests\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"1.0.0.0\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema.Tests/OutputTests.cs (1/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/OutputTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/OutputTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\nusing Json.Schema.Keywords;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\n[TestFixture, SetCulture(\"en-US\")]\npublic class OutputTests\n{\n\tstatic OutputTests()\n\t{\n\t\t_schema = new JsonSchemaBuilder(_buildOptions)\n\t\t\t.Id(\"https://json-everything.test/schema\")\n\t\t\t.Defs(\n\t\t\t\t(\"integer\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"minimum\", new JsonSchemaBuilder().Minimum(5))\n\t\t\t)\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"passes\", true),\n\t\t\t\t(\"fails\", false),\n\t\t\t\t(\"refs\", new JsonSchemaBuilder().Ref(\"#/$defs/integer\")),\n\t\t\t\t(\"multi\", new JsonSchemaBuilder()\n\t\t\t\t\t.AllOf(\n\t\t\t\t\t\tnew JsonSchemaBuilder().Ref(\"#/$defs/integer\"),\n\t\t\t\t\t\tnew JsonSchemaBuilder().Ref(\"#/$defs/minimum\")\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t}\n\n\tprivate static readonly BuildOptions _buildOptions = new() { SchemaRegistry = new() };\n\tprivate static readonly JsonSchema _schema;\n\n\t[Test]\n\tpublic void Flag_Success()\n\t{\n\t\tvar result = Validate(\"{\\\"passes\\\":\\\"value\\\"}\", OutputFormat.Flag);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": true\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tresult.AssertValid(expected);\n\t}\n\n\t[Test]\n\tpublic void Flag_Failure()\n\t{\n\t\tvar result = Validate(\"{\\\"fails\\\":\\\"value\\\"}\", OutputFormat.Flag);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": false\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tresult.AssertInvalid(expected);\n\t}\n\n\t[Test]\n\tpublic void Basic_Success()\n\t{\n\t\tvar result = Validate(\"{\\\"passes\\\":\\\"value\\\"}\", OutputFormat.List);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": true,\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#\",\n\t\t\t \"instanceLocation\": \"\",\n\t\t\t \"annotations\": {\n\t\t\t \"properties\": [ \"passes\" ]\n\t\t\t }\n\t\t\t },\n\t\t\t {\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"/properties/passes\",\n\t\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/passes\",\n\t\t\t\t \"instanceLocation\": \"/passes\"\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tresult.AssertValid(expected);\n\t}\n\n\t[Test]\n\tpublic void Basic_Failure()\n\t{\n\t\tvar result = Validate(\"{\\\"fails\\\":\\\"value\\\"}\", OutputFormat.List);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": false,\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#\",\n\t\t\t\t \"instanceLocation\": \"\"\n\t\t\t\t},\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"/properties/fails\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/fails\",\n\t\t\t \"instanceLocation\": \"/fails\",\n\t\t\t \"errors\": {\n\t\t\t \"\": \"All values fail against the false schema\"\n\t\t\t }\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\";", + "snippet": "using System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\nusing Json.Schema.Keywords;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\n[TestFixture, SetCulture(\"en-US\")]\npublic class OutputTe" + }, + { + "title": "src/JsonSchema.Tests/OutputTests.cs (2/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/OutputTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/OutputTests.cs", + "startLine": 121, + "endLine": 240, + "content": "result.AssertInvalid(expected);\n\t}\n\n\t[Test]\n\tpublic void Hierarchical_Success()\n\t{\n\t\tvar result = Validate(\"{\\\"passes\\\":\\\"value\\\"}\", OutputFormat.Hierarchical);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#\",\n\t\t\t \"instanceLocation\": \"\",\n\t\t\t \"annotations\": {\n\t\t\t \"properties\": [\n\t\t\t \"passes\"\n\t\t\t ]\n\t\t\t },\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"/properties/passes\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/passes\",\n\t\t\t \"instanceLocation\": \"/passes\"\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tresult.AssertValid(expected);\n\t}\n\n\t[Test]\n\tpublic void Hierarchical_Failure()\n\t{\n\t\tvar result = Validate(\"{\\\"fails\\\":\\\"value\\\"}\", OutputFormat.Hierarchical);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#\",\n\t\t\t \"instanceLocation\": \"\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"/properties/fails\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/fails\",\n\t\t\t \"instanceLocation\": \"/fails\",\n\t\t\t \"errors\": {\n\t\t\t \"\": \"All values fail against the false schema\"\n\t\t\t }\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\";\n\t\tresult.AssertInvalid(expected);\n\t}\n\n\t[Test]\n\tpublic void Hierarchical_Failure_WithDroppedAnnotations()\n\t{\n\t\tvar instance = JsonDocument.Parse(\"{\\\"fails\\\":\\\"value\\\"}\").RootElement;\n\t\tvar options = EvaluationOptions.From(EvaluationOptions.Default);\n\t\toptions.OutputFormat = OutputFormat.Hierarchical;\n\t\toptions.PreserveDroppedAnnotations = true;\n\n\t\tvar result = _schema.Evaluate(instance, options);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#\",\n\t\t\t \"instanceLocation\": \"\",\n\t\t\t \"droppedAnnotations\": {\n\t\t\t \"properties\": [\n\t\t\t \"fails\"\n\t\t\t ]\n\t\t\t },\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"/properties/fails\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/fails\",\n\t\t\t \"instanceLocation\": \"/fails\",\n\t\t\t \"errors\": {\n\t\t\t \"\": \"All values fail against the false schema\"\n\t\t\t }\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\";\n\t\tresult.AssertInvalid(expected);\n\t}\n\n\t[Test]\n\tpublic void Hierarchical_Multi_Success()\n\t{\n\t\tvar result = Validate(\"{\\\"multi\\\":8}\", OutputFormat.Hierarchical);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#\",\n\t\t\t \"instanceLocation\": \"\",\n\t\t\t \"annotations\": {\n\t\t\t \"properties\": [\n\t\t\t \"multi\"\n\t\t\t ]\n\t\t\t },\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"/properties/multi\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/multi\",\n\t\t\t \"instanceLocation\": \"/multi\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"/properties/multi/allOf/0\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/multi/allOf/0\",", + "snippet": "result.AssertInvalid(expected);\n\t}\n\n\t[Test]\n\tpublic void Hierarchical_Success()\n\t{\n\t\tvar result = Validate(\"{\\\"passes\\\":\\\"value\\\"}\", OutputFormat.Hierarchical);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": true,\n\t\t\t \"evaluat" + }, + { + "title": "src/JsonSchema.Tests/OutputTests.cs (3/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/OutputTests.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/OutputTests.cs", + "startLine": 241, + "endLine": 360, + "content": "\"instanceLocation\": \"/multi\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"/properties/multi/allOf/0/$ref\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/$defs/integer\",\n\t\t\t \"instanceLocation\": \"/multi\"\n\t\t\t }\n\t\t\t ]\n\t\t\t },\n\t\t\t {\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"/properties/multi/allOf/1\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/multi/allOf/1\",\n\t\t\t \"instanceLocation\": \"/multi\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"/properties/multi/allOf/1/$ref\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/$defs/minimum\",\n\t\t\t \"instanceLocation\": \"/multi\"\n\t\t\t }\n\t\t\t ]\n\t\t\t }\n\t\t\t ]\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tresult.AssertValid(expected);\n\t}\n\n\t[Test]\n\tpublic void Hierarchical_Multi_Failure_Both()\n\t{\n\t\tvar result = Validate(\"{\\\"multi\\\":3.5}\", OutputFormat.Hierarchical);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#\",\n\t\t\t \"instanceLocation\": \"\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"/properties/multi\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/multi\",\n\t\t\t \"instanceLocation\": \"/multi\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"/properties/multi/allOf/0\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/multi/allOf/0\",\n\t\t\t \"instanceLocation\": \"/multi\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"/properties/multi/allOf/0/$ref\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/$defs/integer\",\n\t\t\t \"instanceLocation\": \"/multi\",\n\t\t\t \"errors\": {\n\t\t\t \"type\": \"Value is \\\"number\\\" but should be \\\"integer\\\"\"\n\t\t\t }\n\t\t\t }\n\t\t\t ]\n\t\t\t },\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"/properties/multi/allOf/1\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/multi/allOf/1\",\n\t\t\t \"instanceLocation\": \"/multi\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"/properties/multi/allOf/1/$ref\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/$defs/minimum\",\n\t\t\t \"instanceLocation\": \"/multi\",\n\t\t\t \"errors\": {\n\t\t\t \"minimum\": \"3.5 should be at least 5\"\n\t\t\t }\n\t\t\t }\n\t\t\t ]\n\t\t\t }\n\t\t\t ]\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tresult.AssertInvalid(expected);\n\t}\n\n\t[Test]\n\tpublic void Hierarchical_Multi_Failure_Integer()\n\t{\n\t\tvar result = Validate(\"{\\\"fails\\\":8.5}\", OutputFormat.Hierarchical);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#\",\n\t\t\t \"instanceLocation\": \"\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"/properties/fails\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/fails\",\n\t\t\t \"instanceLocation\": \"/fails\",\n\t\t\t \"errors\": {\n\t\t\t \"\": \"All values fail against the false schema\"\n\t\t\t }\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tresult.AssertInvalid(expected);\n\t}", + "snippet": "\"instanceLocation\": \"/multi\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"/properties/multi/allOf/0/$ref\",\n\t\t\t \"schemaLocation\": \"https://js" + }, + { + "title": "src/JsonSchema.Tests/OutputTests.cs (4/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/OutputTests.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/OutputTests.cs", + "startLine": 361, + "endLine": 480, + "content": "[Test]\n\tpublic void Hierarchical_Multi_Failure_Minimum()\n\t{\n\t\tvar result = Validate(\"{\\\"fails\\\":3}\", OutputFormat.Hierarchical);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#\",\n\t\t\t \"instanceLocation\": \"\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"/properties/fails\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/fails\",\n\t\t\t \"instanceLocation\": \"/fails\",\n\t\t\t \"errors\": {\n\t\t\t \"\": \"All values fail against the false schema\"\n\t\t\t }\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tresult.AssertInvalid(expected);\n\t}\n\n\t[Test]\n\tpublic void RelativeAndAbsoluteLocations()\n\t{\n\t\tvar result = Validate(\"{\\\"refs\\\":8.8}\", OutputFormat.Hierarchical);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#\",\n\t\t\t \"instanceLocation\": \"\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"/properties/refs\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/properties/refs\",\n\t\t\t \"instanceLocation\": \"/refs\",\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"/properties/refs/$ref\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/schema#/$defs/integer\",\n\t\t\t \"instanceLocation\": \"/refs\",\n\t\t\t \"errors\": {\n\t\t\t \"type\": \"Value is \\\"number\\\" but should be \\\"integer\\\"\"\n\t\t\t }\n\t\t\t }\n\t\t\t ]\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tresult.AssertInvalid(expected);\n\t}\n\n\tprivate static EvaluationResults Validate(string json, OutputFormat format)\n\t{\n\t\tvar instance = JsonDocument.Parse(json).RootElement;\n\t\tvar options = EvaluationOptions.From(EvaluationOptions.Default);\n\t\toptions.OutputFormat = format;\n\n\t\tvar result = _schema.Evaluate(instance, options);\n\t\treturn result;\n\t}\n\n\t[Test]\n\tpublic void AdditionalPropertiesDoesNotGiveExtraErrors()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder(_buildOptions)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", false)\n\t\t\t)\n\t\t\t.AdditionalProperties(false);\n\n\t\tvar instance = JsonDocument.Parse(\"{\\\"foo\\\": null}\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List });\n\n\t\tvar serialized = JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions);\n\t\tTestConsole.WriteLine(serialized);\n\n\t\tAssert.That(serialized, Does.Not.Contain(\"additionalProperties\"));\n\t}\n\n\t[Test]\n\tpublic void UnevaluatedPropertiesDoesNotGiveExtraErrors()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder(_buildOptions)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", false)\n\t\t\t)\n\t\t\t.UnevaluatedProperties(false);\n\n\t\tvar instance = JsonDocument.Parse(\"{\\\"foo\\\": null}\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List });\n\n\t\tvar serialized = JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions);\n\t\tTestConsole.WriteLine(serialized);\n\n\t\tAssert.That(serialized, Does.Not.Contain(\"unevaluatedProperties\"));\n\t}\n\n\t[Test]\n\tpublic void UnevaluatedPropertiesStillGivesExtraErrorsForReffedSchemas()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder(_buildOptions)\n\t\t\t.Defs(\n\t\t\t\t(\"reffed\", new JsonSchemaBuilder()\n\t\t\t\t\t.Properties(\n\t\t\t\t\t\t(\"foo\", false)\n\t\t\t\t\t)\n\t\t\t\t)", + "snippet": "[Test]\n\tpublic void Hierarchical_Multi_Failure_Minimum()\n\t{\n\t\tvar result = Validate(\"{\\\"fails\\\":3}\", OutputFormat.Hierarchical);\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocat" + }, + { + "title": "src/JsonSchema.Tests/OutputTests.cs (5/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/OutputTests.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/OutputTests.cs", + "startLine": 481, + "endLine": 600, + "content": ")\n\t\t\t.Ref(\"#/$defs/reffed\")\n\t\t\t.UnevaluatedProperties(false);\n\n\t\tvar instance = JsonDocument.Parse(\"{\\\"foo\\\": null}\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List });\n\n\t\tvar serialized = JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions);\n\t\tTestConsole.WriteLine(serialized);\n\n\t\tAssert.That(serialized, Does.Contain(\"unevaluatedProperties\"));\n\t}\n\n\t[Test]\n\tpublic void UnevaluatedPropertiesGivesCorrectInstanceLocation()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder(_buildOptions)\n\t\t\t.Properties((\"foo\", true))\n\t\t\t.UnevaluatedProperties(false);\n\n\t\tvar instance = JsonDocument.Parse(\"{\\\"foo\\\": null, \\\"bar\\\": null}\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List });\n\n\t\tvar serialized = JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions);\n\t\tTestConsole.WriteLine(serialized);\n\n\t\tvar unevaluatedPropertiesResult = result.Details!.Single(x => x.EvaluationPath.Equals(JsonPointer.Create(\"unevaluatedProperties\")));\n\t\tAssert.That(unevaluatedPropertiesResult.InstanceLocation.ToString(), Is.EqualTo(\"/bar\"));\n\t}\n\n\n\t[Test]\n\tpublic void UnevaluatedItemsGivesCorrectInstanceLocation()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder(_buildOptions)\n\t\t\t.PrefixItems(true)\n\t\t\t.UnevaluatedItems(false);\n\n\t\tvar instance = JsonDocument.Parse(\"[1, 2]\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List });\n\n\t\tvar serialized = JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions);\n\t\tTestConsole.WriteLine(serialized);\n\n\t\tvar unevaluatedPropertiesResult = result.Details!.Single(x => x.EvaluationPath.Equals(JsonPointer.Create(\"unevaluatedItems\")));\n\t\tAssert.That(unevaluatedPropertiesResult.InstanceLocation.ToString(), Is.EqualTo(\"/1\"));\n\t}\n\n\t[Test]\n\tpublic void ItemsDoesNotGiveExtraErrors()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder(_buildOptions)\n\t\t\t.PrefixItems(true, false)\n\t\t\t.Items(false);\n\n\t\tvar instance = JsonDocument.Parse(\"[1,2]\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List });\n\n\t\tvar serialized = JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions);\n\t\tTestConsole.WriteLine(serialized);\n\n\t\tAssert.That(serialized, Does.Not.Contain(\"items\"));\n\t}\n\n\t[Test]\n\tpublic void UnevaluatedItemsDoesNotGiveExtraErrors()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder(_buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft201909Id)\n\t\t\t.Items([true, false])\n\t\t\t.UnevaluatedItems(false);\n\n\t\tvar instance = JsonDocument.Parse(\"[1,2]\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List });\n\n\t\tvar serialized = JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions);\n\t\tTestConsole.WriteLine(serialized);\n\n\t\tAssert.That(serialized, Does.Not.Contain(\"unevaluatedItems\"));\n\t}\n\n\t[Test]\n\t[Ignore(\"Not sure about the URI for the false schema\")]\n\tpublic void FalseSchemaFailsEverything()\n\t{\n\t\tJsonSchema schema = false;\n\n\t\tvar instance = JsonDocument.Parse(\"[1,2]\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.List });\n\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": false,\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": false,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocation\": \"https://json-schema.org/false#\",\n\t\t\t \"instanceLocation\": \"\",\n\t\t\t \"errors\": {\n\t\t\t \"\": \"All values fail against the false schema\"\n\t\t\t }\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tresult.AssertInvalid(expected);\n\t}\n\n\t[Test]\n\tpublic void NewOutputFormat()\n\t{\n\t\tvar schema = JsonSchema.FromText(\"\"\"", + "snippet": ")\n\t\t\t.Ref(\"#/$defs/reffed\")\n\t\t\t.UnevaluatedProperties(false);\n\n\t\tvar instance = JsonDocument.Parse(\"{\\\"foo\\\": null}\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFo" + }, + { + "title": "src/JsonSchema.Tests/OutputTests.cs (6/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/OutputTests.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/OutputTests.cs", + "startLine": 601, + "endLine": 720, + "content": "{\n\t\t\t \"$id\": \"https://json-schema.org/schemas/example\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"title\": \"root\",\n\t\t\t \"properties\": {\n\t\t\t \"foo\": {\n\t\t\t \"allOf\": [\n\t\t\t { \"required\": [ \"unspecified-prop\" ] },\n\t\t\t {\n\t\t\t \"type\": \"object\",\n\t\t\t \"title\": \"foo-title\",\n\t\t\t \"properties\": {\n\t\t\t \"foo-prop\": {\n\t\t\t \"const\": 1,\n\t\t\t \"title\": \"foo-prop-title\"\n\t\t\t }\n\t\t\t },\n\t\t\t \"additionalProperties\": { \"type\": \"boolean\" }\n\t\t\t }\n\t\t\t ]\n\t\t\t },\n\t\t\t \"bar\": {\n\t\t\t \"$ref\": \"#/$defs/bar\"\n\t\t\t }\n\t\t\t },\n\t\t\t \"$defs\": {\n\t\t\t \"bar\": {\n\t\t\t \"type\": \"object\",\n\t\t\t \"title\": \"bar-title\",\n\t\t\t \"properties\": {\n\t\t\t \"bar-prop\": {\n\t\t\t \"type\": \"integer\",\n\t\t\t \"minimum\": 10,\n\t\t\t \"title\": \"bar-prop-title\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\");;\n\t\tvar failing = JsonDocument.Parse(\"\"\"\n\t\t\t{\n\t\t\t \"foo\": {\"foo-prop\": \"not 1\", \"other-prop\": false},\n\t\t\t \"bar\": {\"bar-prop\": 2}\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\t\tvar passing = JsonDocument.Parse(\"\"\"\n\t\t\t{\n\t\t\t \"foo\": {\n\t\t\t \"foo-prop\": 1,\n\t\t\t \"unspecified-prop\": true\n\t\t\t },\n\t\t\t \"bar\": {\"bar-prop\": 20}\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\n\t\tvar validationOptions = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t};\n\t\tvar result = schema.Evaluate(failing, validationOptions);\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions));\n\t\tTestConsole.WriteLine();\n\n\t\tresult.ToList();\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions));\n\t\tTestConsole.WriteLine();\n\n\t\tresult = schema.Evaluate(passing, validationOptions);\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions));\n\t\tTestConsole.WriteLine();\n\n\t\tresult.ToList();\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions));\n\t}\n\n\t[Test]\n\tpublic void EtherCondensedOption()\n\t{\n\t\tvar instance = JsonDocument.Parse(\"\"\"\n\t\t\t{\n\t\t\t \"type\": \"object\",\n\t\t\t \"properties\": {\n\t\t\t \"id\": {\n\t\t\t \"type\": \"string\"\n\t\t\t },\n\t\t\t \"product\": {\n\t\t\t \"type\": \"string\"\n\t\t\t },\n\t\t\t \"field\": {\n\t\t\t \"type\": \"string\"\n\t\t\t },\n\t\t\t \"value\": {\n\t\t\t \"type\": \"string\"\n\t\t\t },\n\t\t\t \"created\": {\n\t\t\t \"type\": \"string\"\n\t\t\t },\n\t\t\t \"updated\": {\n\t\t\t \"type\": \"string\"\n\t\t\t },\n\t\t\t \"deleted\": {\n\t\t\t \"type\": \"string\"\n\t\t\t },\n\t\t\t \"allOf\": [\n\t\t\t {\n\t\t\t \"if\": {\n\t\t\t \"required\": [\n\t\t\t \"value\"\n\t\t\t ],\n\t\t\t \"properties\": {\n\t\t\t \"value\": {\n\t\t\t \"type\": \"string\"\n\t\t\t }\n\t\t\t }\n\t\t\t },\n\t\t\t \"then\": {\n\t\t\t \"properties\": {", + "snippet": "{\n\t\t\t \"$id\": \"https://json-schema.org/schemas/example\",\n\t\t\t \"type\": \"object\",\n\t\t\t \"title\": \"root\",\n\t\t\t \"properties\": {\n\t\t\t \"foo\": {\n\t\t\t \"allOf\": [\n\t\t\t { \"required\": [ \"unspecified-prop\" ] },\n\t\t\t " + }, + { + "title": "src/JsonSchema.Tests/OutputTests.cs (7/7)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/OutputTests.cs#L721-L828", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/OutputTests.cs", + "startLine": 721, + "endLine": 828, + "content": "\"value_blob\": {\n\t\t\t \"type\": \"null\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t },\n\t\t\t {\n\t\t\t \"if\": {\n\t\t\t \"required\": [\n\t\t\t \"value_blob\"\n\t\t\t ],\n\t\t\t \"properties\": {\n\t\t\t \"value_blob\": {\n\t\t\t \"type\": \"string\"\n\t\t\t }\n\t\t\t }\n\t\t\t },\n\t\t\t \"then\": {\n\t\t\t \"properties\": {\n\t\t\t \"value\": {\n\t\t\t \"type\": \"null\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t ]\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\n\t\tvar result = MetaSchemas.Draft202012.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\t//result.ToBasic();\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions));\n\t}\n\n\t[Test]\n\tpublic void IgnoreTitleAnnotations()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder(_buildOptions)\n\t\t\t.Id(\"https://json-everything.test/IgnoreTitleAnnotations\")\n\t\t\t.Title(\"a title\")\n\t\t\t.Default(\"default value\")\n\t\t\t.Type(SchemaValueType.String);\n\t\tvar instance = JsonDocument.Parse(\"\\\"a string\\\"\").RootElement;\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/IgnoreTitleAnnotations#\",\n\t\t\t \"instanceLocation\": \"\",\n\t\t\t \"annotations\": {\n\t\t\t \"default\": \"default value\"\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\";\n\t\tvar options = EvaluationOptions.From(EvaluationOptions.Default);\n\t\toptions.OutputFormat = OutputFormat.Hierarchical;\n\t\toptions.IgnoreAnnotationsFrom();\n\t\tvar result = schema.Evaluate(instance, options);\n\n\t\tresult.AssertValid(expected);\n\t}\n\n\t[Test]\n\tpublic void CollectButDoNotReportPropertiesAnnotations()\n\t{\n\t\tJsonSchema schema = new JsonSchemaBuilder(_buildOptions)\n\t\t\t.Id(\"https://json-everything.test/CollectButDoNotReportPropertiesAnnotations\")\n\t\t\t.Title(\"a title\")\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties((\"foo\", true))\n\t\t\t.AdditionalProperties(false);\n\t\tvar instance = JsonDocument.Parse(\"{\\\"foo\\\": 1}\").RootElement;\n\t\tvar expected = \"\"\"\n\t\t\t{\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/CollectButDoNotReportPropertiesAnnotations#\",\n\t\t\t \"instanceLocation\": \"\",\n\t\t\t \"annotations\": {\n\t\t\t \"title\": \"a title\",\n\t\t\t \"additionalProperties\": true\n\t\t\t },\n\t\t\t \"details\": [\n\t\t\t {\n\t\t\t \"valid\": true,\n\t\t\t \"evaluationPath\": \"/properties/foo\",\n\t\t\t \"schemaLocation\": \"https://json-everything.test/CollectButDoNotReportPropertiesAnnotations#/properties/foo\",\n\t\t\t \"instanceLocation\": \"/foo\"\n\t\t\t }\n\t\t\t ]\n\t\t\t}\n\t\t\t\"\"\";\n\t\tvar options = EvaluationOptions.From(EvaluationOptions.Default);\n\t\toptions.OutputFormat = OutputFormat.Hierarchical;\n\t\toptions.IgnoreAnnotationsFrom();\n\t\tvar result = schema.Evaluate(instance, options);\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(schema, TestEnvironment.TestOutputSerializerOptions));\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(instance, TestEnvironment.TestOutputSerializerOptions));\n\t\tTestConsole.WriteLine();\n\n\t\tresult.AssertValid(expected);\n\t}\n}", + "snippet": "\"value_blob\": {\n\t\t\t \"type\": \"null\"\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t },\n\t\t\t {\n\t\t\t \"if\": {\n\t\t\t \"required\": [\n\t\t\t \"value_blob\"\n\t\t\t ],\n\t\t\t \"" + }, + { + "title": "src/JsonSchema.Tests/PatternTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/PatternTests.cs#L1-L41", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/PatternTests.cs", + "startLine": 1, + "endLine": 41, + "content": "#if !NET481\n\nusing System.Text.RegularExpressions;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class PatternTests\n{\n\t// attempting to use the `.Pattern()` builder method with a bad regex doesn't compile, so... yea!\n\n\t[Test]\n\tpublic void DeserializingInvalidPatternThrows()\n\t{\n\t\tvar schemaText =\n\t\t\t\"\"\"\n\t\t\t {\n\t\t\t \"pattern\": \"(.{2}\"\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tAssert.Throws(() => JsonSchema.FromText(schemaText));\n\t}\n\n\t[Test]\n\tpublic void DeserializingInvalidPatternPropertyThrows()\n\t{\n\t\tvar schemaText =\n\t\t\t\"\"\"\n\t\t\t{\n\t\t\t \"patternProperties\": {\n\t\t\t\t\"(.{2}\": true\n\t\t\t }\n\t\t\t}\n\t\t\t\"\"\";\n\n\t\tAssert.Throws(() => JsonSchema.FromText(schemaText));\n\t}\n}\n\n#endif", + "snippet": "#if !NET481\n\nusing System.Text.RegularExpressions;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class PatternTests\n{\n\t// attempting to use the `.Pattern()` builder method with a bad regex doesn't compile," + }, + { + "title": "src/JsonSchema.Tests/ReferenceTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/ReferenceTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/ReferenceTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.IO;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\npublic class ReferenceTests\n{\n\tprivate static string GetFile(string name)\n\t{\n\t\treturn Path.Combine(TestContext.CurrentContext.WorkDirectory, \"Files\", \"Referencing\", $\"{name}.json\")\n\t\t\t.AdjustForPlatform();\n\t}\n\n\tprivate static string GetResource(string name)\n\t{\n\t\treturn File.ReadAllText(GetFile(name));\n\t}\n\n\t[Test]\n\tpublic void ReferenceFragmentFromFile()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\n\t\tvar baseSchema = JsonSchema.FromFile(GetFile(\"base_schema\"), buildOptions);\n\t\t_ = JsonSchema.FromFile(GetFile(\"ref_schema\"), buildOptions);\n\t\t_ = JsonSchema.FromFile(GetFile(\"schema_with_#_in_uri\"), buildOptions);\n\n\t\tvar baseData = JsonDocument.Parse(GetResource(\"base_data\")).RootElement;\n\n\t\tvar options = new EvaluationOptions();\n\n\t\t// in previous versions, this would still validate the instance, but since adding\n\t\t// static analysis, the ref with the # in it is checked early\n\t\t// and since it can't resolve, it now throws.\n\t\tvar results = baseSchema.Evaluate(baseData, options);\n\n\t\tresults.AssertValid();\n\t}\n\n\t[Test]\n\tpublic void MultipleHashInUriThrowsException()\n\t{\n\t\tvar buildOptions = new BuildOptions { SchemaRegistry = new() };\n\t\n\t\tvar baseSchema = JsonSchema.FromFile(GetFile(\"base_schema\"), buildOptions);\n\t\t_ = JsonSchema.FromFile(GetFile(\"ref_schema\"), buildOptions);\n\t\t_ = JsonSchema.FromFile(GetFile(\"schema_with_#_in_uri\"), buildOptions);\n\n\t\tvar baseData = JsonDocument.Parse(GetResource(\"base_data_hash_uri\")).RootElement;\n\n\t\tvar options = new EvaluationOptions();\n\n\t\tAssert.Throws(()=>baseSchema.Evaluate(baseData, options));\n\t}\n\n\t[Test]\n\tpublic void RefIntoMiddleOfResourceToFindDynamicRef()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new(),\n\t\t\tDialect = Dialect.Draft202012\n\t\t};\n\n\t\t_ = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Id(\"schema:ref\")\n\t\t\t.Defs(\n\t\t\t\t(\"foo\", new JsonSchemaBuilder().DynamicRef(\"#detached\")),\n\t\t\t\t(\"detached\", new JsonSchemaBuilder()\n\t\t\t\t\t.DynamicAnchor(\"detached\")\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Build();\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Id(\"schema:local\")\n\t\t\t.Ref(\"schema:ref#/$defs/foo\");\n\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.List\n\t\t};\n\n\t\tvar instance = \"string\".AsJsonElement();\n\t\tvar result = schema.Evaluate(instance, options);\n\n\t\tresult.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void RegistrationInWrongOrderStillResolves()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new()\n\t\t};\n\n\t\tvar entry = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Id(\"https://json-everything.test/entry\")\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"foo\", new JsonSchemaBuilder().Ref(\"target\"))\n\t\t\t).Build();\n\n\t\t_ = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Id(\"https://json-everything.test/target\")\n\t\t\t.Type(SchemaValueType.String)\n\t\t\t.Build();\n\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.List\n\t\t};\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"{\"foo\": \"value\"}\"\"\").RootElement;", + "snippet": "using System.IO;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\npublic class ReferenceTests\n{\n\tprivate static string GetFile(string name)\n\t{\n\t\treturn Pat" + }, + { + "title": "src/JsonSchema.Tests/ReferenceTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/ReferenceTests.cs#L121-L125", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/ReferenceTests.cs", + "startLine": 121, + "endLine": 125, + "content": "var result = entry.Evaluate(instance, options);\n\n\t\tresult.AssertValid();\n\t}\n}", + "snippet": "var result = entry.Evaluate(instance, options);\n\n\t\tresult.AssertValid();\n\t}\n}" + }, + { + "title": "src/JsonSchema.Tests/ResultsExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/ResultsExtensions.cs#L1-L81", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/ResultsExtensions.cs", + "startLine": 1, + "endLine": 81, + "content": "using System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing Json.Pointer;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\npublic static class ResultsExtensions\n{\n\tpublic static void AssertInvalid(this EvaluationResults results, string? expected = null)\n\t{\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(results, TestEnvironment.TestOutputSerializerOptions));\n\n\t\tAssert.That(results.IsValid, Is.False);\n\t\tAssertEquivalent(results, expected);\n\t}\n\n\tpublic static void AssertValid(this EvaluationResults results, string? expected = null, bool hideIfPassed = false)\n\t{\n\t\tif (!hideIfPassed || !results.IsValid)\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(results, TestEnvironment.TestOutputSerializerOptions));\n\n\t\tAssert.That(results.IsValid, Is.True);\n\t\tAssertEquivalent(results, expected);\n\t}\n\n\tprivate static void AssertEquivalent(EvaluationResults results, string? expected = null)\n\t{\n\t\tif (expected == null) return;\n\n\t\tvar expectedJson = JsonNode.Parse(expected);\n\t\tvar actualJson = JsonSerializer.SerializeToNode(results, TestEnvironment.SerializerOptions);\n\n\t\tvar (areEquivalent, errorLocation) = AreEquivalent(expectedJson, actualJson);\n\t\tif (!areEquivalent) \n\t\t\tAssert.Fail($\"Equivalence test failed at {errorLocation}\");\n\t}\n\n\tprivate static (bool, JsonPointer?) AreEquivalent(JsonNode? a, JsonNode? b, JsonPointer? currentLocation = null)\n\t{\n\t\tcurrentLocation ??= JsonPointer.Empty;\n\t\tswitch (a, b)\n\t\t{\n\t\t\tcase (null, null):\n\t\t\t\treturn (true, currentLocation);\n\t\t\tcase (JsonObject objA, JsonObject objB):\n\t\t\t\tif (objA.Count != objB.Count) return (false, currentLocation);\n\t\t\t\tvar grouped = objA.Concat(objB)\n\t\t\t\t\t.GroupBy(p => p.Key)\n\t\t\t\t\t.Select(g => new{g.Key, Values = g.Select(x => x.Value).ToList()})\n\t\t\t\t\t.ToList();\n\t\t\t\tforeach (var group in grouped)\n\t\t\t\t{\n\t\t\t\t\tif (group.Values.Count != 2) return (false, currentLocation.Value.Combine(group.Key));\n\t\t\t\t\tvar (areEquivalent, errorLocation) = AreEquivalent(group.Values[0], group.Values[1], currentLocation.Value.Combine(group.Key));\n\t\t\t\t\tif (!areEquivalent) return (false, errorLocation);\n\t\t\t\t}\n\t\t\t\treturn (true, currentLocation);\n\t\t\tcase (JsonArray arrayA, JsonArray arrayB):\n\t\t\t\tif (arrayA.Count != arrayB.Count) return (false, currentLocation);\n\t\t\t\tvar zipped = arrayA.Zip(arrayB, (ae, be) => (ae, be));\n\t\t\t\tint index = 0;\n\t\t\t\tforeach (var item in zipped)\n\t\t\t\t{\n\t\t\t\t\tvar (areEquivalent, errorLocation) = AreEquivalent(item.ae, item.be, currentLocation.Value.Combine(index++));\n\t\t\t\t\tif (!areEquivalent) return (false, errorLocation);\n\t\t\t\t}\n\t\t\t\treturn (true, currentLocation);\n\t\t\tcase (JsonValue aValue, JsonValue bValue):\n\t\t\t\tif (aValue.GetValue() is JsonElement aElement &&\n\t\t\t\t bValue.GetValue() is JsonElement bElement)\n\t\t\t\t\treturn (aElement.IsEquivalentTo(bElement), currentLocation);\n\t\t\t\treturn (a.ToJsonString() == b.ToJsonString(), currentLocation);\n\t\t\tdefault:\n\t\t\t\treturn (a?.ToJsonString() == b?.ToJsonString(), currentLocation);\n\t\t}\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing Json.Pointer;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\npublic static class ResultsExtensions" + }, + { + "title": "src/JsonSchema.Tests/SelfValidationTest.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/SelfValidationTest.cs#L1-L108", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/SelfValidationTest.cs", + "startLine": 1, + "endLine": 108, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing System.Net.Sockets;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\n// ReSharper disable LocalizableElement\n\nnamespace Json.Schema.Tests;\n\n[TestFixture]\npublic class SelfValidationTest\n{\n\tpublic static IEnumerable TestData =>\n\t\t[\n\t\t\tnew(MetaSchemas.Draft6) { TestName = nameof(MetaSchemas.Draft6) },\n\n\t\t\tnew(MetaSchemas.Draft7) { TestName = nameof(MetaSchemas.Draft7) },\n\n\t\t\tnew(MetaSchemas.Draft201909) { TestName = nameof(MetaSchemas.Draft201909) },\n\t\t\tnew(MetaSchemas.Core201909) { TestName = nameof(MetaSchemas.Core201909) },\n\t\t\tnew(MetaSchemas.Applicator201909) { TestName = nameof(MetaSchemas.Applicator201909) },\n\t\t\tnew(MetaSchemas.Validation201909) { TestName = nameof(MetaSchemas.Validation201909) },\n\t\t\tnew(MetaSchemas.Metadata201909) { TestName = nameof(MetaSchemas.Metadata201909) },\n\t\t\tnew(MetaSchemas.Format201909) { TestName = nameof(MetaSchemas.Format201909) },\n\t\t\tnew(MetaSchemas.Content201909) { TestName = nameof(MetaSchemas.Content201909) },\n\n\t\t\tnew(MetaSchemas.Draft202012) { TestName = nameof(MetaSchemas.Draft202012) },\n\t\t\tnew(MetaSchemas.Core202012) { TestName = nameof(MetaSchemas.Core202012) },\n\t\t\tnew(MetaSchemas.Applicator202012) { TestName = nameof(MetaSchemas.Applicator202012) },\n\t\t\tnew(MetaSchemas.Metadata202012) { TestName = nameof(MetaSchemas.Metadata202012) },\n\t\t\tnew(MetaSchemas.FormatAnnotation202012) { TestName = nameof(MetaSchemas.FormatAnnotation202012) },\n\t\t\tnew(MetaSchemas.FormatAssertion202012) { TestName = nameof(MetaSchemas.FormatAssertion202012) },\n\t\t\tnew(MetaSchemas.Content202012) { TestName = nameof(MetaSchemas.Content202012) },\n\t\t\tnew(MetaSchemas.Unevaluated202012) { TestName = nameof(MetaSchemas.Unevaluated202012) },\n\t\t];\n\n\t[TestCaseSource(nameof(TestData))]\n\tpublic void Hardcoded(JsonSchema schema)\n\t{\n\t\tvar validation = schema.Evaluate(schema.Root.Source, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tvalidation.AssertValid();\n\t}\n\n\t[TestCaseSource(nameof(TestData))]\n\tpublic void Online(JsonSchema schema)\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar buildOptions = new BuildOptions\n\t\t\t{\n\t\t\t\tSchemaRegistry = new()\n\t\t\t};\n\n\t\t\tvar onlineSchemaJson = new HttpClient().GetStringAsync(schema.Root.Keywords.FirstOrDefault(x => x.Handler.Name == \"$id\")!.RawValue.GetString()!).Result;\n\t\t\tvar onlineSchema = JsonSchema.FromText(onlineSchemaJson, buildOptions);\n\n\t\t\tvar onlineInstance = JsonDocument.Parse(onlineSchemaJson).RootElement;\n\t\t\tvar localInstance = schema.Root.Source;\n\t\t\tvar localValidation = schema.Evaluate(onlineInstance);\n\t\t\tvar onlineValidation = onlineSchema.Evaluate(localInstance);\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\tTestConsole.WriteLine(\"Asserting schema equality\");\n\t\t\t\tvar asElement = schema.Root.Source;\n\t\t\t\tvar onlineAsElement = onlineSchema.Root.Source;\n\t\t\t\tAssert.That(() => asElement.IsEquivalentTo(onlineAsElement));\n\n\t\t\t\tTestConsole.WriteLine(\"Validating local against online\");\n\t\t\t\tonlineValidation.AssertValid();\n\t\t\t\tTestConsole.WriteLine(\"Validating online against local\");\n\t\t\t\tlocalValidation.AssertValid();\n\t\t\t}\n\t\t\tcatch (Exception)\n\t\t\t{\n\t\t\t\tTestConsole.WriteLine(\"Online {0}\", onlineSchemaJson);\n\t\t\t\tTestConsole.WriteLine(\"Local {0}\", schema.Root.Source);\n\t\t\t\tthrow;\n\t\t\t}\n\t\t}\n\t\tcatch (WebException)\n\t\t{\n\t\t\tAssert.Inconclusive();\n\t\t}\n\t\tcatch (HttpRequestException)\n\t\t{\n\t\t\tAssert.Inconclusive();\n\t\t}\n\t\tcatch (SocketException)\n\t\t{\n\t\t\tAssert.Inconclusive();\n\t\t}\n\t\tcatch (AggregateException e)\n\t\t{\n\t\t\tif (e.InnerExceptions.OfType().Any() || e.InnerExceptions.OfType().Any())\n\t\t\t\tAssert.Inconclusive();\n\t\t\tthrow;\n\t\t}\n\t}\n\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing System.Net.Sockets;\nusing System.Text.Json;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\n//" + }, + { + "title": "src/JsonSchema.Tests/Serialization/DeserializationTests.cs (1/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/Serialization/DeserializationTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/Serialization/DeserializationTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel.DataAnnotations;\nusing System.Drawing;\nusing System.Linq;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing System.Threading.Tasks;\nusing Json.More;\nusing Json.Schema.Serialization;\nusing NUnit.Framework;\nusing TestHelpers;\nusing RangeAttribute = System.ComponentModel.DataAnnotations.RangeAttribute;\n\nnamespace Json.Schema.Tests.Serialization;\n\npublic class DeserializationTests\n{\n\tinternal class Foo\n\t{\n\t\t[MinLength(5)]\n\t\tpublic string? Bar { get; set; }\n\t\t[Range(40, int.MaxValue)]\n\t\t[Required]\n\t\tpublic int Value { get; set; }\n\t}\n\n\t[JsonSchema(typeof(DeserializationTests), nameof(FooSchema))]\n\tinternal class FooWithSchema\n\t{\n\t\tpublic string? Bar { get; set; }\n\t\tpublic int Value { get; set; }\n\t}\n\n\tpublic static readonly JsonSchema FooSchema =\n\t\tnew JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(nameof(Foo.Bar), new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String | SchemaValueType.Null)\n\t\t\t\t\t.MinLength(5)\n\t\t\t\t),\n\t\t\t\t(nameof(Foo.Value), new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Integer)\n\t\t\t\t\t.Minimum(40)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Required(nameof(Foo.Value));\n\n\tpublic static readonly JsonSchema PointSchema =\n\t\tnew JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"X\", new JsonSchemaBuilder().Type(SchemaValueType.Integer)),\n\t\t\t\t(\"Y\", new JsonSchemaBuilder().Type(SchemaValueType.Integer))\n\t\t\t)\n\t\t\t.AdditionalProperties(false);\n\n\tpublic static readonly JsonSchema ValidatedEnumSchema =\n\t\tnew JsonSchemaBuilder()\n\t\t\t.Enum(\"One\", \"Two\", \"Three\");\n\n\t[JsonSchema(typeof(DeserializationTests), nameof(ValidatedEnumSchema))]\n\t[JsonConverter(typeof(EnumStringConverter))]\n\tpublic enum ValidatedEnum\n\t{\n\t\tOne,\n\t\tTwo,\n\t\tThree\n\t}\n\n\tprivate static readonly JsonSerializerOptions _options = new()\n\t{\n\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\tWriteIndented = true,\n\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\tConverters = { new ValidatingJsonConverter { EvaluationOptions = { OutputFormat = OutputFormat.List } } }\n\t};\n\n\t[SetUp]\n\tpublic void Setup()\n\t{\n\t\tValidatingJsonConverter.MapType(PointSchema);\n\t}\n\n\t/// \n\t/// Demonstrates that even without a schema, the incorrect JSON data type is\n\t/// caught by the serializer. However, the error is only thrown for the first\n\t/// problem that is encountered. The serializer doesn't report that `Value`\n\t/// is also incorrect.\n\t/// \n\t[Test]\n\tpublic void NoSchema_BadType()\n\t{\n\t\tAssert.Throws(() =>\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": 10,\n \"\"Value\"\": \"\"value\"\"\n}\";\n\n\t\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tHandleException(e);\n\t\t\t\tAssert.That(e.Message, Is.Not.EqualTo(\"JSON does not meet schema requirements\"));\n\t\t\t\tthrow;\n\t\t\t}\n\t\t});\n\t}\n\n\t/// \n\t/// Demonstrates that with a schema, the entire payload is validated and all of\n\t/// the problems are reported.", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel.DataAnnotations;\nusing System.Drawing;\nusing System.Linq;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Serial" + }, + { + "title": "src/JsonSchema.Tests/Serialization/DeserializationTests.cs (2/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/Serialization/DeserializationTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/Serialization/DeserializationTests.cs", + "startLine": 121, + "endLine": 240, + "content": "/// \n\t[Test]\n\tpublic void WithSchema_BadType()\n\t{\n\t\tAssert.Throws(() =>\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": 10,\n \"\"Value\"\": \"\"value\"\"\n}\";\n\n\t\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tHandleException(e);\n\t\t\t\tAssert.That(e.Message, Is.EqualTo(\"JSON does not meet schema requirements\"));\n\t\t\t\tthrow;\n\t\t\t}\n\t\t});\n\t}\n\n\t/// \n\t/// Demonstrates that the serializer doesn't consider data annotations.\n\t/// As long as the data types are correct, the serializer will complete,\n\t/// even if the values are out of the acceptable range.\n\t/// \n\t[Test]\n\tpublic void NoSchema_BadValue()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n\"\"Bar\"\": \"\"bar\"\",\n\"\"Value\"\": 30\n}\";\n\n\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tHandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}\n\n\t/// \n\t/// Demonstrates that the serializer doesn't consider required properties\n\t/// that are missing from the data.\n\t/// \n\t[Test]\n\tpublic void NoSchema_MissingValue()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n\"\"Bar\"\": \"\"bar\"\"\n}\";\n\n\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tHandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}\n\n\t/// \n\t/// Demonstrates that with a schema, out-of-range values are captured and\n\t/// deserialization stops.\n\t/// \n\t[Test]\n\tpublic void WithSchema_BadValue()\n\t{\n\t\tAssert.Throws(() =>\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": \"\"bar\"\",\n \"\"Value\"\": 30\n}\";\n\n\t\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tHandleException(e);\n\t\t\t\tthrow;\n\t\t\t}\n\t\t});\n\t}\n\n\t/// \n\t/// Demonstrates that with a schema, missing required values are captured\n\t/// and deserialization stops.\n\t/// \n\t[Test]\n\tpublic void WithSchema_MissingValue()\n\t{\n\t\tAssert.Throws(() =>\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": \"\"bar\"\"\n}\";\n\n\t\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);", + "snippet": "/// \n\t[Test]\n\tpublic void WithSchema_BadType()\n\t{\n\t\tAssert.Throws(() =>\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": 10,\n \"\"Value\"\": \"\"value\"\"\n}\";\n\n\t\t\t\tvar model = JsonSerializer.Deserializ" + }, + { + "title": "src/JsonSchema.Tests/Serialization/DeserializationTests.cs (3/4)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/Serialization/DeserializationTests.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/Serialization/DeserializationTests.cs", + "startLine": 241, + "endLine": 360, + "content": "TestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tHandleException(e);\n\t\t\t\tthrow;\n\t\t\t}\n\t\t});\n\t}\n\n\t/// \n\t/// Demonstrates a happy path without a schema.\n\t/// \n\t[Test]\n\tpublic void NoSchema_GoodValue()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": \"\"bartholomew\"\",\n \"\"Value\"\": 42\n}\";\n\n\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tHandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}\n\n\t/// \n\t/// Demonstrates a happy path with a schema.\n\t/// \n\t[Test]\n\tpublic void WithSchema_GoodValue()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": \"\"bartholomew\"\",\n \"\"Value\"\": 42\n}\";\n\n\t\t\tvar model = JsonSerializer.Deserialize(jsonText, _options);\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tHandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void WithSchema_MultipleDeserializations()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n \"\"Bar\"\": \"\"bartholomew\"\",\n \"\"Value\"\": 42\n}\";\n\n\t\t\tfor (int i = 0; i < 10; i++)\n\t\t\t{\n\t\t\t\tvar options = new JsonSerializerOptions\n\t\t\t\t{\n\t\t\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\t\t\tWriteIndented = true,\n\t\t\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\t\t\t\tConverters = { new ValidatingJsonConverter { EvaluationOptions = { OutputFormat = OutputFormat.List } } }\n\t\t\t\t};\n\n\t\t\t\tvar model = JsonSerializer.Deserialize(jsonText, options);\n\n\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, options));\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tHandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void InaccessibleType_Valid()\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar jsonText = @\"{\n \"\"X\"\": 4,\n \"\"Y\"\": 5\n}\";\n\n\t\t\tvar options = new JsonSerializerOptions\n\t\t\t{\n\t\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\t\tWriteIndented = true,\n\t\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\t\t\tConverters = { new ValidatingJsonConverter { EvaluationOptions = { OutputFormat = OutputFormat.List } } }\n\t\t\t};\n\n\t\t\tvar model = JsonSerializer.Deserialize(jsonText, options);\n\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, options));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tHandleException(e);\n\t\t\tthrow;\n\t\t}\n\t}", + "snippet": "TestConsole.WriteLine(JsonSerializer.Serialize(model, _options));\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tHandleException(e);\n\t\t\t\tthrow;\n\t\t\t}\n\t\t});\n\t}\n\n\t/// \n\t/// Demonstrates a happy path without a schema.\n\t/// (() =>\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tvar jsonText = @\"{\n \"\"X\"\": \"\"string\"\",\n \"\"Y\"\": 5\n}\";\n\n\t\t\t\t\tvar options = new JsonSerializerOptions\n\t\t\t\t\t{\n\t\t\t\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\t\t\t\tWriteIndented = true,\n\t\t\t\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\t\t\t\t\tConverters = { new ValidatingJsonConverter {EvaluationOptions = { OutputFormat = OutputFormat.List } } }\n\t\t\t\t\t};\n\n\t\t\t\t\tvar model = JsonSerializer.Deserialize(jsonText, options);\n\n\t\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(model, options));\n\t\t\t\t}\n\t\t\t\tcatch (Exception e)\n\t\t\t\t{\n\t\t\t\t\tHandleException(e);\n\t\t\t\t\tAssert.That(e.Message, Is.EqualTo(\"JSON does not meet schema requirements\"));\n\t\t\t\t\tthrow;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\t[Test]\n\tpublic static async Task ConcurrentSchemaDeserialization()\n\t{\n\t\tvar options = new JsonSerializerOptions\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tWriteIndented = true,\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\t\tConverters = { new ValidatingJsonConverter {EvaluationOptions = { OutputFormat = OutputFormat.List } } }\n\t\t};\n\n\t\t// Build distinct schemas so each deserialization registers a different schema in the registry\n\t\tvar serializedSchemas = Enumerable.Range(0, 1000).Select(i =>\n\t\t{\n\t\t\tvar schema = new JsonSchemaBuilder()\n\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t.Properties(\n\t\t\t\t\t($\"prop{i}\", new JsonSchemaBuilder().Type(SchemaValueType.String)))\n\t\t\t\t.Build();\n\n\t\t\treturn JsonSerializer.Serialize(schema, options);\n\t\t});\n\n\t\t// Deserialize all schemas concurrently to stress the SchemaRegistry\n\t\tvar tasks = serializedSchemas.Select(json => Task.Run(() => JsonSerializer.Deserialize(json, options)));\n\n\t\tvar results = await Task.WhenAll(tasks);\n\n\t\tforeach (var result in results)\n\t\t{\n\t\t\tAssert.That(result, Is.Not.Null, \"Each concurrent deserialization should produce a non-null schema.\");\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void EnumKeyedDictionaryRoundTrip()\n\t{\n\t\tvar dictionary = new Dictionary\n\t\t{\n\t\t\t[ValidatedEnum.One] = \"1\",\n\t\t\t[ValidatedEnum.Two] = \"2\",\n\t\t\t[ValidatedEnum.Three] = \"3\"\n\t\t};\n\t\tvar options = new JsonSerializerOptions\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tWriteIndented = true,\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,\n\t\t\tConverters = { new ValidatingJsonConverter { EvaluationOptions = { OutputFormat = OutputFormat.List } } }\n\t\t};\n\n\t\tvar serialized = JsonSerializer.Serialize(dictionary, options);\n\t\tvar deserialized = JsonSerializer.Deserialize>(serialized, options);\n\n\t\tAssert.That(deserialized, Is.EquivalentTo(dictionary));\n\t}\n\n\t/// \n\t/// The validation result is passed in the \n\t/// property under the `\"validation\"` key.\n\t/// \n\tprivate static void HandleException(Exception e)\n\t{\n\t\tTestConsole.WriteLine(e);\n\t\tTestConsole.WriteLine();\n\t\tif (e.Data.Contains(\"validation\"))\n\t\t{\n\t\t\tvar validation = (EvaluationResults)e.Data[\"validation\"]!;\n\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(validation, _options));\n\t\t}\n\t}\n}", + "snippet": "[Test]\n\tpublic void InaccessibleType_Invalid()\n\t{\n\t\tAssert.Throws(() =>\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tvar jsonText = @\"{\n \"\"X\"\": \"\"string\"\",\n \"\"Y\"\": 5\n}\";\n\n\t\t\t\t\tvar options = new JsonSerializerOptions\n\t\t\t\t\t{\n\t" + }, + { + "title": "src/JsonSchema.Tests/SlackTests.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/SlackTests.cs#L1-L36", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/SlackTests.cs", + "startLine": 1, + "endLine": 36, + "content": "using System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class SlackTests\n{\n\t[Test]\n\tpublic void TypeNonNullAndNullFailsValidation()\n\t{\n\t\tvar schema = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaValueType.Object)\n\t\t\t.Properties(\n\t\t\t\t(\"test\", new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.Object)\n\t\t\t\t\t.AdditionalProperties(new JsonSchemaBuilder()\n\t\t\t\t\t\t.Type(SchemaValueType.String, SchemaValueType.Null)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.Required(\"test\");\n\n\t\tvar instance = JsonDocument.Parse(\"\"\"\n\t\t\t{\n\t\t\t\t\"test\": {\n\t\t\t\t\t\"a\": \"aaa\",\n\t\t\t\t\t\"b\": null\n\t\t\t\t}\n\t\t\t}\n\t\t\t\"\"\").RootElement;\n\n\t\tvar results = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tresults.AssertValid();\n\t}\n}", + "snippet": "using System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\npublic class SlackTests\n{\n\t[Test]\n\tpublic void TypeNonNullAndNullFailsValidation()\n\t{\n\t\tvar schema = new JsonSchemaBuilder()\n\t\t\t.Type(SchemaVa" + }, + { + "title": "src/JsonSchema.Tests/Suite/Output.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/Suite/Output.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/Suite/Output.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests.Suite;\n\npublic class Output\n{\n\tprivate const string _testCasesPath = @\"../../../../ref-repos/JSON-Schema-Test-Suite/output-tests\";\n\n\tprivate const bool _useExternal = false;\n\tprivate const bool _runDraftNext = true;\n\tprivate const string _externalTestCasesPath = @\"../../../../../JSON-Schema-Test-Suite/output-tests\";\n\n\tprivate static readonly JsonConverter _resultsConverter = new EvaluationResultsJsonConverter();\n#pragma warning disable CS0618 // Type or member is obsolete\n\tprivate static readonly JsonConverter _legacyResultsConverter = new Pre202012EvaluationResultsJsonConverter();\n#pragma warning restore CS0618 // Type or member is obsolete\n\n\tprivate static readonly SpecVersion[] _unsupportedVersions =\n\t[\n\t\tSpecVersion.Draft201909,\n\t\tSpecVersion.Draft202012\n\t];\n\n\tpublic static IEnumerable TestCases()\n\t{\n\t\treturn GetTests(\"draft2019-09\")\n\t\t\t.Concat(GetTests(\"draft2020-12\"))\n\t\t\t.Concat(_runDraftNext ? GetTests(\"draft-next\") : []);\n\t}\n\n\tprivate static IEnumerable GetTests(string draftFolder)\n\t{\n\t\t// ReSharper disable once HeuristicUnreachableCode\n\t\tvar testCasesPath = _useExternal ? _externalTestCasesPath : _testCasesPath;\n\n\t\tvar testsPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, testCasesPath, $\"{draftFolder}/\")\n\t\t\t.AdjustForPlatform();\n\t\tif (!Directory.Exists(testsPath)) return [];\n\n\t\tvar fileNames = Directory.GetFiles(testsPath, \"*.json\", SearchOption.AllDirectories);\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical,\n\t\t\tEvaluateAs = draftFolder switch\n\t\t\t{\n\t\t\t\t\"draft2019-09\" => SpecVersion.Draft201909,\n\t\t\t\t\"draft2020-12\" => SpecVersion.Draft202012,\n\t\t\t\t\"draft-next\" => SpecVersion.DraftNext,\n\t\t\t\t_ => SpecVersion.Unspecified\n\t\t\t}\n\t\t};\n\n\t\tvar allTests = new List();\n\t\tforeach (var fileName in fileNames)\n\t\t{\n\t\t\tvar shortFileName = Path.GetFileNameWithoutExtension(fileName);\n\t\t\tif (shortFileName == \"output-schema\")\n\t\t\t{\n\t\t\t\tvar outputSchema = JsonSchema.FromFile(fileName);\n\t\t\t\tSchemaRegistry.Global.Register(new Uri(fileName), outputSchema);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// adjust for format\n\t\t\toptions.RequireFormatValidation = fileName.Contains(\"format/\".AdjustForPlatform()) &&\n\t\t\t\t\t\t\t\t\t\t\t // uri-template will throw an exception as it's explicitly unsupported\n\t\t\t\t\t\t\t\t\t\t\t shortFileName != \"uri-template\";\n\n\t\t\tvar contents = File.ReadAllText(fileName);\n\t\t\tvar collections = JsonSerializer.Deserialize>(contents, TestEnvironment.TestSuiteSerializationOptions);\n\n\t\t\tforeach (var collection in collections!)\n\t\t\t{\n\t\t\t\tcollection.IsOptional = fileName.Contains(\"optional\");\n\t\t\t\tforeach (var test in collection.Tests)\n\t\t\t\t{\n\t\t\t\t\tforeach (var format in test.Output!.Keys)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar optional = collection.IsOptional ? \"(optional) / \" : null;\n\t\t\t\t\t\tvar name = $\"{draftFolder} / {shortFileName} / {optional}{collection.Description} / {test.Description} / {format}\";\n\t\t\t\t\t\tvar optionsCopy = EvaluationOptions.From(options);\n\t\t\t\t\t\tallTests.Add(new TestCaseData(collection, test, format, shortFileName, optionsCopy) { TestName = name });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn allTests;\n\t}\n\n\t[TestCaseSource(nameof(TestCases))]\n\tpublic void Test(TestCollection collection, TestCase test, string format, string fileName, EvaluationOptions options)\n\t{\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(fileName);\n\t\tTestConsole.WriteLine(collection.Description);\n\t\tTestConsole.WriteLine(test.Description);\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(collection.Schema, TestEnvironment.TestOutputSerializerOptions));\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(test.Data.AsJsonString());\n\t\tTestConsole.WriteLine();\n\n\t\tif (!InstanceIsDeserializable(test.Data))\n\t\t\tAssert.Inconclusive(\"Instance not deserializable\");\n\n\t\tvar (outputFormat, converter) = format switch\n\t\t{\n\t\t\t\"flag\" => (OutputFormat.List, _resultsConverter),\n\t\t\t\"basic\" => (OutputFormat.List, _legacyResultsConverter),", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing NUnit.Framework;\nusin" + }, + { + "title": "src/JsonSchema.Tests/Suite/Output.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/Suite/Output.cs#L121-L189", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/Suite/Output.cs", + "startLine": 121, + "endLine": 189, + "content": "\"list\" => (OutputFormat.List, _resultsConverter),\n\t\t\t\"detailed\" => ((OutputFormat)(-1), null!),\n\t\t\t\"verbose\" => (OutputFormat.Hierarchical, _legacyResultsConverter),\n\t\t\t\"hierarchical\" => (OutputFormat.Hierarchical, _resultsConverter),\n\t\t\t_ => throw new ArgumentOutOfRangeException(nameof(format))\n\t\t};\n\t\toptions.OutputFormat = outputFormat;\n\t\tvar result = collection.Schema.Evaluate(test.Data, options);\n\t\tvar optionsWithConverters = new JsonSerializerOptions\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tConverters = { converter }\n\t\t};\n\t\tvar serializedResult = JsonSerializer.SerializeToNode(result, optionsWithConverters);\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(serializedResult, TestEnvironment.TestOutputSerializerOptions));\n\t\tTestConsole.WriteLine();\n\n\n\t\tvar outputSchema = test.Output![format];\n\t\tresult = outputSchema.Evaluate(serializedResult, new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t});\n\n\t\tif (_unsupportedVersions.Contains(options.EvaluateAs))\n\t\t{\n\t\t\tif (!result.IsValid)\n\t\t\t{\n\t\t\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions));\n\t\t\t\tAssert.Inconclusive(\"not fully supported\");\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tresult.AssertValid(hideIfPassed: true);\n\t}\n\n\tprivate static bool InstanceIsDeserializable(in JsonNode? testData)\n\t{\n\t\ttry\n\t\t{\n\t\t\tvar value = (testData as JsonValue)?.GetValue();\n\t\t\tif (value is null) return true;\n\t\t\tif (value is string) return false;\n\t\t\tif (value is JsonElement { ValueKind: JsonValueKind.Number } element)\n\t\t\t\treturn element.TryGetDecimal(out _);\n\t\t\tif (value.GetType().IsNumber())\n\t\t\t{\n\t\t\t\t// some tests involve numbers larger than c# can handle. fortunately, they're optional.\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tTestConsole.WriteLine(e.Message);\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t[Test]\n\tpublic void EnsureTestSuiteConfiguredForServerBuild()\n\t{\n\t\tAssert.That(_useExternal, Is.False);\n\t\t//Assert.IsFalse(_runDraftNext);\n\t}\n}", + "snippet": "\"list\" => (OutputFormat.List, _resultsConverter),\n\t\t\t\"detailed\" => ((OutputFormat)(-1), null!),\n\t\t\t\"verbose\" => (OutputFormat.Hierarchical, _legacyResultsConverter),\n\t\t\t\"hierarchical\" => (OutputFormat.Hierarchical, _resu" + }, + { + "title": "src/JsonSchema.Tests/Suite/TestCase.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/Suite/TestCase.cs#L1-L13", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/Suite/TestCase.cs", + "startLine": 1, + "endLine": 13, + "content": "using System.Collections.Generic;\nusing System.Text.Json;\n#pragma warning disable CS8618\n\nnamespace Json.Schema.Tests.Suite;\n\npublic class TestCase\n{\n\tpublic string Description { get; set; }\n\tpublic JsonElement Data { get; set; }\n\tpublic bool Valid { get; set; }\n\t//public Dictionary? Output { get; set; }\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\n#pragma warning disable CS8618\n\nnamespace Json.Schema.Tests.Suite;\n\npublic class TestCase\n{\n\tpublic string Description { get; set; }\n\tpublic JsonElement Data { ge" + }, + { + "title": "src/JsonSchema.Tests/Suite/TestCollection.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/Suite/TestCollection.cs#L1-L14", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/Suite/TestCollection.cs", + "startLine": 1, + "endLine": 14, + "content": "using System.Collections.Generic;\nusing System.Text.Json;\n#pragma warning disable CS8618\n\nnamespace Json.Schema.Tests.Suite;\n\npublic class TestCollection\n{\n\tpublic string Description { get; set; }\n\tpublic JsonElement Schema { get; set; }\n\t// ReSharper disable once CollectionNeverUpdated.Global\n\tpublic List Tests { get; set; }\n\tpublic bool IsOptional { get; set; }\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\n#pragma warning disable CS8618\n\nnamespace Json.Schema.Tests.Suite;\n\npublic class TestCollection\n{\n\tpublic string Description { get; set; }\n\tpublic JsonElement Sch" + }, + { + "title": "src/JsonSchema.Tests/Suite/Validation.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/Suite/Validation.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/Suite/Validation.cs", + "startLine": 1, + "endLine": 120, + "content": "// Much of the format validation code in this file was generated by AI.\n// I'm not ashamed; you're ashamed.\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests.Suite;\n\npublic class Validation\n{\n\tprivate const string _testCasesPath = @\"../../../../../ref-repos/JSON-Schema-Test-Suite/tests\";\n\tprivate const string _remoteSchemasPath = @\"../../../../../ref-repos/JSON-Schema-Test-Suite/remotes\";\n\n\tprivate const bool _useExternal = false;\n\tprivate const bool _runDraftNext = true;\n\tprivate const string _externalTestCasesPath = @\"../../../../../../JSON-Schema-Test-Suite/tests\";\n\tprivate const string _externalRemoteSchemasPath = @\"../../../../../../JSON-Schema-Test-Suite/remotes\";\n\n\t// Tests to explicitly ignore: [fileName, collectionDescription]\n\tprivate static readonly HashSet<(string, string)> _ignoredTests =\n\t[\n\t\t(\"hostname\", \"validation of A-label (punycode) host names\"),\n\t\t(\"idn-hostname\", \"validation of internationalized host names\"),\n\t\t(\"idn-hostname\", \"validation of separators in internationalized host names\")\n\t];\n\n\tprivate static readonly string[] _supportedProposals =\n\t[\n\t\t//\"propertyDependencies\"\n\t];\n\n\tpublic static IEnumerable TestCases()\n\t{\n\t\treturn GetTests(\"draft6\")\n\t\t\t.Concat(GetTests(\"draft7\"))\n\t\t\t.Concat(GetTests(\"draft2019-09\"))\n\t\t\t.Concat(GetTests(\"draft2020-12\"))\n\t\t\t.Concat(_runDraftNext ? GetTests(\"v1\") : []);\n\t}\n\n\tprivate static IEnumerable GetTests(string draftFolder)\n\t{\n\t\t// ReSharper disable once HeuristicUnreachableCode\n\t\tvar testCasesPath = _useExternal ? _externalTestCasesPath : _testCasesPath;\n\n\t\tvar testsPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, testCasesPath, $\"{draftFolder}/\")\n\t\t\t.AdjustForPlatform();\n\t\tif (!Directory.Exists(testsPath)) return [];\n\n\t\tvar fileNames = Directory.GetFiles(testsPath, \"*.json\", SearchOption.AllDirectories);\n\t\tvar evaluationOptions = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical,\n\t\t};\n\n\t\tvar allTests = new List();\n\t\tforeach (var fileName in fileNames)\n\t\t{\n\t\t\tvar shortFileName = Path.GetFileNameWithoutExtension(fileName);\n\n\t\t\tvar filePath = fileName.Split('/', '\\\\');\n\t\t\tvar proposals = filePath.IndexOf(\"proposals\");\n\t\t\tif (proposals != -1 && proposals + 1 < filePath.Length)\n\t\t\t{\n\t\t\t\tvar proposal = filePath[proposals + 1];\n\t\t\t\tif (!_supportedProposals.Contains(proposal)) continue;\n\t\t\t}\n\n\t\t\t// adjust for format\n\t\t\tevaluationOptions.RequireFormatValidation = fileName.Contains(\"format/\".AdjustForPlatform());\n\n\t\t\tvar contents = File.ReadAllText(fileName);\n\t\t\tvar collections = JsonSerializer.Deserialize>(contents, TestEnvironment.TestSuiteSerializationOptions);\n\n\t\t\tforeach (var collection in collections!)\n\t\t\t{\n\t\t\t\tcollection.IsOptional = fileName.Contains(\"optional\");\n\t\t\t\t\n\t\t\t\tif (_ignoredTests.Contains((shortFileName, collection.Description))) continue;\n\n\t\t\t\tforeach (var test in collection.Tests)\n\t\t\t\t{\n\t\t\t\t\tvar dialect = draftFolder switch\n\t\t\t\t\t{\n\t\t\t\t\t\t\"draft6\" => Dialect.Draft06,\n\t\t\t\t\t\t\"draft7\" => Dialect.Draft07,\n\t\t\t\t\t\t\"draft2019-09\" => Dialect.Draft201909,\n\t\t\t\t\t\t\"draft2020-12\" => Dialect.Draft202012,\n\t\t\t\t\t\t\"v1\" => Dialect.V1,\n\t\t\t\t\t\t_ => throw new ArgumentOutOfRangeException(nameof(draftFolder), $\"{draftFolder} is unsupported\")\n\t\t\t\t\t};\n\n\t\t\t\t\tvar buildOptions = new BuildOptions\n\t\t\t\t\t{\n\t\t\t\t\t\tDialect = dialect,\n\t\t\t\t\t\tSchemaRegistry = new()\n\t\t\t\t\t};\n\t\t\t\t\tvar optional = collection.IsOptional ? \"(optional) / \" : null;\n\t\t\t\t\tvar name = $\"{draftFolder} / {optional}{shortFileName} / {collection.Description} / {test.Description}\";\n\t\t\t\t\tvar evaluationOptionsCopy = EvaluationOptions.From(evaluationOptions);\n\t\t\t\t\tallTests.Add(new TestCaseData(collection, test, shortFileName, buildOptions, evaluationOptionsCopy) { TestName = name });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn allTests;\n\t}\n\n\t[OneTimeSetUp]\n\tpublic void LoadRemoteSchemas()\n\t{\n\t\t// ReSharper disable once HeuristicUnreachableCode\n\t\tvar remotesPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, _useExternal ? _externalRemoteSchemasPath : _remoteSchemasPath)\n\t\t\t.AdjustForPlatform();\n\t\tif (!Directory.Exists(remotesPath)) throw new Exception(\"Cannot find remotes folder\");", + "snippet": "// Much of the format validation code in this file was generated by AI.\n// I'm not ashamed; you're ashamed.\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusin" + }, + { + "title": "src/JsonSchema.Tests/Suite/Validation.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/Suite/Validation.cs#L121-L221", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/Suite/Validation.cs", + "startLine": 121, + "endLine": 221, + "content": "var fileNames = Directory.GetFiles(remotesPath, \"*.json\", SearchOption.AllDirectories);\n\n\t\tforeach (var fileName in fileNames)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tDialect? dialect;\n\t\t\t\tif (fileName.Contains(\"draft6\"))\n\t\t\t\t\tdialect = Dialect.Draft06;\n\t\t\t\telse if (fileName.Contains(\"draft7\"))\n\t\t\t\t\tdialect = Dialect.Draft07;\n\t\t\t\telse if (fileName.Contains(\"draft2019-09\"))\n\t\t\t\t\tdialect = Dialect.Draft201909;\n\t\t\t\telse if (fileName.Contains(\"draft2020-12\"))\n\t\t\t\t\tdialect = Dialect.Draft202012;\n\t\t\t\telse\n\t\t\t\t\tdialect = Dialect.V1;\n\n\t\t\t\tvar buildOptions = new BuildOptions\n\t\t\t\t{\n\t\t\t\t\tDialect = dialect\n\t\t\t\t};\n\t\t\t\tvar uri = new Uri(fileName.Replace(remotesPath, \"http://localhost:1234\").Replace('\\\\', '/'));\n\t\t\t\tif (SchemaRegistry.Global.Get(uri) != null) return; // may have been loaded from other test if running all together\n\t\t\t\n\t\t\t\tvar schema = JsonSchema.FromFile(fileName, buildOptions, uri);\n\t\t\t\tSchemaRegistry.Global.Register(uri, schema); // it seems a number of remotes have `$id`s different from their file path\n\t\t\t}\n\t\t\tcatch (JsonSchemaException e)\n\t\t\t{\n\t\t\t\tTestConsole.WriteLine($\"Error loading file '{fileName}': {e}\");\n\t\t\t}\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(TestCases))]\n\tpublic void Test(TestCollection collection, TestCase test, string fileName, BuildOptions buildOptions, EvaluationOptions evaluationOptions)\n\t{\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(fileName);\n\t\tTestConsole.WriteLine(collection.Description);\n\t\tTestConsole.WriteLine(test.Description);\n\t\tTestConsole.WriteLine(test.Valid ? \"valid\" : \"invalid\");\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(collection.Schema, TestEnvironment.TestOutputSerializerOptions));\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(test.Data, TestEnvironment.TestOutputSerializerOptions));\n\t\tTestConsole.WriteLine();\n\n\t\tJsonSchema schema;\n\t\ttry\n\t\t{\n\t\t\tschema = Measure.Run(\"Build\", () => JsonSchema.Build(collection.Schema, buildOptions));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tConsole.WriteLine(e);\n\t\t\tif (collection.IsOptional)\n\t\t\t{\n\t\t\t\tAssert.Inconclusive();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthrow;\n\t\t}\n\n\t\tEvaluationResults result;\n\t\ttry\n\t\t{\n\t\t\tresult = Measure.Run(\"Evaluate\", () => schema.Evaluate(test.Data, evaluationOptions));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tConsole.WriteLine(e);\n\t\t\tif (collection.IsOptional)\n\t\t\t{\n\t\t\t\tAssert.Inconclusive();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthrow;\n\t\t}\n\n\t\t//result.ToBasic();\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(\"Result:\");\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions));\n\n\t\tif (collection.IsOptional && result.IsValid != test.Valid)\n\t\t\tAssert.Inconclusive(\"Test optional\");\n\t\tAssert.That(result.IsValid, Is.EqualTo(test.Valid));\n\t}\n\n\t[Test]\n\tpublic void EnsureTestSuiteConfiguredForServerBuild()\n\t{\n\t\tAssert.That(_useExternal, Is.False);\n\t\t//Assert.IsFalse(_runDraftNext);\n\t}\n}", + "snippet": "var fileNames = Directory.GetFiles(remotesPath, \"*.json\", SearchOption.AllDirectories);\n\n\t\tforeach (var fileName in fileNames)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tDialect? dialect;\n\t\t\t\tif (fileName.Contains(\"draft6\"))\n\t\t\t\t\tdialect = Dia" + }, + { + "title": "src/JsonSchema.Tests/Suite/ValidationOptimized.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/Suite/ValidationOptimized.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/Suite/ValidationOptimized.cs", + "startLine": 1, + "endLine": 120, + "content": "// Much of the format validation code in this file was generated by AI.\n// I'm not ashamed; you're ashamed.\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests.Suite;\n\npublic class ValidationOptimized\n{\n\tprivate const string _testCasesPath = @\"../../../../../ref-repos/JSON-Schema-Test-Suite/tests\";\n\tprivate const string _remoteSchemasPath = @\"../../../../../ref-repos/JSON-Schema-Test-Suite/remotes\";\n\n\tprivate const bool _useExternal = false;\n\tprivate const bool _runDraftNext = false;\n\tprivate const string _externalTestCasesPath = @\"../../../../../../JSON-Schema-Test-Suite/tests\";\n\tprivate const string _externalRemoteSchemasPath = @\"../../../../../../JSON-Schema-Test-Suite/remotes\";\n\n\t// Tests to explicitly ignore: [fileName, collectionDescription]\n\tprivate static readonly HashSet<(string, string)> _ignoredTests =\n\t[\n\t\t(\"hostname\", \"validation of A-label (punycode) host names\"),\n\t\t(\"idn-hostname\", \"validation of internationalized host names\"),\n\t\t(\"idn-hostname\", \"validation of separators in internationalized host names\")\n\t];\n\n\tpublic static IEnumerable TestCases()\n\t{\n\t\treturn GetTests(\"draft6\")\n\t\t\t.Concat(GetTests(\"draft7\"))\n\t\t\t.Concat(GetTests(\"draft2019-09\"))\n\t\t\t.Concat(GetTests(\"draft2020-12\"))\n\t\t\t.Concat(_runDraftNext ? GetTests(\"v1\") : []);\n\t}\n\n\tprivate static IEnumerable GetTests(string draftFolder)\n\t{\n\t\t// ReSharper disable once HeuristicUnreachableCode\n\t\tvar testCasesPath = _useExternal ? _externalTestCasesPath : _testCasesPath;\n\n\t\tvar testsPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, testCasesPath, $\"{draftFolder}/\")\n\t\t\t.AdjustForPlatform();\n\t\tif (!Directory.Exists(testsPath)) return [];\n\n\t\tvar fileNames = Directory.GetFiles(testsPath, \"*.json\", SearchOption.AllDirectories);\n\t\tvar evaluationOptions = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Flag,\n\t\t};\n\n\t\tvar allTests = new List();\n\t\tforeach (var fileName in fileNames)\n\t\t{\n\t\t\tvar shortFileName = Path.GetFileNameWithoutExtension(fileName);\n\n\t\t\t// adjust for format\n\t\t\tevaluationOptions.RequireFormatValidation = fileName.Contains(\"format/\".AdjustForPlatform());\n\n\t\t\tvar contents = File.ReadAllText(fileName);\n\t\t\tvar collections = JsonSerializer.Deserialize>(contents, TestEnvironment.TestSuiteSerializationOptions);\n\n\t\t\tforeach (var collection in collections!)\n\t\t\t{\n\t\t\t\tcollection.IsOptional = fileName.Contains(\"optional\");\n\n\t\t\t\tif (_ignoredTests.Contains((shortFileName, collection.Description))) continue;\n\n\t\t\t\tforeach (var test in collection.Tests)\n\t\t\t\t{\n\t\t\t\t\tvar dialect = draftFolder switch\n\t\t\t\t\t{\n\t\t\t\t\t\t\"draft6\" => Dialect.Draft06,\n\t\t\t\t\t\t\"draft7\" => Dialect.Draft07,\n\t\t\t\t\t\t\"draft2019-09\" => Dialect.Draft201909,\n\t\t\t\t\t\t\"draft2020-12\" => Dialect.Draft202012,\n\t\t\t\t\t\t\"v1\" => Dialect.V1,\n\t\t\t\t\t\t_ => throw new ArgumentOutOfRangeException(nameof(draftFolder), $\"{draftFolder} is unsupported\")\n\t\t\t\t\t};\n\n\t\t\t\t\tvar buildOptions = new BuildOptions\n\t\t\t\t\t{\n\t\t\t\t\t\tDialect = dialect,\n\t\t\t\t\t\tSchemaRegistry = new()\n\t\t\t\t\t};\n\t\t\t\t\tvar optional = collection.IsOptional ? \"(optional) / \" : null;\n\t\t\t\t\tvar name = $\"{draftFolder} / {optional}{shortFileName} / {collection.Description} / {test.Description}\";\n\t\t\t\t\tvar evaluationOptionsCopy = EvaluationOptions.From(evaluationOptions);\n\t\t\t\t\tallTests.Add(new TestCaseData(collection, test, shortFileName, buildOptions, evaluationOptionsCopy) { TestName = name });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn allTests;\n\t}\n\n\t[OneTimeSetUp]\n\tpublic void LoadRemoteSchemas()\n\t{\n\t\t// ReSharper disable once HeuristicUnreachableCode\n\t\tvar remotesPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, _useExternal ? _externalRemoteSchemasPath : _remoteSchemasPath)\n\t\t\t.AdjustForPlatform();\n\t\tif (!Directory.Exists(remotesPath)) throw new Exception(\"Cannot find remotes folder\");\n\n\t\tvar fileNames = Directory.GetFiles(remotesPath, \"*.json\", SearchOption.AllDirectories);\n\n\t\tforeach (var fileName in fileNames)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tDialect? dialect;\n\t\t\t\tif (fileName.Contains(\"draft6\"))\n\t\t\t\t\tdialect = Dialect.Draft06;\n\t\t\t\telse if (fileName.Contains(\"draft7\"))\n\t\t\t\t\tdialect = Dialect.Draft07;\n\t\t\t\telse if (fileName.Contains(\"draft2019-09\"))\n\t\t\t\t\tdialect = Dialect.Draft201909;", + "snippet": "// Much of the format validation code in this file was generated by AI.\n// I'm not ashamed; you're ashamed.\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusin" + }, + { + "title": "src/JsonSchema.Tests/Suite/ValidationOptimized.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/Suite/ValidationOptimized.cs#L121-L208", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/Suite/ValidationOptimized.cs", + "startLine": 121, + "endLine": 208, + "content": "else if (fileName.Contains(\"draft2020-12\"))\n\t\t\t\t\tdialect = Dialect.Draft202012;\n\t\t\t\telse\n\t\t\t\t\tdialect = Dialect.V1;\n\n\t\t\t\tvar buildOptions = new BuildOptions\n\t\t\t\t{\n\t\t\t\t\tDialect = dialect\n\t\t\t\t};\n\t\t\t\tvar uri = new Uri(fileName.Replace(remotesPath, \"http://localhost:1234\").Replace('\\\\', '/'));\n\t\t\t\tif (SchemaRegistry.Global.Get(uri) != null) return; // may have been loaded from other test if running all together\n\n\t\t\t\tvar schema = JsonSchema.FromFile(fileName, buildOptions, uri);\n\t\t\t\tSchemaRegistry.Global.Register(uri, schema); // it seems a number of remotes have `$id`s different from their file path\n\t\t\t}\n\t\t\tcatch (JsonSchemaException e)\n\t\t\t{\n\t\t\t\tTestConsole.WriteLine($\"Error loading file '{fileName}': {e}\");\n\t\t\t}\n\t\t}\n\t}\n\n\t[TestCaseSource(nameof(TestCases))]\n\tpublic void Test(TestCollection collection, TestCase test, string fileName, BuildOptions buildOptions, EvaluationOptions evaluationOptions)\n\t{\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(fileName);\n\t\tTestConsole.WriteLine(collection.Description);\n\t\tTestConsole.WriteLine(test.Description);\n\t\tTestConsole.WriteLine(test.Valid ? \"valid\" : \"invalid\");\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(collection.Schema, TestEnvironment.TestOutputSerializerOptions));\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(test.Data, TestEnvironment.TestOutputSerializerOptions));\n\t\tTestConsole.WriteLine();\n\n\t\tJsonSchema schema;\n\t\ttry\n\t\t{\n\t\t\tschema = Measure.Run(\"Build\", () => JsonSchema.Build(collection.Schema, buildOptions));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tConsole.WriteLine(e);\n\t\t\tif (collection.IsOptional)\n\t\t\t{\n\t\t\t\tAssert.Inconclusive();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthrow;\n\t\t}\n\n\t\tEvaluationResults result;\n\t\ttry\n\t\t{\n\t\t\tresult = Measure.Run(\"Evaluate\", () => schema.Evaluate(test.Data, evaluationOptions));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tConsole.WriteLine(e);\n\t\t\tif (collection.IsOptional)\n\t\t\t{\n\t\t\t\tAssert.Inconclusive();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthrow;\n\t\t}\n\n\t\t//result.ToBasic();\n\t\tTestConsole.WriteLine();\n\t\tTestConsole.WriteLine(\"Result:\");\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, TestEnvironment.TestOutputSerializerOptions));\n\n\t\tif (collection.IsOptional && result.IsValid != test.Valid)\n\t\t\tAssert.Inconclusive(\"Test optional\");\n\t\tAssert.That(result.IsValid, Is.EqualTo(test.Valid));\n\t}\n\n\t[Test]\n\tpublic void EnsureTestSuiteConfiguredForServerBuild()\n\t{\n\t\tAssert.That(_useExternal, Is.False);\n\t\t//Assert.IsFalse(_runDraftNext);\n\t}\n}", + "snippet": "else if (fileName.Contains(\"draft2020-12\"))\n\t\t\t\t\tdialect = Dialect.Draft202012;\n\t\t\t\telse\n\t\t\t\t\tdialect = Dialect.V1;\n\n\t\t\t\tvar buildOptions = new BuildOptions\n\t\t\t\t{\n\t\t\t\t\tDialect = dialect\n\t\t\t\t};\n\t\t\t\tvar uri = new Uri(fileN" + }, + { + "title": "src/JsonSchema.Tests/TestEnvironment.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/TestEnvironment.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/TestEnvironment.cs", + "startLine": 1, + "endLine": 37, + "content": "using System.Text.Encodings.Web;\nusing System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\n[SetUpFixture]\npublic class TestEnvironment\n{\n\tpublic static readonly JsonSerializerOptions SerializerOptions =\n\t\tnew()\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t};\n\n\tpublic static readonly JsonSerializerOptions TestOutputSerializerOptions =\n\t\tnew()\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tWriteIndented = true,\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t\t};\n\n\tpublic static readonly JsonSerializerOptions TestSuiteSerializationOptions =\n\t\tnew()\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tPropertyNameCaseInsensitive = true\n\t\t};\n\n\n\t[OneTimeSetUp]\n\tpublic void Setup()\n\t{\n\t}\n}", + "snippet": "using System.Text.Encodings.Web;\nusing System.Text.Json;\nusing NUnit.Framework;\n\nnamespace Json.Schema.Tests;\n\n[SetUpFixture]\npublic class TestEnvironment\n{\n\tpublic static readonly JsonSerializerOptions SerializerOptions" + }, + { + "title": "src/JsonSchema.Tests/TestSerializerContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/TestSerializerContext.cs#L1-L18", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/TestSerializerContext.cs", + "startLine": 1, + "endLine": 18, + "content": "using System.Collections.Generic;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Tests.Serialization;\nusing Json.Schema.Tests.Suite;\n\nnamespace Json.Schema.Tests;\n\n[JsonSerializable(typeof(TestCollection))]\n[JsonSerializable(typeof(List))]\n[JsonSerializable(typeof(System.Drawing.Point))]\n[JsonSerializable(typeof(DeserializationTests.Foo))]\n[JsonSerializable(typeof(DeserializationTests.FooWithSchema))]\n[JsonSerializable(typeof(Dictionary))]\n[JsonSerializable(typeof(JsonSchema))]\n[JsonSerializable(typeof(EvaluationResults))]\n[JsonSerializable(typeof(GithubTests.Model791))]\n[JsonSerializable(typeof(GithubTests.Model791Undecorated))]\ninternal partial class TestSerializerContext : JsonSerializerContext;", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json.Serialization;\nusing Json.Schema.Tests.Serialization;\nusing Json.Schema.Tests.Suite;\n\nnamespace Json.Schema.Tests;\n\n[JsonSerializable(typeof(TestCollection))]\n[Jso" + }, + { + "title": "src/JsonSchema.Tests/UnrecognizedKeywordTests.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/UnrecognizedKeywordTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/UnrecognizedKeywordTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Schema.Keywords;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\npublic class UnrecognizedKeywordTests\n{\n\t[Test]\n\tpublic void FooIsNotAKeyword()\n\t{\n\t\tvar schemaText = \"{\\\"foo\\\": \\\"bar\\\"}\";\n\n\t\tvar buildOptions = new BuildOptions { Dialect = Dialect.Draft202012 };\n\t\tvar schema = JsonSchema.FromText(schemaText, buildOptions);\n\n\t\tAssert.Multiple(() =>\n\t\t{\n\t\t\tAssert.That(schema.Root.Keywords, Has.Length.EqualTo(1));\n\t\t\tAssert.That(schema.Root.Keywords.First().Handler, Is.InstanceOf());\n\t\t});\n\t}\n\n\t[Test]\n\tpublic void FooProducesAnAnnotation()\n\t{\n\t\tvar schemaText = \"{\\\"foo\\\": \\\"bar\\\"}\";\n\n\t\tvar buildOptions = new BuildOptions { Dialect = Dialect.Draft202012 };\n\t\tvar schema = JsonSchema.FromText(schemaText, buildOptions);\n\n\t\tvar instance = JsonDocument.Parse(\"{}\").RootElement;\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tresult.AssertValid();\n\t\tAssert.That(result.Annotations!.Count, Is.EqualTo(1));\n\t\tJsonAssert.AreEquivalent(\"bar\".AsJsonElement(), result.Annotations![\"foo\"]);\n\t}\n\n\t[Test]\n\tpublic void UnknownKeywordAnnotationIsProduced()\n\t{\n\t\tvar schemaText = \"{\\\"foo\\\": \\\"bar\\\"}\";\n\n\t\tvar buildOptions = new BuildOptions { Dialect = Dialect.Draft202012 };\n\t\tvar schema = JsonSchema.FromText(schemaText, buildOptions);\n\n\t\tvar instance = JsonDocument.Parse(\"{}\").RootElement;\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical,\n\t\t\tAddAnnotationForUnknownKeywords = true\n\t\t});\n\n\t\tresult.AssertValid();\n\t\tAssert.That(result.Annotations!, Has.Count.EqualTo(2));\n\t\tvar expectedArray = JsonDocument.Parse(\"[\\\"foo\\\"]\").RootElement;\n\t\tJsonAssert.AreEquivalent(expectedArray, result.Annotations![\"$unknownKeywords\"]);\n\t}\n\n\t[Test]\n\tpublic void AnnotationsProducedForKnownButUnused()\n\t{\n\t\tvar schema = new JsonSchemaBuilder()\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Dependencies(new Dictionary\n\t\t\t{\n\t\t\t\t[\"foo\"] = (JsonSchemaBuilder)false\n\t\t\t});\n\n\t\tvar instance = JsonDocument.Parse(\"{\\\"bar\\\": 5}\").RootElement;\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical,\n\t\t\tAddAnnotationForUnknownKeywords = true\n\t\t});\n\n\t\tresult.AssertValid();\n\t\tAssert.That(result.Annotations!, Has.Count.EqualTo(2));\n\t\tvar expectedDeps = JsonDocument.Parse(\"{\\\"foo\\\": false}\").RootElement;\n\t\tJsonAssert.AreEquivalent(expectedDeps, result.Annotations![\"dependencies\"]);\n\t\tvar expectedKeywords = JsonDocument.Parse(\"[\\\"dependencies\\\"]\").RootElement;\n\t\tJsonAssert.AreEquivalent(expectedKeywords, result.Annotations[\"$unknownKeywords\"]);\n\t}\n\n\t[Test]\n\tpublic void FooProducesAnAnnotation_Constructed()\n\t{\n\t\tvar buildOptions = new BuildOptions { Dialect = Dialect.Draft202012 };\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Unrecognized(\"foo\", \"bar\")\n\t\t\t.Build();\n\n\t\tvar instance = JsonDocument.Parse(\"{}\").RootElement;\n\t\tvar result = schema.Evaluate(instance, new EvaluationOptions { OutputFormat = OutputFormat.Hierarchical });\n\n\t\tresult.AssertValid();\n\t\tAssert.That(result.Annotations!, Has.Count.EqualTo(1));\n\t\tJsonAssert.AreEquivalent(\"bar\".AsJsonElement(), result.Annotations![\"foo\"]);\n\t}\n\n\t[Test]\n\tpublic void FooProducesAnAnnotation_WithSchemaKeyword()\n\t{\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = OutputFormat.Hierarchical\n\t\t};\n\t\tvar schema = new JsonSchemaBuilder()\n\t\t\t.Id(\"https://example.com\")\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Unrecognized(\"foo\", \"bar\")\n\t\t\t.Build();", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Schema.Keywords;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespac" + }, + { + "title": "src/JsonSchema.Tests/UnrecognizedKeywordTests.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/UnrecognizedKeywordTests.cs#L121-L195", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/UnrecognizedKeywordTests.cs", + "startLine": 121, + "endLine": 195, + "content": "var instance = JsonDocument.Parse(\"{}\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, options);\n\n\t\tvar serializerOptions = new JsonSerializerOptions()\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tWriteIndented = true,\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t\t};\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(result, serializerOptions));\n\n\t\tresult.AssertValid();\n\t\tAssert.That(result.Annotations!, Has.Count.EqualTo(1));\n\t\tJsonAssert.AreEquivalent(\"bar\".AsJsonElement(), result.Annotations![\"foo\"]);\n\t}\n\n\t[Test]\n\tpublic void FooIsIncludedInSerialization()\n\t{\n\t\tvar schemaText = \"{\\\"foo\\\":\\\"bar\\\"}\";\n\n\t\tvar buildOptions = new BuildOptions { Dialect = Dialect.Draft202012 };\n\t\tvar schema = JsonSchema.FromText(schemaText, buildOptions);\n\n\t\tvar reText = JsonSerializer.Serialize(schema, TestEnvironment.SerializerOptions);\n\n\t\tAssert.That(reText, Is.EqualTo(schemaText));\t\n\t}\n\n\t[Test]\n\tpublic void FooIsNotAKeyword_DefaultDialect_ThrowsException()\n\t{\n\t\tvar schemaText = \"{\\\"foo\\\": \\\"bar\\\"}\";\n\n\t\tvar ex = Assert.Throws(() => JsonSchema.FromText(schemaText));\n\t\tAssert.That(ex!.Message, Does.Contain(\"Unknown keywords (foo) are disallowed for this dialect.\"));\n\t}\n\n\t[Test]\n\tpublic void FooProducesAnAnnotation_DefaultDialect_ThrowsException()\n\t{\n\t\tvar schemaText = \"{\\\"foo\\\": \\\"bar\\\"}\";\n\n\t\tvar ex = Assert.Throws(() => JsonSchema.FromText(schemaText));\n\t\tAssert.That(ex!.Message, Does.Contain(\"Unknown keywords (foo) are disallowed for this dialect.\"));\n\t}\n\n\t[Test]\n\tpublic void UnknownKeywordAnnotationIsProduced_DefaultDialect_ThrowsException()\n\t{\n\t\tvar schemaText = \"{\\\"foo\\\": \\\"bar\\\"}\";\n\n\t\tvar ex = Assert.Throws(() => JsonSchema.FromText(schemaText));\n\t\tAssert.That(ex!.Message, Does.Contain(\"Unknown keywords (foo) are disallowed for this dialect.\"));\n\t}\n\n\t[Test]\n\tpublic void FooProducesAnAnnotation_Constructed_DefaultDialect_ThrowsException()\n\t{\n\t\tvar ex = Assert.Throws(() => new JsonSchemaBuilder()\n\t\t\t.Unrecognized(\"foo\", \"bar\")\n\t\t\t.Build());\n\t\tAssert.That(ex!.Message, Does.Contain(\"Unknown keywords (foo) are disallowed for this dialect.\"));\n\t}\n\n\t[Test]\n\tpublic void FooIsIncludedInSerialization_DefaultDialect_ThrowsException()\n\t{\n\t\tvar schemaText = \"{\\\"foo\\\":\\\"bar\\\"}\";\n\n\t\tvar ex = Assert.Throws(() => JsonSchema.FromText(schemaText));\n\t\tAssert.That(ex!.Message, Does.Contain(\"Unknown keywords (foo) are disallowed for this dialect.\"));\n\t}\n}", + "snippet": "var instance = JsonDocument.Parse(\"{}\").RootElement;\n\n\t\tvar result = schema.Evaluate(instance, options);\n\n\t\tvar serializerOptions = new JsonSerializerOptions()\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Defau" + }, + { + "title": "src/JsonSchema.Tests/VocabularyBasedDialectTests.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/VocabularyBasedDialectTests.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/VocabularyBasedDialectTests.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Globalization;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\n/// \n/// Tests that verify the system can build dialects dynamically from $vocabulary keywords in meta-schemas.\n/// \npublic class VocabularyBasedDialectTests\n{\n\tpublic class MinDateKeyword : IKeywordHandler\n\t{\n\t\tpublic static readonly MinDateKeyword Instance = new();\n\n\t\tpublic string Name => \"minDate\";\n\n\t\tprivate MinDateKeyword()\n\t\t{\n\t\t}\n\n\t\tpublic object? ValidateKeywordValue(JsonElement value)\n\t\t{\n\t\t\tif (value.ValueKind is not JsonValueKind.String)\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\t\treturn DateTime.Parse(value.GetString()!, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);\n\t\t}\n\n\t\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t\t{\n\t\t}\n\n\t\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t\t{\n\t\t\tif (context.Instance.ValueKind is not JsonValueKind.String) return KeywordEvaluation.Ignore;\n\n\t\t\tvar dateString = context.Instance.GetString();\n\t\t\tvar date = DateTime.Parse(dateString!, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);\n\t\t\tvar expectedDate = (DateTime)keyword.Value!;\n\n\t\t\tif (date < expectedDate)\n\t\t\t{\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false,\n\t\t\t\t\tError = $\"Date must be on or after {expectedDate:O}\"\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\t\t}\n\t}\n\n\tpublic class MaxDateKeyword : IKeywordHandler\n\t{\n\t\tpublic static readonly MaxDateKeyword Instance = new();\n\n\t\tpublic string Name => \"maxDate\";\n\n\t\tprivate MaxDateKeyword()\n\t\t{\n\t\t}\n\n\t\tpublic object? ValidateKeywordValue(JsonElement value)\n\t\t{\n\t\t\tif (value.ValueKind is not JsonValueKind.String)\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\t\treturn DateTime.Parse(value.GetString()!, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);\n\t\t}\n\n\t\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t\t{\n\t\t}\n\n\t\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t\t{\n\t\t\tif (context.Instance.ValueKind is not JsonValueKind.String) return KeywordEvaluation.Ignore;\n\n\t\t\tvar dateString = context.Instance.GetString();\n\t\t\tvar date = DateTime.Parse(dateString!, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);\n\t\t\tvar expectedDate = (DateTime)keyword.Value!;\n\n\t\t\tif (date > expectedDate)\n\t\t\t{\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false,\n\t\t\t\t\tError = $\"Date must be on or before {expectedDate:O}\"\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\t\t}\n\t}\n\n\tprivate static readonly JsonSerializerOptions _serializerOptions =\n\t\tnew()\n\t\t{\n\t\t\tTypeInfoResolverChain = { TestSerializerContext.Default },\n\t\t\tWriteIndented = true,\n\t\t\tEncoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping\n\t\t};\n\n\t// Define a custom vocabulary for date validation\n\tprivate static readonly Vocabulary _datesVocabulary =", + "snippet": "using System;\nusing System.Globalization;\nusing System.Text.Encodings.Web;\nusing System.Text.Json;\nusing NUnit.Framework;\nusing TestHelpers;\n\nnamespace Json.Schema.Tests;\n\n/// \n/// Tests that verify the system c" + }, + { + "title": "src/JsonSchema.Tests/VocabularyBasedDialectTests.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/VocabularyBasedDialectTests.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/VocabularyBasedDialectTests.cs", + "startLine": 121, + "endLine": 240, + "content": "new(new Uri(\"https://json-everything.test/vocabulary/dates/v1\"), MinDateKeyword.Instance, MaxDateKeyword.Instance);\n\n\t// Define a meta-schema builder that declares this vocabulary\n\tprivate static readonly JsonSchemaBuilder _datesMetaSchemaBuilder =\n\t\tnew JsonSchemaBuilder()\n\t\t\t.Id(\"https://json-everything.test/meta/dates-draft-2019-09\")\n\t\t\t.Schema(MetaSchemas.Draft201909Id)\n\t\t\t.Vocabulary(\n\t\t\t\t(Vocabulary.Draft201909_Core.Id, true),\n\t\t\t\t(Vocabulary.Draft201909_Applicator.Id, true),\n\t\t\t\t(Vocabulary.Draft201909_Validation.Id, true),\n\t\t\t\t(Vocabulary.Draft201909_MetaData.Id, true),\n\t\t\t\t(new Uri(\"https://json-everything.test/vocabulary/dates/v1\"), true)\n\t\t\t)\n\t\t\t.Properties(\n\t\t\t\t(MinDateKeyword.Instance.Name, new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.Format(Formats.DateTime)\n\t\t\t\t),\n\t\t\t\t(MaxDateKeyword.Instance.Name, new JsonSchemaBuilder()\n\t\t\t\t\t.Type(SchemaValueType.String)\n\t\t\t\t\t.Format(Formats.DateTime)\n\t\t\t\t)\n\t\t\t);\n\n\t[Test]\n\tpublic void VocabularyBasedDialect_BuildsFromMetaSchema_VocabularyRegistered()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new(),\n\t\t\tVocabularyRegistry = new VocabularyRegistry(),\n\t\t\tDialectRegistry = new()\n\t\t};\n\t\tvar datesMetaSchema = _datesMetaSchemaBuilder.Build(buildOptions);\n\n\t\tbuildOptions.VocabularyRegistry.Register(_datesVocabulary);\n\t\tbuildOptions.SchemaRegistry.Register(datesMetaSchema);\n\n\t\tvar futureDate = DateTime.UtcNow.AddDays(1);\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(\"https://json-everything.test/meta/dates-draft-2019-09\")\n\t\t\t.MinDate(futureDate)\n\t\t\t.Build();\n\n\t\tvar validInstance = JsonDocument.Parse($\"\\\"{DateTime.UtcNow.AddDays(2):O}\\\"\").RootElement;\n\t\tvar invalidInstance = JsonDocument.Parse($\"\\\"{DateTime.UtcNow:O}\\\"\").RootElement;\n\n\t\tTestConsole.WriteLine(JsonSerializer.Serialize(schema, _serializerOptions));\n\t\tTestConsole.WriteLine();\n\n\t\tvar validResult = schema.Evaluate(validInstance);\n\t\tvar invalidResult = schema.Evaluate(invalidInstance);\n\n\t\tvalidResult.AssertValid();\n\t\tinvalidResult.AssertInvalid();\n\t}\n\n\t[Test]\n\tpublic void VocabularyBasedDialect_VocabularyNotRegistered_ThrowsException()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new(),\n\t\t\tVocabularyRegistry = new VocabularyRegistry(),\n\t\t\tDialectRegistry = new()\n\t\t};\n\t\tvar datesMetaSchema = _datesMetaSchemaBuilder.Build(buildOptions);\n\n\t\t// Don't register the vocabulary - it's required\n\t\tbuildOptions.SchemaRegistry.Register(datesMetaSchema);\n\n\t\tvar futureDate = DateTime.UtcNow.AddDays(1);\n\n\t\tAssert.Throws(() =>\n\t\t\tnew JsonSchemaBuilder(buildOptions)\n\t\t\t\t.Schema(\"https://json-everything.test/meta/dates-draft-2019-09\")\n\t\t\t\t.MinDate(futureDate)\n\t\t\t\t.Build());\n\t}\n\n\t[Test]\n\tpublic void VocabularyBasedDialect_OptionalVocabulary_WorksWithoutRegistration()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new(),\n\t\t\tDialect = Dialect.Draft201909,\n\t\t\tVocabularyRegistry = new VocabularyRegistry(),\n\t\t\tDialectRegistry = new()\n\t\t};\n\n\t\t// Create a meta-schema with an optional vocabulary\n\t\tvar optionalVocabMetaSchema =\n\t\t\tnew JsonSchemaBuilder()\n\t\t\t\t.Id(\"https://json-everything.test/meta/dates-optional\")\n\t\t\t\t.Schema(MetaSchemas.Draft201909Id)\n\t\t\t\t.Vocabulary(\n\t\t\t\t\t(Vocabulary.Draft201909_Core.Id, true),\n\t\t\t\t\t(Vocabulary.Draft201909_Applicator.Id, true),\n\t\t\t\t\t(Vocabulary.Draft201909_Validation.Id, true),\n\t\t\t\t\t(new Uri(\"https://json-everything.test/vocabulary/dates/v1\"), false) // Optional\n\t\t\t\t)\n\t\t\t\t.Build();\n\n\t\t// need a new build options\n\t\tbuildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new(),\n\t\t\tDialect = Dialect.Draft201909,\n\t\t\tVocabularyRegistry = new VocabularyRegistry(),\n\t\t\tDialectRegistry = new()\n\t\t};\n\t\t// Don't register the vocabulary - it's optional\n\t\tbuildOptions.SchemaRegistry.Register(optionalVocabMetaSchema);\n\n\t\tvar futureDate = DateTime.UtcNow.AddDays(1);\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(\"https://json-everything.test/meta/dates-optional\")\n\t\t\t.MinDate(futureDate)", + "snippet": "new(new Uri(\"https://json-everything.test/vocabulary/dates/v1\"), MinDateKeyword.Instance, MaxDateKeyword.Instance);\n\n\t// Define a meta-schema builder that declares this vocabulary\n\tprivate static readonly JsonSchemaBuild" + }, + { + "title": "src/JsonSchema.Tests/VocabularyBasedDialectTests.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema.Tests/VocabularyBasedDialectTests.cs#L241-L280", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema.Tests/VocabularyBasedDialectTests.cs", + "startLine": 241, + "endLine": 280, + "content": ".Build();\n\n\t\t// Without the vocabulary registered, the minDate keyword should be ignored\n\t\tvar invalidInstance = JsonDocument.Parse($\"\\\"{DateTime.UtcNow:O}\\\"\").RootElement;\n\t\tvar result = schema.Evaluate(invalidInstance);\n\n\t\tresult.AssertValid(); // Should pass because minDate is not processed\n\t}\n\n\t[Test]\n\tpublic void VocabularyBasedDialect_MetaSchemaValidation_VocabularyKnown()\n\t{\n\t\tvar buildOptions = new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = new(),\n\t\t\tVocabularyRegistry = new VocabularyRegistry(),\n\t\t\tDialectRegistry = new()\n\t\t};\n\t\tvar datesMetaSchema = _datesMetaSchemaBuilder.Build(buildOptions);\n\n\t\tbuildOptions.VocabularyRegistry.Register(_datesVocabulary);\n\t\tbuildOptions.SchemaRegistry.Register(datesMetaSchema);\n\n\t\tvar futureDate = DateTime.UtcNow.AddDays(1);\n\t\tvar schema = new JsonSchemaBuilder(buildOptions)\n\t\t\t.Schema(\"https://json-everything.test/meta/dates-draft-2019-09\")\n\t\t\t.MinDate(futureDate)\n\t\t\t.Build();\n\n\t\t// Validate the schema against its meta-schema\n\t\tvar schemaAsJson = JsonDocument.Parse(JsonSerializer.Serialize(schema, _serializerOptions)).RootElement;\n\t\tvar results = datesMetaSchema.Evaluate(schemaAsJson);\n\n\t\tTestConsole.WriteLine(schemaAsJson);\n\t\tTestConsole.WriteLine();\n\n\t\tresults.AssertValid();\n\t}\n}", + "snippet": ".Build();\n\n\t\t// Without the vocabulary registered, the minDate keyword should be ignored\n\t\tvar invalidInstance = JsonDocument.Parse($\"\\\"{DateTime.UtcNow:O}\\\"\").RootElement;\n\t\tvar result = schema.Evaluate(invalidInstance)" + }, + { + "title": "src/JsonSchema/__ModuleInitialization.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/__ModuleInitialization.cs#L1-L74", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/__ModuleInitialization.cs", + "startLine": 1, + "endLine": 74, + "content": "using System;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Text.Json;\n// ReSharper disable InconsistentNaming\n#pragma warning disable IDE1006\n\nnamespace Json.Schema;\n\ninternal static class __ModuleInitialization\n{\n\tprivate static int _initialized;\n\n\t[ModuleInitializer]\n\tpublic static void Initialize()\n\t{\n\t\tif (System.Threading.Interlocked.Exchange(ref _initialized, 1) == 1) return;\n\n\t\tLoadDialects();\n\n\t\tLoadMetaSchemas();\n\t}\n\n\tprivate static void LoadDialects()\n\t{\n\t\tVocabularyRegistry.Global.RegisterDefaultVocabs();\n\t\tDialectRegistry.Global.RegisterDefaultDialects();\n\n\t\tDialect.Default = Dialect.V1;\n\t}\n\n\tprivate static void LoadMetaSchemas()\n\t{\n\t\tvar buildOptions = new BuildOptions();\n\n\t\tMetaSchemas.Draft6 = LoadMetaSchema(\"schema06\", buildOptions);\n\n\t\tMetaSchemas.Draft7 = LoadMetaSchema(\"schema07\", buildOptions);\n\n\t\tMetaSchemas.Applicator201909 = LoadMetaSchema(\"_2019_09.applicator\", buildOptions);\n\t\tMetaSchemas.Content201909 = LoadMetaSchema(\"_2019_09.content\", buildOptions);\n\t\tMetaSchemas.Core201909 = LoadMetaSchema(\"_2019_09.core\", buildOptions);\n\t\tMetaSchemas.Format201909 = LoadMetaSchema(\"_2019_09.format\", buildOptions);\n\t\tMetaSchemas.Metadata201909 = LoadMetaSchema(\"_2019_09.meta-data\", buildOptions);\n\t\tMetaSchemas.Validation201909 = LoadMetaSchema(\"_2019_09.validation\", buildOptions);\n\t\tMetaSchemas.Draft201909 = LoadMetaSchema(\"_2019_09.schema\", buildOptions);\n\n\t\tMetaSchemas.Applicator202012 = LoadMetaSchema(\"_2020_12.applicator\", buildOptions);\n\t\tMetaSchemas.Content202012 = LoadMetaSchema(\"_2020_12.content\", buildOptions);\n\t\tMetaSchemas.Core202012 = LoadMetaSchema(\"_2020_12.core\", buildOptions);\n\t\tMetaSchemas.FormatAnnotation202012 = LoadMetaSchema(\"_2020_12.format-annotation\", buildOptions);\n\t\tMetaSchemas.FormatAssertion202012 = LoadMetaSchema(\"_2020_12.format-assertion\", buildOptions);\n\t\tMetaSchemas.Metadata202012 = LoadMetaSchema(\"_2020_12.meta-data\", buildOptions);\n\t\tMetaSchemas.Unevaluated202012 = LoadMetaSchema(\"_2020_12.unevaluated\", buildOptions);\n\t\tMetaSchemas.Validation202012 = LoadMetaSchema(\"_2020_12.validation\", buildOptions);\n\t\tMetaSchemas.Draft202012 = LoadMetaSchema(\"_2020_12.schema\", buildOptions);\n\t\t\n\t\tMetaSchemas.V1_2026 = LoadMetaSchema(\"v1\", buildOptions);\n\n\t\tSchemaRegistry.Global.Register(new Uri(\"https://json-schema.org/v1\", UriKind.Absolute), MetaSchemas.V1_2026);\n\t}\n\n\tprivate static JsonSchema LoadMetaSchema(string resourceName, BuildOptions buildOptions)\n\t{\n\t\tvar resourceStream = typeof(MetaSchemas).Assembly.GetManifestResourceStream(@$\"Json.Schema.Meta_Schemas.{resourceName}.json\");\n\t\tusing var reader = new StreamReader(resourceStream!, Encoding.UTF8);\n\n\t\tvar text = reader.ReadToEnd();\n\t\tvar json = JsonDocument.Parse(text).RootElement;\n\n\t\treturn JsonSchema.Build(json, buildOptions);\n\t}\n}", + "snippet": "using System;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Text.Json;\n// ReSharper disable InconsistentNaming\n#pragma warning disable IDE1006\n\nnamespace Json.Schema;\n\ninternal s" + }, + { + "title": "src/JsonSchema/assembly.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/assembly.cs#L1-L4", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/assembly.cs", + "startLine": 1, + "endLine": 4, + "content": "using System.Runtime.CompilerServices;\n\n//[assembly: InternalsVisibleTo(\"JsonSchema.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d111b5991feb360746cf4535b9ec3196825996680b6599cf10748f90a58ec820431f81d21eff5229a3fd7c3e42e46a20584ac413ebe39b4c05905fd47b877bffed36bff23ad4ad14aad3deed8f24ed40a1371daad79a41172b2cdf0db4b664198f38f3a19419457131f8ee4558e628b5c986bb574d4e151b650eae6aa1f5ccbf\")]", + "snippet": "using System.Runtime.CompilerServices;\n\n//[assembly: InternalsVisibleTo(\"JsonSchema.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d111b5991feb360746cf4535b9ec3196825996680b6599cf10748f9" + }, + { + "title": "src/JsonSchema/BuildContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/BuildContext.cs#L1-L59", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/BuildContext.cs", + "startLine": 1, + "endLine": 59, + "content": "using System;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n/// \n/// Provides contextual information required during the construction of a schema, including build options, schema\n/// documents, and dialect settings.\n/// \n/// Use this structure to pass relevant build parameters processing keywords. The context encapsulates\n/// both global and local schema data, as well as the base URI and dialect, ensuring consistent schema resolution\n/// and validation throughout the build process.\npublic struct BuildContext\n{\n\t/// \n\t/// Gets the configuration options used for the build process.\n\t/// \n\tpublic BuildOptions Options { get; }\n\t/// \n\t/// Gets or sets the base URI used to resolve relative resource references.\n\t/// \n\tpublic Uri BaseUri { get; set; }\n\t/// \n\t/// Gets or sets the local value from which a new schema is to be built.\n\t/// \n\tpublic JsonElement LocalSchema { get; set; }\n\t/// \n\t/// Gets or set the JSON Schema dialect to use in the build process.\n\t/// \n\tpublic Dialect Dialect { get; set; }\n\t/// \n\t/// Gets or sets the path to the in addition to the keyword.\n\t/// \n\t/// For example, for the `properties` keyword, this pointer indicates the property name.\n\tpublic JsonPointer RelativePath { get; set; }\n\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\t[Obsolete(\"This is only for advanced usage.\")]\n\tpublic JsonPointer PathFromResourceRoot { get; set; } = JsonPointer.Empty;\n#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member\n\n\tinternal bool Register { get; set; }\n\n\tinternal BuildContext(BuildOptions options, Uri baseUri, bool register)\n\t{\n\t\tOptions = options;\n\t\tBaseUri = baseUri;\n\t\tDialect = Options.Dialect;\n\t\tRegister = register;\n\t}\n\n\t/// \n\t/// Creates a copy of a build context from the one that was used to build a keyword.\n\t/// \n\t/// The keyword.\n\t/// A copy of the build context.\n\tpublic static BuildContext From(KeywordData keyword) => keyword.Context;\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n/// \n/// Provides contextual information required during the construction of a schema, including build options, schema\n/// docum" + }, + { + "title": "src/JsonSchema/BuildOptions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/BuildOptions.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/BuildOptions.cs", + "startLine": 1, + "endLine": 39, + "content": "namespace Json.Schema;\n\n/// \n/// Provides configuration options for schema building, including registries and dialect selection.\n/// \n/// Use this class to customize how schemas are built, such as specifying registries for\n/// schemas, vocabularies, and dialects. The options set in this class determine how schema resolution and dialect\n/// selection are performed during the build process. The static property provides a set of\n/// default options suitable for most scenarios.\npublic class BuildOptions\n{\n\t/// \n\t/// The default settings.\n\t/// \n\tpublic static BuildOptions Default { get; } = new();\n\n\t/// \n\t/// The local schema registry. If a schema is not found here, it will\n\t/// automatically check the global registry as well.\n\t/// \n\tpublic SchemaRegistry SchemaRegistry { get; set; } = SchemaRegistry.Global;\n\n\t/// \n\t/// The local vocabulary registry. If a vocabulary is not found here, it will\n\t/// automatically check the global registry as well.\n\t/// \n\tpublic VocabularyRegistry VocabularyRegistry { get; set; } = VocabularyRegistry.Global;\n\n\t/// \n\t/// The local dialect registry. If a dialect is not found here, it will\n\t/// automatically check the global registry as well.\n\t/// \n\tpublic DialectRegistry DialectRegistry { get; set; } = DialectRegistry.Global;\n\n\t/// \n\t/// Gets the dialect to be used when building schemas with these options.\n\t/// \n\tpublic Dialect Dialect { get; set; } = Dialect.Default;\n}", + "snippet": "namespace Json.Schema;\n\n/// \n/// Provides configuration options for schema building, including registries and dialect selection.\n/// \n/// Use this class to customize how schemas are built, suc" + }, + { + "title": "src/JsonSchema/DependsOnAnnotationsFromAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/DependsOnAnnotationsFromAttribute.cs#L1-L49", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/DependsOnAnnotationsFromAttribute.cs", + "startLine": 1, + "endLine": 49, + "content": "using System;\n\nnamespace Json.Schema;\n\n/// \n/// Indicates a keyword from which the decorated keyword requires annotations.\n/// \n/// \n/// Apply this attribute to your schema keyword to indicate a dependency on another keyword.\n/// \n[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true)]\npublic class DependsOnAnnotationsFromAttribute : Attribute\n{\n\t/// \n\t/// The dependent type.\n\t/// \n\tpublic Type DependentType { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The dependent type.\n\tpublic DependsOnAnnotationsFromAttribute(Type type)\n\t{\n\t\tDependentType = type ?? throw new ArgumentNullException(nameof(type));\n\t}\n}\n\n/// \n/// Indicates a keyword from which the decorated keyword requires annotations.\n/// \n/// \n/// Apply this attribute to your schema keyword to indicate a dependency on another keyword.\n///\n/// **Warning**: Generic attributes are not supported in .Net Framework. If your target\n/// includes .Net Framework, use the non-generic form of this attribute.\n/// \n[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true)]\npublic class DependsOnAnnotationsFromAttribute : DependsOnAnnotationsFromAttribute\n\twhere T : IKeywordHandler\n{\n\t/// \n\t/// Creates a new instance.\n\t/// \n\tpublic DependsOnAnnotationsFromAttribute()\n\t\t: base(typeof(T))\n\t{\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Schema;\n\n/// \n/// Indicates a keyword from which the decorated keyword requires annotations.\n/// \n/// \n/// Apply this attribute to your schema keyword to indicate" + }, + { + "title": "src/JsonSchema/Dialect.06.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Dialect.06.cs#L1-L59", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Dialect.06.cs", + "startLine": 1, + "endLine": 59, + "content": "using Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\npublic partial class Dialect\n{\n\t/// \n\t/// Gets the JSON Schema dialect definition for Draft 6.\n\t/// \n\t/// Use this property to evaluate schemas that conform to the JSON Schema Draft 6 specification.\n\t/// The dialect includes all standard Draft 6 keywords and allows unknown keywords. Sibling keywords are\n\t/// ignored when resolving references using the '$ref' keyword.\n\tpublic static Dialect Draft06 { get; } = new(\n\t\tKeywords.Draft06.AdditionalItemsKeyword.Instance,\n\t\tAdditionalPropertiesKeyword.Instance,\n\t\tAllOfKeyword.Instance,\n\t\tAnyOfKeyword.Instance,\n\t\tCommentKeyword.Instance,\n\t\tConstKeyword.Instance,\n\t\tKeywords.Draft06.ContainsKeyword.Instance,\n\t\tDefaultKeyword.Instance,\n\t\tKeywords.Draft06.DefinitionsKeyword.Instance,\n\t\tKeywords.Draft06.DependenciesKeyword.Instance,\n\t\tDescriptionKeyword.Instance,\n\t\tEnumKeyword.Instance,\n\t\tExamplesKeyword.Instance,\n\t\tExclusiveMaximumKeyword.Instance,\n\t\tExclusiveMinimumKeyword.Instance,\n\t\tKeywords.Draft06.FormatKeyword.Annotate,\n\t\tKeywords.Draft06.IdKeyword.Instance,\n\t\tKeywords.Draft06.ItemsKeyword.Instance,\n\t\tMaximumKeyword.Instance,\n\t\tMaxItemsKeyword.Instance,\n\t\tMaxLengthKeyword.Instance,\n\t\tMaxPropertiesKeyword.Instance,\n\t\tMinimumKeyword.Instance,\n\t\tMinItemsKeyword.Instance,\n\t\tMinLengthKeyword.Instance,\n\t\tMinPropertiesKeyword.Instance,\n\t\tMultipleOfKeyword.Instance,\n\t\tNotKeyword.Instance,\n\t\tOneOfKeyword.Instance,\n\t\tPatternKeyword.Instance,\n\t\tPatternPropertiesKeyword.Instance,\n\t\tPropertiesKeyword.Instance,\n\t\tPropertyNamesKeyword.Instance,\n\t\tRefKeyword.Instance,\n\t\tRequiredKeyword.Instance,\n\t\tSchemaKeyword.Instance,\n\t\tTitleKeyword.Instance,\n\t\tTypeKeyword.Instance,\n\t\tUniqueItemsKeyword.Instance\n\t)\n\t{\n\t\tId = MetaSchemas.Draft6Id,\n\t\tRefIgnoresSiblingKeywords = true,\n\t\tAllowUnknownKeywords = true\n\t};\n}", + "snippet": "using Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\npublic partial class Dialect\n{\n\t/// \n\t/// Gets the JSON Schema dialect definition for Draft 6.\n\t/// \n\t/// Use this property to evaluate sch" + }, + { + "title": "src/JsonSchema/Dialect.07.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Dialect.07.cs#L1-L66", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Dialect.07.cs", + "startLine": 1, + "endLine": 66, + "content": "using Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\npublic partial class Dialect\n{\n\t/// \n\t/// Gets the JSON Schema dialect definition for Draft 7.\n\t/// \n\t/// Use this property to evaluate schemas that conform to the Draft 7 specification.\n\t/// The dialect includes all standard Draft 7 keywords and allows unknown keywords. Sibling keywords are\n\t/// ignored when resolving references using the \"$ref\" keyword.\n\tpublic static Dialect Draft07 { get; } = new(\n\t\tKeywords.Draft06.AdditionalItemsKeyword.Instance,\n\t\tAdditionalPropertiesKeyword.Instance,\n\t\tAllOfKeyword.Instance,\n\t\tAnyOfKeyword.Instance,\n\t\tCommentKeyword.Instance,\n\t\tConstKeyword.Instance,\n\t\tKeywords.Draft06.ContainsKeyword.Instance,\n\t\tContentEncodingKeyword.Instance,\n\t\tContentMediaTypeKeyword.Instance,\n\t\tDefaultKeyword.Instance,\n\t\tKeywords.Draft06.DefinitionsKeyword.Instance,\n\t\tKeywords.Draft06.DependenciesKeyword.Instance,\n\t\tDescriptionKeyword.Instance,\n\t\tElseKeyword.Instance,\n\t\tEnumKeyword.Instance,\n\t\tExamplesKeyword.Instance,\n\t\tExclusiveMaximumKeyword.Instance,\n\t\tExclusiveMinimumKeyword.Instance,\n\t\tKeywords.Draft06.FormatKeyword.Annotate,\n\t\tKeywords.Draft06.IdKeyword.Instance,\n\t\tIfKeyword.Instance,\n\t\tKeywords.Draft06.ItemsKeyword.Instance,\n\t\tMaximumKeyword.Instance,\n\t\tMaxItemsKeyword.Instance,\n\t\tMaxLengthKeyword.Instance,\n\t\tMaxPropertiesKeyword.Instance,\n\t\tMinimumKeyword.Instance,\n\t\tMinItemsKeyword.Instance,\n\t\tMinLengthKeyword.Instance,\n\t\tMinPropertiesKeyword.Instance,\n\t\tMultipleOfKeyword.Instance,\n\t\tNotKeyword.Instance,\n\t\tOneOfKeyword.Instance,\n\t\tPatternKeyword.Instance,\n\t\tPatternPropertiesKeyword.Instance,\n\t\tPropertiesKeyword.Instance,\n\t\tPropertyNamesKeyword.Instance,\n\t\tReadOnlyKeyword.Instance,\n\t\tRefKeyword.Instance,\n\t\tRequiredKeyword.Instance,\n\t\tSchemaKeyword.Instance,\n\t\tThenKeyword.Instance,\n\t\tTitleKeyword.Instance,\n\t\tTypeKeyword.Instance,\n\t\tUniqueItemsKeyword.Instance,\n\t\tWriteOnlyKeyword.Instance\n\t)\n\t{\n\t\tId = MetaSchemas.Draft7Id,\n\t\tRefIgnoresSiblingKeywords = true,\n\t\tAllowUnknownKeywords = true\n\t};\n}", + "snippet": "using Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\npublic partial class Dialect\n{\n\t/// \n\t/// Gets the JSON Schema dialect definition for Draft 7.\n\t/// \n\t/// Use this property to evaluate sch" + }, + { + "title": "src/JsonSchema/Dialect.201909.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Dialect.201909.cs#L1-L76", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Dialect.201909.cs", + "startLine": 1, + "endLine": 76, + "content": "using Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\npublic partial class Dialect\n{\n\t/// \n\t/// Gets the JSON Schema dialect definition for Draft 2019-09.\n\t/// \n\t/// Use this property to evaluate schemas that conform to the Draft 2019-09 specification.\n\t/// The dialect includes all standard Draft 2019-09 keywords and allows unknown keywords. Sibling keywords are\n\t/// processed when resolving references using the \"$ref\" keyword.\n\tpublic static Dialect Draft201909 { get; } = new(\n\t\tKeywords.Draft06.AdditionalItemsKeyword.Instance,\n\t\tAdditionalPropertiesKeyword.Instance,\n\t\tAllOfKeyword.Instance,\n\t\tKeywords.Draft201909.AnchorKeyword.Instance,\n\t\tAnyOfKeyword.Instance,\n\t\tCommentKeyword.Instance,\n\t\tConstKeyword.Instance,\n\t\tContainsKeyword.Instance,\n\t\tContentEncodingKeyword.Instance,\n\t\tContentMediaTypeKeyword.Instance,\n\t\tContentSchemaKeyword.Instance,\n\t\tDefaultKeyword.Instance,\n\t\tDefsKeyword.Instance,\n\t\tDependentRequiredKeyword.Instance,\n\t\tDependentSchemasKeyword.Instance,\n\t\tDeprecatedKeyword.Instance,\n\t\tDescriptionKeyword.Instance,\n\t\tElseKeyword.Instance,\n\t\tEnumKeyword.Instance,\n\t\tExamplesKeyword.Instance,\n\t\tExclusiveMaximumKeyword.Instance,\n\t\tExclusiveMinimumKeyword.Instance,\n\t\tKeywords.Draft06.FormatKeyword.Annotate,\n\t\tIdKeyword.Instance,\n\t\tIfKeyword.Instance,\n\t\tKeywords.Draft06.ItemsKeyword.Instance,\n\t\tMaxContainsKeyword.Instance,\n\t\tMaximumKeyword.Instance,\n\t\tMaxItemsKeyword.Instance,\n\t\tMaxLengthKeyword.Instance,\n\t\tMaxPropertiesKeyword.Instance,\n\t\tMinContainsKeyword.Instance,\n\t\tMinimumKeyword.Instance,\n\t\tMinItemsKeyword.Instance,\n\t\tMinLengthKeyword.Instance,\n\t\tMinPropertiesKeyword.Instance,\n\t\tMultipleOfKeyword.Instance,\n\t\tNotKeyword.Instance,\n\t\tOneOfKeyword.Instance,\n\t\tPatternKeyword.Instance,\n\t\tPatternPropertiesKeyword.Instance,\n\t\tPropertiesKeyword.Instance,\n\t\tPropertyNamesKeyword.Instance,\n\t\tReadOnlyKeyword.Instance,\n\t\tKeywords.Draft201909.RecursiveAnchorKeyword.Instance,\n\t\tKeywords.Draft201909.RecursiveRefKeyword.Instance,\n\t\tRefKeyword.Instance,\n\t\tRequiredKeyword.Instance,\n\t\tSchemaKeyword.Instance,\n\t\tThenKeyword.Instance,\n\t\tTitleKeyword.Instance,\n\t\tTypeKeyword.Instance,\n\t\tKeywords.Draft201909.UnevaluatedItemsKeyword.Instance,\n\t\tUnevaluatedPropertiesKeyword.Instance,\n\t\tUniqueItemsKeyword.Instance,\n\t\tKeywords.Draft201909.VocabularyKeyword.Instance,\n\t\tWriteOnlyKeyword.Instance\n\t)\n\t{\n\t\tId = MetaSchemas.Draft201909Id,\n\t\tAllowUnknownKeywords = true\n\t};\n}", + "snippet": "using Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\npublic partial class Dialect\n{\n\t/// \n\t/// Gets the JSON Schema dialect definition for Draft 2019-09.\n\t/// \n\t/// Use this property to evalua" + }, + { + "title": "src/JsonSchema/Dialect.202012.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Dialect.202012.cs#L1-L76", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Dialect.202012.cs", + "startLine": 1, + "endLine": 76, + "content": "using Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\npublic partial class Dialect\n{\n\t/// \n\t/// Gets the JSON Schema dialect definition for Draft 2020-12.\n\t/// \n\t/// Use this property to evaluate schemas that conform to the Draft 2020-12 specification.\n\t/// The dialect includes all standard Draft 2020-12 keywords and allows unknown keywords. Sibling keywords are\n\t/// processed when resolving references using the \"$ref\" keyword.\n\tpublic static Dialect Draft202012 { get; } = new(\n\t\tAdditionalPropertiesKeyword.Instance,\n\t\tAllOfKeyword.Instance,\n\t\tAnchorKeyword.Instance,\n\t\tAnyOfKeyword.Instance,\n\t\tCommentKeyword.Instance,\n\t\tConstKeyword.Instance,\n\t\tContainsKeyword.Instance,\n\t\tContentEncodingKeyword.Instance,\n\t\tContentMediaTypeKeyword.Instance,\n\t\tContentSchemaKeyword.Instance,\n\t\tDefaultKeyword.Instance,\n\t\tDefsKeyword.Instance,\n\t\tDependentRequiredKeyword.Instance,\n\t\tDependentSchemasKeyword.Instance,\n\t\tDeprecatedKeyword.Instance,\n\t\tDescriptionKeyword.Instance,\n\t\tDynamicAnchorKeyword.Instance,\n\t\tKeywords.Draft202012.DynamicRefKeyword.Instance,\n\t\tElseKeyword.Instance,\n\t\tEnumKeyword.Instance,\n\t\tExamplesKeyword.Instance,\n\t\tExclusiveMaximumKeyword.Instance,\n\t\tExclusiveMinimumKeyword.Instance,\n\t\tKeywords.Draft06.FormatKeyword.Annotate,\n\t\tIdKeyword.Instance,\n\t\tIfKeyword.Instance,\n\t\tItemsKeyword.Instance,\n\t\tMaxContainsKeyword.Instance,\n\t\tMaximumKeyword.Instance,\n\t\tMaxItemsKeyword.Instance,\n\t\tMaxLengthKeyword.Instance,\n\t\tMaxPropertiesKeyword.Instance,\n\t\tMinContainsKeyword.Instance,\n\t\tMinimumKeyword.Instance,\n\t\tMinItemsKeyword.Instance,\n\t\tMinLengthKeyword.Instance,\n\t\tMinPropertiesKeyword.Instance,\n\t\tMultipleOfKeyword.Instance,\n\t\tNotKeyword.Instance,\n\t\tOneOfKeyword.Instance,\n\t\tPatternKeyword.Instance,\n\t\tPatternPropertiesKeyword.Instance,\n\t\tPrefixItemsKeyword.Instance,\n\t\tPropertiesKeyword.Instance,\n\t\tPropertyNamesKeyword.Instance,\n\t\tReadOnlyKeyword.Instance,\n\t\tRefKeyword.Instance,\n\t\tRequiredKeyword.Instance,\n\t\tSchemaKeyword.Instance,\n\t\tThenKeyword.Instance,\n\t\tTitleKeyword.Instance,\n\t\tTypeKeyword.Instance,\n\t\tUnevaluatedItemsKeyword.Instance,\n\t\tUnevaluatedPropertiesKeyword.Instance,\n\t\tUniqueItemsKeyword.Instance,\n\t\tKeywords.Draft201909.VocabularyKeyword.Instance,\n\t\tWriteOnlyKeyword.Instance\n\t)\n\t{\n\t\tId = MetaSchemas.Draft202012Id,\n\t\tAllowUnknownKeywords = true\n\t};\n}", + "snippet": "using Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\npublic partial class Dialect\n{\n\t/// \n\t/// Gets the JSON Schema dialect definition for Draft 2020-12.\n\t/// \n\t/// Use this property to evalua" + }, + { + "title": "src/JsonSchema/Dialect.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Dialect.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Dialect.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Reflection;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\n/// \n/// Represents a JSON Schema dialect, defining the set of supported keywords and validation rules for a specific schema\n/// version.\n/// \n/// A dialect encapsulates the behavior and interpretation of JSON Schema keywords according to a\n/// particular specification draft. Use a specific dialect instance, such as , to validate or\n/// process schemas that conform to that draft. Dialects may differ in supported keywords, validation semantics, and\n/// handling of unknown keywords. This class is typically used to select the appropriate schema version when working\n/// with JSON Schema documents.\n[DebuggerDisplay(\"{Id}\")]\npublic partial class Dialect\n{\n\t[DebuggerDisplay(\"{Name} / {Priority}\")]\n\tprivate class KeywordMetaData\n\t{\n\t\tpublic string Name { get; }\n\t\tpublic Type Type { get; }\n\t\tpublic IKeywordHandler Handler { get; }\n\t\t// ReSharper disable MemberHidesStaticFromOuterClass\n\t\tpublic long Priority { get; set; }\n\t\tpublic bool ProducesDependentAnnotations { get; set; }\n\t\t// ReSharper restore MemberHidesStaticFromOuterClass\n\n\t\tpublic KeywordMetaData(IKeywordHandler handler)\n\t\t{\n\t\t\tName = handler.Name;\n\t\t\tHandler = handler;\n\t\t\tType = handler.GetType();\n\t\t}\n\t}\n\n\tprivate readonly MultiLookupConcurrentDictionary _keywordData;\n\n\t/// \n\t/// Gets or sets the default JSON Schema dialect for new objects.\n\t/// \n\tpublic static Dialect Default { get; set; } = null!;\n\n\t/// \n\t/// Gets a value indicating whether references ignore sibling keywords during processing.\n\t/// \n\t/// Set this property to to ensure that references do not consider keywords\n\t/// defined by sibling elements. This can affect how references are resolved in scenarios where sibling keywords may\n\t/// otherwise influence behavior.\n\tpublic bool RefIgnoresSiblingKeywords { get; init; }\n\n\t/// \n\t/// Gets a value indicating whether unknown keywords are permitted during processing.\n\t/// \n\t/// Set this property to to allow keywords that are not explicitly recognized.\n\t/// This can be useful when working with extensible or user-defined keyword sets.\n\tpublic bool AllowUnknownKeywords { get; init; }\n\n\t/// \n\t/// Gets the unique identifier for the dialect.\n\t/// \n\tpublic Uri? Id { get; init; }\n\n\t/// \n\t/// Initializes a new instance of the Dialect class using the specified collection of keyword handlers.\n\t/// \n\t/// The provided keyword handlers are used to configure the dialect's keyword metadata and dependency\n\t/// evaluation. The constructor will throw an exception if any element in the collection is null.\n\t/// A collection of keyword handlers to be included in the dialect. Each handler defines the behavior and metadata for\n\t/// a specific keyword. Cannot be null.\n\tpublic Dialect(params IEnumerable keywords)\n\t{\n\t\t_keywordData = [];\n\t\t_keywordData.AddLookup(x => x.Name);\n\t\t_keywordData.AddLookup(x => x.Type);\n\t\tforeach (var keyword in keywords)\n\t\t{\n\t\t\tvar keywordData = new KeywordMetaData(keyword);\n\t\t\t_keywordData.Add(keywordData);\n\t\t}\n\t\tEvaluateDependencies();\n\t}\n\n\tinternal Dialect(IEnumerable vocabs)\n\t{\n\t\t_keywordData = [];\n\t\t_keywordData.AddLookup(x => x.Name);\n\t\t_keywordData.AddLookup(x => x.Type);\n\t\tforeach (var vocab in vocabs)\n\t\t{\n\t\t\tforeach (var keyword in vocab.Keywords)\n\t\t\t{\n\t\t\t\tvar metaData = new KeywordMetaData(keyword);\n\t\t\t\t_keywordData.Add(metaData);\n\t\t\t}\n\t\t}\n\t\tEvaluateDependencies();\n\t}\n\n\tinternal IKeywordHandler GetHandler(string keyword)\n\t{\n\t\tvar handler = _keywordData.GetValueOrDefault(keyword)?.Handler;\n\n\t\treturn handler ?? (AllowUnknownKeywords\n\t\t\t? AnnotationKeyword.Instance\n\t\t\t: throw new JsonSchemaException($\"Unknown keywords ({keyword}) are disallowed for this dialect.\"));\n\t}\n\n\tinternal bool ProducesDependentAnnotations(Type keywordType)\n\t{\n\t\tif (!_keywordData.TryGetValue(keywordType, out var metaData))\n\t\t\tthrow new ArgumentException($\"Keyword type `{keywordType}` not registered.\");\n\n\t\treturn metaData.ProducesDependentAnnotations;\n\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Reflection;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\n/// \n/// Represents a JSON Schema dialec" + }, + { + "title": "src/JsonSchema/Dialect.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Dialect.cs#L121-L191", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Dialect.cs", + "startLine": 121, + "endLine": 191, + "content": "private void EvaluateDependencies()\n\t{\n\t\tvar toCheck = _keywordData.Select(x => x.Value).Distinct().ToList();\n\n\t\tif (_keywordData.TryGetValue(\"$ref\", out var keyword) && RefIgnoresSiblingKeywords)\n\t\t{\n\t\t\tkeyword.Priority = -4;\n\t\t\ttoCheck.Remove(keyword);\n\t\t}\n\t\tif (_keywordData.TryGetValue(\"$schema\", out keyword))\n\t\t{\n\t\t\tkeyword.Priority = -3;\n\t\t\ttoCheck.Remove(keyword);\n\t\t}\n\t\tif (_keywordData.TryGetValue(\"$vocabulary\", out keyword))\n\t\t{\n\t\t\tkeyword.Priority = -2;\n\t\t\ttoCheck.Remove(keyword);\n\t\t}\n\t\tif (_keywordData.TryGetValue(\"$id\", out keyword))\n\t\t{\n\t\t\tkeyword.Priority = -1;\n\t\t\ttoCheck.Remove(keyword);\n\t\t}\n\t\tif (_keywordData.TryGetValue(\"unevaluatedItems\", out keyword))\n\t\t{\n\t\t\tkeyword.Priority = long.MaxValue;\n\t\t\ttoCheck.Remove(keyword);\n\t\t}\n\t\tif (_keywordData.TryGetValue(\"unevaluatedProperties\", out keyword))\n\t\t{\n\t\t\tkeyword.Priority = long.MaxValue;\n\t\t\ttoCheck.Remove(keyword);\n\t\t}\n\n\t\tvar priority = 0;\n\t\twhile (toCheck.Count != 0)\n\t\t{\n\t\t\tvar unprioritized = toCheck.Select(x => x.Type).ToArray();\n\t\t\tfor (var i = 0; i < toCheck.Count; i++)\n\t\t\t{\n\t\t\t\tkeyword = toCheck[i];\n\t\t\t\tvar dependencies = keyword.Type\n\t\t\t\t\t.GetCustomAttributes()\n\t\t\t\t\t.Select(x => x.DependentType)\n\t\t\t\t\t.ToArray();\n\t\t\t\tforeach (var dependency in dependencies)\n\t\t\t\t{\n\t\t\t\t\tvar metaData = _keywordData[dependency];\n\t\t\t\t\tmetaData.ProducesDependentAnnotations = true;\n\t\t\t\t}\n\n\t\t\t\tvar matches = dependencies.Intersect(unprioritized);\n\t\t\t\tif (matches.Any()) continue;\n\n\t\t\t\tkeyword.Priority = priority;\n\t\t\t\ttoCheck.Remove(keyword);\n\t\t\t\ti--;\n\t\t\t}\n\n\t\t\tpriority++;\n\t\t}\n\t}\n\n\tinternal long? GetEvaluationOrder(string keyword)\n\t{\n\t\treturn _keywordData.GetValueOrDefault(keyword)?.Priority;\n\t}\n\n\tinternal IEnumerable GetKeywords() => _keywordData.Select(x => x.Value.Handler).Distinct();\n}", + "snippet": "private void EvaluateDependencies()\n\t{\n\t\tvar toCheck = _keywordData.Select(x => x.Value).Distinct().ToList();\n\n\t\tif (_keywordData.TryGetValue(\"$ref\", out var keyword) && RefIgnoresSiblingKeywords)\n\t\t{\n\t\t\tkeyword.Priority" + }, + { + "title": "src/JsonSchema/Dialect.v1.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Dialect.v1.cs#L1-L84", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Dialect.v1.cs", + "startLine": 1, + "endLine": 84, + "content": "using Json.Schema.Keywords;\n// ReSharper disable UnusedMember.Global\n\nnamespace Json.Schema;\n\npublic partial class Dialect\n{\n\t/// \n\t/// Gets the JSON Schema dialect definition for v1/2026.\n\t/// \n\t/// Use this property to evaluate schemas that conform to the v1/2026 specification.\n\t/// The dialect includes all standard v1/2026 keywords and disallows unknown keywords. Sibling keywords are\n\t/// processed when resolving references using the \"$ref\" keyword.\n\tpublic static Dialect V1_2026 { get; } = new(\n\t\tAdditionalPropertiesKeyword.Instance,\n\t\tAllOfKeyword.Instance,\n\t\tAnchorKeyword.Instance,\n\t\tAnyOfKeyword.Instance,\n\t\tCommentKeyword.Instance,\n\t\tConstKeyword.Instance,\n\t\tContainsKeyword.Instance,\n\t\tContentEncodingKeyword.Instance,\n\t\tContentMediaTypeKeyword.Instance,\n\t\tContentSchemaKeyword.Instance,\n\t\tDefaultKeyword.Instance,\n\t\tDefsKeyword.Instance,\n\t\tDependentRequiredKeyword.Instance,\n\t\tDependentSchemasKeyword.Instance,\n\t\tDeprecatedKeyword.Instance,\n\t\tDescriptionKeyword.Instance,\n\t\tDynamicAnchorKeyword.Instance,\n\t\tDynamicRefKeyword.Instance,\n\t\tElseKeyword.Instance,\n\t\tEnumKeyword.Instance,\n\t\tExamplesKeyword.Instance,\n\t\tExclusiveMaximumKeyword.Instance,\n\t\tExclusiveMinimumKeyword.Instance,\n\t\tFormatKeyword.Instance,\n\t\tIdKeyword.Instance,\n\t\tIfKeyword.Instance,\n\t\tItemsKeyword.Instance,\n\t\tMaxContainsKeyword.Instance,\n\t\tMaximumKeyword.Instance,\n\t\tMaxItemsKeyword.Instance,\n\t\tMaxLengthKeyword.Instance,\n\t\tMaxPropertiesKeyword.Instance,\n\t\tMinContainsKeyword.Instance,\n\t\tMinimumKeyword.Instance,\n\t\tMinItemsKeyword.Instance,\n\t\tMinLengthKeyword.Instance,\n\t\tMinPropertiesKeyword.Instance,\n\t\tMultipleOfKeyword.Instance,\n\t\tNotKeyword.Instance,\n\t\tOneOfKeyword.Instance,\n\t\tPatternKeyword.Instance,\n\t\tPatternPropertiesKeyword.Instance,\n\t\tPrefixItemsKeyword.Instance,\n\t\tPropertiesKeyword.Instance,\n\t\t// PropertyDependenciesKeyword.Instance, // TODO: is proposal\n\t\tPropertyNamesKeyword.Instance,\n\t\tReadOnlyKeyword.Instance,\n\t\tRefKeyword.Instance,\n\t\tRequiredKeyword.Instance,\n\t\tSchemaKeyword.Instance,\n\t\tThenKeyword.Instance,\n\t\tTitleKeyword.Instance,\n\t\tTypeKeyword.Instance,\n\t\tUnevaluatedItemsKeyword.Instance,\n\t\tUnevaluatedPropertiesKeyword.Instance,\n\t\tUniqueItemsKeyword.Instance,\n\t\tWriteOnlyKeyword.Instance\n\t)\n\t{\n\t\tId = MetaSchemas.V1_2026Id\n\t};\n\n\t/// \n\t/// Gets the JSON Schema dialect definition for v1. This is the same as the latest yearly release in the v1 version.\n\t/// \n\t/// Use this property to evaluate schemas that conform to the v1-compatible specifications.\n\t/// The dialect includes all standard v1 keywords and disallows unknown keywords. Sibling keywords are\n\t/// processed when resolving references using the \"$ref\" keyword.\n\tpublic static Dialect V1 { get; } = V1_2026;\n}", + "snippet": "using Json.Schema.Keywords;\n// ReSharper disable UnusedMember.Global\n\nnamespace Json.Schema;\n\npublic partial class Dialect\n{\n\t/// \n\t/// Gets the JSON Schema dialect definition for v1/2026.\n\t/// \n\t/// <" + }, + { + "title": "src/JsonSchema/DialectExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/DialectExtensions.cs#L1-L68", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/DialectExtensions.cs", + "startLine": 1, + "endLine": 68, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema;\n\n/// \n/// Provides extension methods for creating modified instances of the type by adding or removing\n/// keyword handlers.\n/// \n/// These methods enable fluent customization of objects without altering the\n/// original instance. Use to add keyword handlers and to remove them,\n/// optionally overriding dialect properties such as Id, RefIgnoresSiblingKeywords, and\n/// AllowUnknownKeywords in the resulting instance.\npublic static class DialectExtensions\n{\n\t/// \n\t/// Creates a new Dialect instance by extending the specified dialect with additional keyword handlers and optional\n\t/// configuration overrides.\n\t/// \n\t/// This method is useful for creating customized dialects based on an existing one, allowing selective\n\t/// addition of keyword handlers and configuration overrides. The original dialect remains unchanged.\n\t/// The base Dialect to extend. Cannot be null.\n\t/// A collection of keyword handlers to add to the new Dialect. Cannot be null.\n\t/// An optional identifier for the new Dialect. If null, the identifier from the base dialect is used.\n\t/// An optional value indicating whether '$ref' keywords ignore sibling keywords. If null, the value from the base\n\t/// dialect is used.\n\t/// An optional value indicating whether unknown keywords are allowed. If null, the value from the base dialect is\n\t/// used.\n\t/// A new Dialect instance containing the combined keyword handlers and configuration settings.\n\tpublic static Dialect With(this Dialect dialect,\n\t\tIEnumerable add,\n\t\tUri? id = null,\n\t\tbool? refIgnoresSiblingKeywords = null,\n\t\tbool? allowUnknownKeywords = null) =>\n\t\tnew(dialect.GetKeywords().Concat(add))\n\t\t{\n\t\t\tId = id,\n\t\t\tRefIgnoresSiblingKeywords = refIgnoresSiblingKeywords ?? dialect.RefIgnoresSiblingKeywords,\n\t\t\tAllowUnknownKeywords = allowUnknownKeywords ?? dialect.AllowUnknownKeywords\n\t\t};\n\n\t/// \n\t/// Creates a new Dialect instance by removing the specified keyword handlers from the given dialect.\n\t/// \n\t/// The returned Dialect retains all configuration options from the source dialect unless overridden by\n\t/// the optional parameters. This method does not modify the original Dialect instance.\n\t/// The source Dialect from which keyword handlers will be removed.\n\t/// A collection of keyword handlers to exclude from the resulting Dialect. Each handler in this collection will be\n\t/// omitted.\n\t/// An optional identifier to assign to the new Dialect. If null, the identifier from the source dialect is not set.\n\t/// An optional value indicating whether '$ref' should ignore sibling keywords in the new Dialect. If null, the value\n\t/// from the source dialect is used.\n\t/// An optional value indicating whether unknown keywords are allowed in the new Dialect. If null, the value from the\n\t/// source dialect is used.\n\t/// A new Dialect instance with the specified keyword handlers removed and updated configuration options as provided.\n\tpublic static Dialect Without(this Dialect dialect,\n\t\tIEnumerable remove,\n\t\tUri? id = null,\n\t\tbool? refIgnoresSiblingKeywords = null,\n\t\tbool? allowUnknownKeywords = null) =>\n\t\tnew(dialect.GetKeywords().Except(remove))\n\t\t{\n\t\t\tId = id,\n\t\t\tRefIgnoresSiblingKeywords = refIgnoresSiblingKeywords ?? dialect.RefIgnoresSiblingKeywords,\n\t\t\tAllowUnknownKeywords = allowUnknownKeywords ?? dialect.AllowUnknownKeywords\n\t\t};\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema;\n\n/// \n/// Provides extension methods for creating modified instances of the type by adding or remo" + }, + { + "title": "src/JsonSchema/DialectRegistry.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/DialectRegistry.cs#L1-L114", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/DialectRegistry.cs", + "startLine": 1, + "endLine": 114, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Json.Schema.Keywords.Draft201909;\n\nnamespace Json.Schema;\n\n/// \n/// Provides a registry for managing and retrieving JSON Schema dialects by their unique identifiers.\n/// \n/// The registry allows registration and unregistration of custom dialects. A global singleton instance is available via the property for application-wide access. Getting dialects via\n/// local instances fall back to the global registry.\npublic class DialectRegistry\n{\n\tprivate readonly Dictionary _dialects = new();\n\tprivate Uri[] _wellKnownDialects = null!;\n\n\t/// \n\t/// Gets the global registry of JSON Schema dialects used throughout the application.\n\t/// \n\t/// Use this property to access or configure JSON Schema dialects that should be available application-wide.\n\t/// Changes to the global registry affect all components that rely on shared dialect definitions.\n\tpublic static DialectRegistry Global { get; } = new();\n\n\t/// \n\t/// Registers a custom dialect for use in the system.\n\t/// \n\t/// Registering a dialect allows it to be used in subsequent operations. Official dialects cannot be\n\t/// overwritten or replaced.\n\t/// The dialect to register. The dialect must have a non-null identifier and must not conflict with any official\n\t/// dialects.\n\t/// Thrown if has a null Id, or if the dialect's identifier matches an official\n\t/// dialect.\n\tpublic void Register(Dialect dialect)\n\t{\n\t\tif (dialect.Id is null)\n\t\t\tthrow new ArgumentException(\"Cannot register a dialect without an ID\");\n\n\t\tif (_wellKnownDialects.Contains(dialect.Id))\n\t\t\tthrow new ArgumentException(\"Cannot overwrite official dialects\");\n\n\t\t_dialects[dialect.Id] = dialect;\n\t}\n\n\t/// \n\t/// Unregisters a dialect identified by the specified URI, removing it from the collection of available dialects.\n\t/// \n\t/// The URI that uniquely identifies the dialect to unregister. Cannot be an official dialect.\n\t/// Thrown if refers to an official dialect, which cannot be removed.\n\tpublic void Unregister(Uri dialectId)\n\t{\n\t\tif (_wellKnownDialects.Contains(dialectId))\n\t\t\tthrow new ArgumentException(\"Cannot remove official dialects\");\n\n\t\t_dialects.Remove(dialectId);\n\t}\n\n\tinternal Dialect Get(Uri uri, SchemaRegistry schemaRegistry, VocabularyRegistry vocabularyRegistry, Dialect basis)\n\t{\n\t\tvar dialect = _dialects.GetValueOrDefault(uri) ??\n\t\t\tGlobal._dialects.GetValueOrDefault(uri);\n\t\tif (dialect is not null) return dialect;\n\n\t\tvar document = schemaRegistry.Get(uri);\n\t\tif (document is not JsonSchema schema)\n\t\t\tthrow new JsonSchemaException($\"Cannot find dialect with ID '{uri}'. \" +\n\t\t\t $\"If the meta-schema is based on Draft 2019-09 or Draft 2020-12 and carries a $vocabulary keyword, \" +\n\t\t\t $\"simply add the meta-schema to the schema registry. \" +\n\t\t\t $\"Otherwise, explicitly register the dialect.\");\n\n\t\tvar vocabKeyword = schema.Root.Keywords?.FirstOrDefault(x => x.Handler is VocabularyKeyword);\n\t\tif (vocabKeyword is null)\n\t\t\tthrow new JsonSchemaException($\"Cannot automatically determine keywords for dialect with ID '{uri}'. \" +\n\t\t\t $\"Register it explicitly.\");\n\n\t\tvar keywords = new List();\n\t\tforeach (var vocabEntry in vocabKeyword.RawValue.EnumerateObject())\n\t\t{\n\t\t\tvar vocab = vocabularyRegistry.GetVocab(new Uri(vocabEntry.Name));\n\t\t\tif (vocab is null)\n\t\t\t{\n\t\t\t\tif (vocabEntry.Value.GetBoolean())\n\t\t\t\t\tthrow new JsonSchemaException($\"Vocabulary with ID '{vocabEntry.Name}' is required but not known.\");\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tkeywords.AddRange(vocab.Keywords);\n\t\t}\n\n\t\tdialect = new Dialect(keywords)\n\t\t{\n\t\t\tId = uri,\n\t\t\tAllowUnknownKeywords = basis.AllowUnknownKeywords,\n\t\t\tRefIgnoresSiblingKeywords = basis.RefIgnoresSiblingKeywords\n\t\t};\n\t\t_dialects[uri] = dialect;\n\n\t\treturn dialect;\n\t}\n\n\tinternal void RegisterDefaultDialects()\n\t{\n\t\t_dialects[MetaSchemas.Draft6Id] = Dialect.Draft06;\n\t\t_dialects[MetaSchemas.Draft7Id] = Dialect.Draft07;\n\t\t_dialects[MetaSchemas.Draft201909Id] = Dialect.Draft201909;\n\t\t_dialects[MetaSchemas.Draft202012Id] = Dialect.Draft202012;\n\t\t_dialects[MetaSchemas.V1_2026Id] = Dialect.V1_2026;\n\n\t\t_dialects[MetaSchemas.V1Id] = Dialect.V1;\n\n\t\t_wellKnownDialects = _dialects.Keys.ToArray();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Json.Schema.Keywords.Draft201909;\n\nnamespace Json.Schema;\n\n/// \n/// Provides a registry for managing and retrieving JSON Schema dialects b" + }, + { + "title": "src/JsonSchema/DotnetCompatibility.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/DotnetCompatibility.cs#L1-L70", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/DotnetCompatibility.cs", + "startLine": 1, + "endLine": 70, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema;\n\n/// \n/// Provides compatibility extension methods that replicate .NET API behaviors on earlier framework versions.\n/// \n/// This class contains static extension methods that offer functionality introduced in later .NET\n/// versions, enabling codebases to use newer APIs when targeting older frameworks. Methods are conditionally included\n/// based on the target framework version and are intended to ease cross-version development and migration.\npublic static class DotnetCompatibility\n{\n#if !NET8_0_OR_GREATER\n\n\t/// \n\t/// Retrieves the value associated with the specified key from the dictionary, or the default value for the type if the\n\t/// key is not found.\n\t/// \n\t/// This method provides a convenient way to retrieve a value from a dictionary without throwing an\n\t/// exception if the key does not exist. If is null, a will be thrown.\n\t/// The type of keys in the dictionary.\n\t/// The type of values in the dictionary.\n\t/// The read-only dictionary to search for the specified key. Cannot be null.\n\t/// The key whose value to retrieve.\n\t/// The value associated with the specified key if the key is found; otherwise, the default value for the type\n\t/// .\n\tpublic static TValue? GetValueOrDefault(this IReadOnlyDictionary dictionary, TKey key)\n\t{\n\t\treturn dictionary.TryGetValue(key, out var value) ? value : default;\n\t}\n\n\t/// \n\t/// Attempts to add the specified key and value to the dictionary if the key does not already exist.\n\t/// \n\t/// This method does not overwrite an existing value if the key is already present in the dictionary.\n\t/// If the key exists, the method returns false and does not modify the dictionary.\n\t/// The type of keys in the dictionary.\n\t/// The type of values in the dictionary.\n\t/// The dictionary to which the key and value will be added. Cannot be null.\n\t/// The key to add to the dictionary. Cannot be null if the dictionary implementation does not allow null keys.\n\t/// The value to associate with the specified key.\n\t/// true if the key and value were added to the dictionary; otherwise, false.\n\tpublic static bool TryAdd(this IDictionary dictionary, TKey key, TValue value)\n\t{\n\t\tif (dictionary.ContainsKey(key)) return false;\n\n\t\tdictionary.Add(key, value);\n\t\treturn true;\n\t}\n\n#endif\n\n#if !NET9_0_OR_GREATER\n\n\t/// \n\t/// Returns the number of properties contained in the specified JSON object.\n\t/// \n\t/// If does not represent a JSON object, the result will be 0. This method\n\t/// does not count properties in nested objects.\n\t/// The to count properties for. Must represent a JSON object.\n\t/// The number of properties in the JSON object. Returns 0 if the object contains no properties.\n\tpublic static int GetPropertyCount(this JsonElement element) => element.EnumerateObject().Count();\n\n#endif\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema;\n\n/// \n/// Provides compatibility extension methods that replicate .NET API behaviors on earlier " + }, + { + "title": "src/JsonSchema/Duration.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Duration.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Duration.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\n\nnamespace Json.Schema;\n\n/// \n/// Represents an ISO 8601 ABNF duration value.\n/// \npublic readonly struct Duration\n{\n\t/// \n\t/// The number of years.\n\t/// \n\tpublic uint Years { get; }\n\t/// \n\t/// The number of months.\n\t/// \n\tpublic uint Months { get; }\n\t/// \n\t/// The number of weeks. Incompatible with , , and .\n\t/// \n\tpublic uint Weeks { get; }\n\t/// \n\t/// The number of days.\n\t/// \n\tpublic uint Days { get; }\n\t/// \n\t/// The number of hours.\n\t/// \n\tpublic uint Hours { get; }\n\t/// \n\t/// The number of minutes.\n\t/// \n\tpublic uint Minutes { get; }\n\t/// \n\t/// The number of seconds.\n\t/// \n\tpublic uint Seconds { get; }\n\n\tprivate Duration(uint years, uint months, uint weeks, uint days, uint hours, uint minutes, uint seconds)\n\t{\n\t\tYears = years;\n\t\tMonths = months;\n\t\tWeeks = weeks;\n\t\tDays = days;\n\t\tHours = hours;\n\t\tMinutes = minutes;\n\t\tSeconds = seconds;\n\t}\n\n\t/// \n\t/// Parses a from a string.\n\t/// \n\t/// The source string.\n\t/// A duration.\n\t/// does not contains a valid duration string.\n\tpublic static Duration Parse(string source)\n\t{\n\t\tif (TryParse(source, out var duration)) return duration;\n\n\t\tthrow new ArgumentException(\"Source string does not contain a valid duration\", nameof(source));\n\t}\n\n\t/// \n\t/// Parses a from a string.\n\t/// \n\t/// The source string.\n\t/// The resulting duration.\n\t/// `true` if the parse was successful; `false` otherwise.\n\tpublic static bool TryParse(string source, out Duration duration)\n\t{\n\t\tduration = default;\n\t\tif (string.IsNullOrWhiteSpace(source)) return false;\n\t\tif (source != source.Trim()) return false;\n\n\t\t// ReSharper disable once InlineOutVariableDeclaration\n\t\tuint year = 0, month = 0, week, day = 0, hour = 0, minute = 0, second = 0;\n\t\tvar index = 0;\n\t\tif (!Require(source, ref index, 'P')) return false;\n\t\tvar gotDaily = TryGetComponent(source, ref index, out week, 'W');\n\t\tif (!gotDaily)\n\t\t{\n\t\t\tvar gotYear = TryGetComponent(source, ref index, out year, 'Y');\n\t\t\tvar gotMonth = TryGetComponent(source, ref index, out month, 'M');\n\t\t\tvar gotDay = TryGetComponent(source, ref index, out day, 'D');\n\n\t\t\tgotDaily = gotYear || gotMonth || gotDay;\n\t\t\tif (!gotMonth && gotYear && gotDay) return false;\n\t\t}\n\n\t\tif (!Require(source, ref index, 'T'))\n\t\t{\n\t\t\tif (!gotDaily) return false;\n\t\t\tif (index != source.Length) return false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar gotHour = TryGetComponent(source, ref index, out hour, 'H');\n\t\t\tvar gotMinute = TryGetComponent(source, ref index, out minute, 'M');\n\t\t\tvar gotSecond = TryGetComponent(source, ref index, out second, 'S');\n\t\t\tvar gotTime = gotHour || gotMinute || gotSecond;\n\n\t\t\tif (!gotTime) return false;\n\t\t\tif (!gotMinute && gotHour && gotSecond) return false;\n\t\t\tif (index != source.Length) return false;\n\t\t}\n\n\t\tduration = new Duration(year, month, week, day, hour, minute, second);\n\t\treturn true;\n\t}\n\n\tprivate static bool Require(string source, ref int index, char ch)\n\t{\n\t\tif (index < source.Length && source[index] == ch)\n\t\t{\n\t\t\tindex++;\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", + "snippet": "using System;\n\nnamespace Json.Schema;\n\n/// \n/// Represents an ISO 8601 ABNF duration value.\n/// \npublic readonly struct Duration\n{\n\t/// \n\t/// The number of years.\n\t/// \n\tpublic uint " + }, + { + "title": "src/JsonSchema/Duration.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Duration.cs#L121-L141", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Duration.cs", + "startLine": 121, + "endLine": 141, + "content": "private static bool TryGetComponent(string source, ref int index, out uint number, char ch)\n\t{\n\t\tnumber = 0;\n\t\tvar tempIndex = index;\n\t\twhile (tempIndex < source.Length && '0' <= source[tempIndex] && source[tempIndex] <= '9')\n\t\t{\n\t\t\tnumber = number * 10 + (uint)(source[tempIndex] - '0');\n\t\t\ttempIndex++;\n\t\t}\n\n\t\tif (tempIndex < source.Length && source[tempIndex] == ch)\n\t\t{\n\t\t\tindex = tempIndex + 1;\n\t\t\treturn true;\n\t\t}\n\n\t\tnumber = 0;\n\t\treturn false;\n\t}\n}", + "snippet": "private static bool TryGetComponent(string source, ref int index, out uint number, char ch)\n\t{\n\t\tnumber = 0;\n\t\tvar tempIndex = index;\n\t\twhile (tempIndex < source.Length && '0' <= source[tempIndex] && source[tempIndex] <=" + }, + { + "title": "src/JsonSchema/DynamicScope.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/DynamicScope.cs#L1-L86", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/DynamicScope.cs", + "startLine": 1, + "endLine": 86, + "content": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema;\n\n/// \n/// Tracks the dynamic scope during schema evaluation.\n/// \n/// \n/// Dynamic scope is the collection of URIs (defined by `$id`) represented by the evaluation path.\n/// \npublic class DynamicScope : IEnumerable, IEquatable\n{\n\tprivate readonly Stack _scope;\n\n\t/// \n\t/// Gets the local scope, or the most recent schema URI encountered.\n\t/// \n\tpublic Uri LocalScope => _scope.Count == 0 ? null! : _scope.Peek();\n\n\t/// \n\t/// Gets the number of elements contained in the scope.\n\t/// \n\tpublic int Count => _scope.Count;\n\n\tinternal DynamicScope(Uri initialScope)\n\t{\n\t\t_scope = new Stack();\n\t\t_scope.Push(initialScope);\n\t}\n\n\tinternal DynamicScope(DynamicScope other)\n\t{\n\t\t_scope = new Stack(other.Reverse());\n\t}\n\n\tinternal void Push(Uri newLocal)\n\t{\n\t\t_scope.Push(newLocal);\n\t}\n\n\tinternal void Pop()\n\t{\n\t\t_scope.Pop();\n\t}\n\n\t/// Returns an enumerator that iterates through the collection.\n\t/// An enumerator that can be used to iterate through the collection.\n\tpublic IEnumerator GetEnumerator()\n\t{\n\t\treturn ((IEnumerable)_scope).GetEnumerator();\n\t}\n\n\tIEnumerator IEnumerable.GetEnumerator()\n\t{\n\t\treturn GetEnumerator();\n\t}\n\n\t/// Indicates whether the current object is equal to another object of the same type.\n\t/// An object to compare with this object.\n\t/// true if the current object is equal to the other parameter; otherwise, false.\n\tpublic bool Equals(DynamicScope? other)\n\t{\n\t\tif (ReferenceEquals(null, other)) return false;\n\t\tif (ReferenceEquals(this, other)) return true;\n\n\t\treturn _scope.SequenceEqual(other._scope);\n\t}\n\n\t/// Determines whether the specified object is equal to the current object.\n\t/// The object to compare with the current object.\n\t/// true if the specified object is equal to the current object; otherwise, false.\n\tpublic override bool Equals(object? obj)\n\t{\n\t\treturn Equals(obj as DynamicScope);\n\t}\n\n\t/// Serves as the default hash function.\n\t/// A hash code for the current object.\n\tpublic override int GetHashCode()\n\t{\n\t\treturn _scope.GetHashCode();\n\t}\n}", + "snippet": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema;\n\n/// \n/// Tracks the dynamic scope during schema evaluation.\n/// \n/// \n/// " + }, + { + "title": "src/JsonSchema/ErrorMessages.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/ErrorMessages.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/ErrorMessages.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.Resources;\nusing System.Runtime.CompilerServices;\nusing System.Text.Json;\nusing System.Text.Json.Serialization.Metadata;\n\nnamespace Json.Schema;\n\n/// \n/// Manages error messages returned by built-in keywords.\n/// \n/// \n/// Default messages are provided by culture-specific resource files.\n///\n/// Many messages support tokens in the format `[[foo]]`.\n/// Each message will specify the tokens it supports.\n/// \npublic static partial class ErrorMessages\n{\n private static readonly ResourceManager _resourceManager = new(\"Json.Schema.Localization.Resources\", typeof(ErrorMessages).Assembly);\n\n /// \n /// Gets or sets a culture to use for error messages. Default is .\n /// \n public static CultureInfo? Culture { get; set; }\n\n static ErrorMessages()\n {\n }\n\n\t/// \n\t/// Retrieves a localized error message string for the specified key and culture.\n\t/// \n\t/// If the parameter begins with \"Get\", that prefix is removed before looking up\n\t/// the resource. This method is typically used within error-handling code to retrieve user-facing error messages based\n\t/// on the calling member.\n\t/// The culture to use when retrieving the error message. If null, the default culture or the current thread's culture\n\t/// is used.\n\t/// The resource key identifying the error message to retrieve. If not specified, the caller's member name is used.\n\t/// A localized error message string corresponding to the specified key and culture.\n\t/// Thrown if is null.\n\t/// Thrown if an error message resource with the specified key cannot be found.\n public static string Get(CultureInfo? culture = null, [CallerMemberName] string? key = null)\n {\n if (key == null) throw new ArgumentNullException(nameof(key), \"Cannot get a null-keyed resource\");\n\n if (key.StartsWith(\"Get\"))\n key = key[3..];\n\n return _resourceManager.GetString($\"Error_{key}\", culture ?? Culture ?? CultureInfo.CurrentCulture) ??\n throw new KeyNotFoundException($\"Could not find error message with key '{key}'\");\n }\n\n\t/// \n\t/// Replaces tokens in the form of `[[token]]` with a specified value, serialized as JSON.\n\t/// \n\t/// The message template.\n\t/// The token name (without brackets)\n\t/// The value.\n\t/// The detokenized string.\n\t[RequiresDynamicCode(\"Calls JsonSerializer.Serialize and might require reflection for token values serialization. Prefer ReplaceToken that takes TypeInfo parameters for AOT scenarios.\")]\n\t[RequiresUnreferencedCode(\"Calls JsonSerializer.Serialize and might require reflection for token values serialization. Prefer ReplaceToken that takes TypeInfo parameters for AOT scenarios.\")]\n\tpublic static string ReplaceToken(this string message, string name, object? value)\n {\n\t\tvar stringValue = JsonSerializer.Serialize(value);\n\t\treturn message.Replace($\"[[{name}]]\", stringValue);\n\t}\n\n\t/// \n\t/// Replaces tokens in the form of `[[token]]` with a specified value, serialized as JSON.\n\t/// \n\t/// The message template.\n\t/// The token name (without brackets)\n\t/// The value.\n\t/// A JsonTypeInfo that matches .\n\t/// The detokenized string.\n\tpublic static string ReplaceToken(this string message, string name, T? value, JsonTypeInfo typeInfo)\n\t{\n\t\tvar stringValue = JsonSerializer.Serialize(value, typeInfo!);\n\t\treturn message.Replace($\"[[{name}]]\", stringValue);\n\t}\n\n\t/// \n\t/// Replaces tokens in the form of `[[token]]` with a specified value, serialized as JSON.\n\t/// \n\t/// The message template.\n\t/// The token name (without brackets)\n\t/// The value.\n\t/// The detokenized string.\n\tpublic static string ReplaceToken(this string message, string name, bool value) => \n\t\tReplaceToken(message, name, value, JsonSchemaSerializerContext.Default.Boolean);\n\n\t/// \n\t/// Replaces tokens in the form of `[[token]]` with a specified value, serialized as JSON.\n\t/// \n\t/// The message template.\n\t/// The token name (without brackets)\n\t/// The value.\n\t/// The detokenized string.\n\tpublic static string ReplaceToken(this string message, string name, int value) => \n\t\tReplaceToken(message, name, value, JsonSchemaSerializerContext.Default.Int32);\n\n\t/// \n\t/// Replaces tokens in the form of `[[token]]` with a specified value, serialized as JSON.\n\t/// \n\t/// The message template.\n\t/// The token name (without brackets)\n\t/// The value.\n\t/// The detokenized string.\n\tpublic static string ReplaceToken(this string message, string name, long value) =>\n\t\tReplaceToken(message, name, value, JsonSchemaSerializerContext.Default.Int64);\n\n\t/// \n\t/// Replaces tokens in the form of `[[token]]` with a specified value, serialized as JSON.\n\t/// \n\t/// The message template.\n\t/// The token name (without brackets)", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.Resources;\nusing System.Runtime.CompilerServices;\nusing System.Text.Json;\nusing System.Text." + }, + { + "title": "src/JsonSchema/ErrorMessages.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/ErrorMessages.cs#L121-L176", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/ErrorMessages.cs", + "startLine": 121, + "endLine": 176, + "content": "/// The value.\n\t/// The detokenized string.\n\tpublic static string ReplaceToken(this string message, string name, decimal value) => \n\t\tReplaceToken(message, name, value, JsonSchemaSerializerContext.Default.Decimal);\n\n\t/// \n\t/// Replaces tokens in the form of `[[token]]` with a specified value, serialized as JSON.\n\t/// \n\t/// The message template.\n\t/// The token name (without brackets)\n\t/// The value.\n\t/// The detokenized string.\n\tpublic static string ReplaceToken(this string message, string name, double value) => \n\t\tReplaceToken(message, name, value, JsonSchemaSerializerContext.Default.Double);\n\n\t/// \n\t/// Replaces tokens in the form of `[[token]]` with a specified value, serialized as JSON.\n\t/// \n\t/// The message template.\n\t/// The token name (without brackets)\n\t/// The value.\n\t/// The detokenized string.\n\tpublic static string ReplaceToken(this string message, string name, string value) => \n\t\tReplaceToken(message, name, value, JsonSchemaSerializerContext.Default.String);\n\n\t/// \n\t/// Replaces tokens in the form of `[[token]]` with a specified value, serialized as JSON.\n\t/// \n\t/// The message template.\n\t/// The token name (without brackets)\n\t/// The value.\n\t/// The detokenized string.\n\tpublic static string ReplaceToken(this string message, string name, string[] value) =>\n\t\tReplaceToken(message, name, value, JsonSchemaSerializerContext.Default.StringArray);\n\n\t/// \n\t/// Replaces tokens in the form of `[[token]]` with a specified value, serialized as JSON.\n\t/// \n\t/// The message template.\n\t/// The token name (without brackets)\n\t/// The value.\n\t/// The detokenized string.\n\tpublic static string ReplaceToken(this string message, string name, Dictionary value) =>\n\t\tReplaceToken(message, name, value, JsonSchemaSerializerContext.Default.DictionaryStringStringArray);\n\n\t/// \n\t/// Replaces tokens in the form of `[[token]]` with a specified value, serialized as JSON.\n\t/// \n\t/// The message template.\n\t/// The token name (without brackets)\n\t/// The value.\n\t/// The detokenized string.\n\tpublic static string ReplaceToken(this string message, string name, JsonElement value) =>\n\t\tReplaceToken(message, name, value, JsonSchemaSerializerContext.Default.JsonElement);\n}", + "snippet": "/// The value.\n\t/// The detokenized string.\n\tpublic static string ReplaceToken(this string message, string name, decimal value) => \n\t\tReplaceToken(message, name, value, Json" + }, + { + "title": "src/JsonSchema/ErrorMessages.Keywords.cs (1/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/ErrorMessages.Keywords.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/ErrorMessages.Keywords.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Globalization;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\npublic static partial class ErrorMessages\n{\n\t/// \n\t/// Gets or sets the error message for the \"false\" schema.\n\t/// \n\t/// No tokens are supported.\n\tpublic static string FalseSchema\n\t{\n\t\tget => field ?? Get();\n\t\tset;\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[value]] - the value in the schema\n\t/// \n\tpublic static string? Const { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[value]] - the value in the schema\n\t/// \n\tpublic static string GetConst(CultureInfo? culture)\n\t{\n\t\treturn Const ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for when there are too few matching items.\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the number of matching items provided in the JSON instance\n\t/// - [[minimum]] - the lower limit specified in the schema\n\t/// \n\tpublic static string? ContainsTooFew { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the number of matching items provided in the JSON instance\n\t/// - [[minimum]] - the lower limit specified in the schema\n\t/// \n\tpublic static string GetContainsTooFew(CultureInfo? culture)\n\t{\n\t\treturn ContainsTooFew ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for when there are too many matching items.\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the number of matching items provided in the JSON instance\n\t/// - [[maximum]] - the upper limit specified in the schema\n\t/// \n\tpublic static string? ContainsTooMany { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the number of matching items provided in the JSON instance\n\t/// - [[maximum]] - the upper limit specified in the schema\n\t/// \n\tpublic static string GetContainsTooMany(CultureInfo? culture)\n\t{\n\t\treturn ContainsTooMany ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[missing]] - the value in the schema\n\t/// \n\tpublic static string? DependentRequired { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[missing]] - the value in the schema\n\t/// \n\tpublic static string GetDependentRequired(CultureInfo? culture)\n\t{\n\t\treturn DependentRequired ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[value]] - the value in the schema\n\t/// \n\tpublic static string? DependentSchemas { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.", + "snippet": "using System.Globalization;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\npublic static partial class ErrorMessages\n{\n\t/// \n\t/// Gets or sets the error message for the \"false\" schema.\n\t/// \n\t///" + }, + { + "title": "src/JsonSchema/ErrorMessages.Keywords.cs (2/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/ErrorMessages.Keywords.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/ErrorMessages.Keywords.cs", + "startLine": 121, + "endLine": 240, + "content": "/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[value]] - the value in the schema\n\t/// \n\tpublic static string GetDependentSchemas(CultureInfo? culture)\n\t{\n\t\treturn DependentSchemas ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the value provided in the JSON instance\n\t/// - [[values]] - the available values in the schema\n\t///\n\t/// The default messages are static and do not use these tokens as enum values\n\t/// may be any JSON type and could be quite large. They are provided to support\n\t/// custom messages.\n\t/// \n\tpublic static string? Enum { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the value provided in the JSON instance\n\t/// - [[values]] - the available values in the schema\n\t///\n\t/// The default messages are static and do not use these tokens as enum values\n\t/// may be any JSON type and could be quite large. They are provided to support\n\t/// custom messages.\n\t/// \n\tpublic static string GetEnum(CultureInfo? culture)\n\t{\n\t\treturn Enum ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the value provided in the JSON instance\n\t/// - [[limit]] - the upper limit in the schema\n\t/// \n\tpublic static string? ExclusiveMaximum { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the value provided in the JSON instance\n\t/// - [[limit]] - the upper limit in the schema\n\t/// \n\tpublic static string GetExclusiveMaximum(CultureInfo? culture)\n\t{\n\t\treturn ExclusiveMaximum ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the value provided in the JSON instance\n\t/// - [[limit]] - the lower limit in the schema\n\t/// \n\tpublic static string? ExclusiveMinimum { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the value provided in the JSON instance\n\t/// - [[limit]] - the lower limit in the schema\n\t/// \n\tpublic static string GetExclusiveMinimum(CultureInfo? culture)\n\t{\n\t\treturn ExclusiveMinimum ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for an unknown format.\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[format]] - the format key\n\t/// \n\tpublic static string? UnknownFormat { get; set; }\n\n\t/// \n\t/// Gets the error message for an unknown format.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[format]] - the format key\n\t/// \n\tpublic static string GetUnknownFormat(CultureInfo? culture)\n\t{\n\t\treturn UnknownFormat ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for the .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[format]] - the format key\n\t/// ", + "snippet": "/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[value]] - the value in the schema\n\t/// \n\tpublic static string GetDependentSchemas(" + }, + { + "title": "src/JsonSchema/ErrorMessages.Keywords.cs (3/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/ErrorMessages.Keywords.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/ErrorMessages.Keywords.cs", + "startLine": 241, + "endLine": 360, + "content": "public static string? Format { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[format]] - the format key\n\t/// \n\tpublic static string GetFormat(CultureInfo? culture)\n\t{\n\t\treturn Format ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for the with\n\t/// additional information from the format validation.\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[format]] - the format key\n\t/// - [[detail]] - the detail\n\t/// \n\tpublic static string? FormatWithDetail { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[format]] - the format key\n\t/// - [[detail]] - the detail\n\t/// \n\tpublic static string GetFormatWithDetail(CultureInfo? culture)\n\t{\n\t\treturn FormatWithDetail ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the value provided in the JSON instance\n\t/// - [[limit]] - the upper limit in the schema\n\t/// \n\tpublic static string? Maximum { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the value provided in the JSON instance\n\t/// - [[limit]] - the upper limit in the schema\n\t/// \n\tpublic static string GetMaximum(CultureInfo? culture)\n\t{\n\t\treturn Maximum ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the number of items provided in the JSON instance\n\t/// - [[limit]] - the upper limit specified in the schema\n\t/// \n\tpublic static string? MaxItems { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the number of items provided in the JSON instance\n\t/// - [[limit]] - the upper limit specified in the schema\n\t/// \n\tpublic static string GetMaxItems(CultureInfo? culture)\n\t{\n\t\treturn MaxItems ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the length of the JSON string\n\t/// - [[limit]] - the upper limit specified in the schema\n\t/// \n\tpublic static string? MaxLength { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the length of the JSON string\n\t/// - [[limit]] - the upper limit specified in the schema\n\t/// \n\tpublic static string GetMaxLength(CultureInfo? culture)\n\t{\n\t\treturn MaxLength ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the number of properties provided in the JSON instance\n\t/// - [[limit]] - the upper limit specified in the schema\n\t/// ", + "snippet": "public static string? Format { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t" + }, + { + "title": "src/JsonSchema/ErrorMessages.Keywords.cs (4/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/ErrorMessages.Keywords.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/ErrorMessages.Keywords.cs", + "startLine": 361, + "endLine": 480, + "content": "public static string? MaxProperties { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the number of properties provided in the JSON instance\n\t/// - [[limit]] - the upper limit specified in the schema\n\t/// \n\tpublic static string GetMaxProperties(CultureInfo? culture)\n\t{\n\t\treturn MaxProperties ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the value provided in the JSON instance\n\t/// - [[limit]] - the lower limit in the schema\n\t/// \n\tpublic static string? Minimum { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the value provided in the JSON instance\n\t/// - [[limit]] - the lower limit in the schema\n\t/// \n\tpublic static string GetMinimum(CultureInfo? culture)\n\t{\n\t\treturn Minimum ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the number of items provided in the JSON instance\n\t/// - [[limit]] - the lower limit specified in the schema\n\t/// \n\tpublic static string? MinItems { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the number of items provided in the JSON instance\n\t/// - [[limit]] - the lower limit specified in the schema\n\t/// \n\tpublic static string GetMinItems(CultureInfo? culture)\n\t{\n\t\treturn MinItems ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the length of the JSON string\n\t/// - [[limit]] - the lower limit specified in the schema\n\t/// \n\tpublic static string? MinLength { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the length of the JSON string\n\t/// - [[limit]] - the lower limit specified in the schema\n\t/// \n\tpublic static string GetMinLength(CultureInfo? culture)\n\t{\n\t\treturn MinLength ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the number of properties provided in the JSON instance\n\t/// - [[limit]] - the lower limit specified in the schema\n\t/// \n\tpublic static string? MinProperties { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the number of properties provided in the JSON instance\n\t/// - [[limit]] - the lower limit specified in the schema\n\t/// \n\tpublic static string GetMinProperties(CultureInfo? culture)\n\t{\n\t\treturn MinProperties ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the value provided in the JSON instance\n\t/// - [[divisor]] - the required divisor\n\t/// ", + "snippet": "public static string? MaxProperties { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retri" + }, + { + "title": "src/JsonSchema/ErrorMessages.Keywords.cs (5/6)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/ErrorMessages.Keywords.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/ErrorMessages.Keywords.cs", + "startLine": 481, + "endLine": 600, + "content": "public static string? MultipleOf { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the value provided in the JSON instance\n\t/// - [[divisor]] - the required divisor\n\t/// \n\tpublic static string GetMultipleOf(CultureInfo? culture)\n\t{\n\t\treturn MultipleOf ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[count]] - the number of subschemas that passed validation\n\t/// \n\tpublic static string? OneOf { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[count]] - the number of subschemas that passed validation\n\t/// \n\tpublic static string GetOneOf(CultureInfo? culture)\n\t{\n\t\treturn OneOf ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[pattern]] - the regular expression\n\t/// \n\tpublic static string? Pattern { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[pattern]] - the regular expression\n\t/// \n\tpublic static string GetPattern(CultureInfo? culture)\n\t{\n\t\treturn Pattern ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[missing]] - the properties missing from the JSON instance\n\t/// \n\tpublic static string? Required { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[missing]] - the properties missing from the JSON instance\n\t/// \n\tpublic static string GetRequired(CultureInfo? culture)\n\t{\n\t\treturn Required ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for when the schema cannot be validated\n\t/// against the meta-schema.\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[uri]] - the URI of the meta-schema\n\t/// \n\tpublic static string? MetaSchemaValidation { get; set; }\n\n\t/// \n\t/// Gets or sets the error message for when the schema cannot be validated\n\t/// against the meta-schema.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[uri]] - the URI of the meta-schema\n\t/// \n\tpublic static string GetMetaSchemaValidation(CultureInfo? culture)\n\t{\n\t\treturn MetaSchemaValidation ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the type of value provided in the JSON instance\n\t/// - [[expected]] - the type(s) required by the schema\n\t/// \n\tpublic static string? Type { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.", + "snippet": "public static string? MultipleOf { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t///\tAvailable tokens are:\n\t/// - [[received]] - the type of value provided in the JSON instance\n\t/// - [[expected]] - the type(s) required by the schema\n\t/// \n\tpublic static string GetType(CultureInfo? culture)\n\t{\n\t\treturn Type ?? Get(culture);\n\t}\n\n\t/// \n\t/// Gets or sets the error message for .\n\t/// \n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[duplicates]] - the indices of duplicate pairs as a comma-delimited list of \"(x, y)\" items\n\t/// \n\tpublic static string? UniqueItems { get; set; }\n\n\t/// \n\t/// Gets the error message for for a specific culture.\n\t/// \n\t/// The culture to retrieve.\n\t/// \n\t///\tAvailable tokens are:\n\t/// - [[duplicates]] - the indices of duplicate pairs as a comma-delimited list of \"(x, y)\" items\n\t/// \n\tpublic static string GetUniqueItems(CultureInfo? culture)\n\t{\n\t\treturn UniqueItems ?? Get(culture);\n\t}\n}", + "snippet": "/// \n\t///\tAvailable tokens are:\n\t/// - [[received]] - the type of value provided in the JSON instance\n\t/// - [[expected]] - the type(s) required by the schema\n\t/// \n\tpublic static string GetType(Cu" + }, + { + "title": "src/JsonSchema/EvaluationContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/EvaluationContext.cs#L1-L90", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/EvaluationContext.cs", + "startLine": 1, + "endLine": 90, + "content": "using System.Collections.Generic;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n/// \n/// Provides contextual information used during schema evaluation, including options, scope, instance data, and\n/// evaluation paths.\n/// \n/// The EvaluationContext struct encapsulates all relevant data required for evaluating a JSON schema\n/// against an instance. It includes evaluation options, dynamic scope for reference resolution, pointers to the current\n/// evaluation and instance locations, and access to the schema registry. When building custom keywords that use\n/// subschemas, create a new context by copying this one and modifying the , ,\n/// and/or properties as appropriate.\npublic struct EvaluationContext\n{\n\t/// \n\t/// Gets the evaluation options.\n\t/// \n\t/// \n\t/// This may be different per run, so it's important this not be captured by constraints.\n\t/// \n\tpublic EvaluationOptions Options { get; internal init; }\n\t\n\t/// \n\t/// Gets the dynamic scope.\n\t/// \n\t/// \n\t/// The dynamic scope is the collection of URIs that evaluation has passed through to get\n\t/// to the current location. This is important when processing references.\n\t/// \n\tpublic DynamicScope Scope { get; internal init; }\n\n\t/// \n\t/// Gets the JSON element that represents the instance data root.\n\t/// \n\tpublic JsonElement InstanceRoot { get; init; }\n\n\t/// \n\t/// Gets the JSON element that represents the instance data.\n\t/// \n\tpublic JsonElement Instance { get; init; }\n\n\t/// \n\t/// Gets or sets a JSON Pointer representing the path through the schemas and across references to the currently evaluated subschema.\n\t/// \n\tpublic JsonPointer EvaluationPath { get; init; }\n\n\t/// \n\t/// Gets or sets the JSON Pointer indicating the location of the instance within the JSON document.\n\t/// \n\tpublic JsonPointer InstanceLocation\n\t{\n\t\tget;\n\t\tinit\n\t\t{\n\t\t\tif (!field.Equals(value))\n\t\t\t\tCanOptimize = Options.OutputFormat == OutputFormat.Flag;\n\t\t\tfield = value;\n\t\t}\n\t}\n\n\t/// \n\t/// Gets the schema registry used to manage and retrieve schema resources.\n\t/// \n\tpublic SchemaRegistry SchemaRegistry { get; internal init; }\n\n\t/// \n\t/// Gets a value indicating whether reference resolution ignores sibling keywords during processing.\n\t/// \n\tpublic bool RefIgnoresSiblingKeywords { get; internal init; }\n\n\t/// \n\t/// Gets the collection of keyword evaluations that have been performed for the current instance.\n\t/// \n\t/// This property is set internally and may be null if no keyword evaluations have occurred. The\n\t/// returned list reflects the latest evaluation results and is updated after each evaluation process.\n\t/// Keywords are guaranteed to be processed in the correct sequence if the \n\t/// attribute is used properly.\n\tpublic KeywordEvaluation[]? EvaluatedKeywords { get; internal set; }\n\n\t/// \n\t/// Gets a value indicating whether the current configuration allows optimization.\n\t/// \n\tpublic bool CanOptimize { get; internal set; }\n\n\tinternal Stack<(JsonSchemaNode, JsonPointer)> EvaluatedNodes { get; init; }\n}", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n/// \n/// Provides contextual information used during schema evaluation, including options, scope, instance d" + }, + { + "title": "src/JsonSchema/EvaluationOptions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/EvaluationOptions.cs#L1-L119", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/EvaluationOptions.cs", + "startLine": 1, + "endLine": 119, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nnamespace Json.Schema;\n\n/// \n/// Allows configuration of the evaluation process.\n/// \npublic class EvaluationOptions\n{\n\tprivate HashSet? _ignoredAnnotationTypes;\n\n\t/// \n\t/// The default settings.\n\t/// \n\tpublic static EvaluationOptions Default { get; } = new();\n\n\t/// \n\t/// Specifies the output format.\n\t/// \n\tpublic OutputFormat OutputFormat { get; set; }\n\n\t/// \n\t/// Specifies whether the `format` keyword should be required to provide\n\t/// validation results. Default is false, which just produces annotations\n\t/// for drafts 2019-09 and prior or follows the behavior set forth by the\n\t/// format-annotation vocabulary requirement in the `$vocabulary` keyword in\n\t/// a meta-schema declaring draft 2020-12.\n\t/// \n\tpublic bool RequireFormatValidation { get; set; }\n\n\t/// \n\t/// The local format registry. If a format is not found here, it will\n\t/// automatically check the global registry as well.\n\t/// \n\tpublic FormatRegistry FormatRegistry { get; set; } = FormatRegistry.Global;\n\n\t/// \n\t/// If enabled, annotations that are dropped as a result of a failing\n\t/// subschema will be reported in a `droppedAnnotations` property in\n\t/// the output.\n\t/// \n\tpublic bool PreserveDroppedAnnotations { get; set; }\n\n\t/// \n\t/// Outputs an annotation that lists any unknown keywords. Can be\n\t/// useful for catching typos.\n\t/// \n\tpublic bool AddAnnotationForUnknownKeywords { get; set; }\n\n\t/// \n\t/// Gets the set of keyword types from which annotations will be ignored.\n\t/// \n\tpublic IEnumerable? IgnoredAnnotations => _ignoredAnnotationTypes;\n\n\t/// \n\t/// Gets or sets the culture for error messages. Overrides .\n\t/// \n\tpublic CultureInfo? Culture { get; set; }\n\n\t/// \n\t/// Creates a deep copy of the options.\n\t/// \n\t/// The source options.\n\t/// A new options instance with the same settings.\n\tpublic static EvaluationOptions From(EvaluationOptions other)\n\t{\n\t\tvar options = new EvaluationOptions\n\t\t{\n\t\t\tOutputFormat = other.OutputFormat,\n\t\t\tRequireFormatValidation = other.RequireFormatValidation,\n\t\t\tPreserveDroppedAnnotations = other.PreserveDroppedAnnotations,\n\t\t\tAddAnnotationForUnknownKeywords = other.AddAnnotationForUnknownKeywords,\n\t\t\tCulture = other.Culture,\n\t\t\t_ignoredAnnotationTypes = other._ignoredAnnotationTypes == null\n\t\t\t\t? null\n\t\t\t\t: new(other._ignoredAnnotationTypes),\n\t\t};\n\t\treturn options;\n\t}\n\n\t/// \n\t/// Ignores annotations from the specified keyword.\n\t/// \n\t/// The keyword type which should not have annotations.\n\tpublic void IgnoreAnnotationsFrom()\n\t\twhere T : IKeywordHandler\n\t{\n\t\t_ignoredAnnotationTypes ??= [];\n\n\t\t_ignoredAnnotationTypes.Add(typeof(T));\n\t}\n\n\t/// \n\t/// Ignores annotations from all keywords.\n\t/// \n\tpublic void IgnoreAllAnnotations()\n\t{\n\t\t//_ignoredAnnotationTypes = new HashSet(SchemaKeywordRegistry.KeywordTypes);\n\t}\n\n\t/// \n\t/// Clears ignored annotations.\n\t/// \n\tpublic void ClearIgnoredAnnotations()\n\t{\n\t\t_ignoredAnnotationTypes = null;\n\t}\n\n\t/// \n\t/// Restores annotation collection for the specified keyword.\n\t/// \n\tpublic void CollectAnnotationsFrom()\n\t\twhere T : IKeywordHandler\n\t{\n\t\t_ignoredAnnotationTypes?.Remove(typeof(T));\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nnamespace Json.Schema;\n\n/// \n/// Allows configuration of the evaluation process.\n/// \npublic class EvaluationOptions\n{\n\tpriv" + }, + { + "title": "src/JsonSchema/EvaluationResults.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/EvaluationResults.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/EvaluationResults.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\n/// \n/// The results object for evaluations.\n/// \n[Serializable]\n[JsonConverter(typeof(EvaluationResultsJsonConverter))]\npublic class EvaluationResults\n{\n\tprivate readonly Uri _currentUri;\n\tprivate readonly HashSet? _backgroundAnnotations;\n\tprivate Uri? _schemaLocation;\n\n\t/// \n\t/// Indicates whether the validation passed or failed.\n\t/// \n\tpublic bool IsValid { get; set; } = true;\n\t/// \n\t/// The schema location that generated this node.\n\t/// \n\tpublic JsonPointer EvaluationPath { get; }\n\t/// \n\t/// The instance location that was processed.\n\t/// \n\tpublic JsonPointer InstanceLocation { get; }\n\n\t/// \n\t/// The absolute schema location.\n\t/// \n\t/// \n\t/// If the schema did not have an absolute `$id`, a generated base URI will be used.\n\t/// \n\tpublic Uri SchemaLocation => _schemaLocation ??= BuildSchemaLocation();\n\n\t/// \n\t/// The collection of nested results.\n\t/// \n\tpublic List? Details { get; set; }\n\n\t/// \n\t/// The collection of annotations from this node.\n\t/// \n\tpublic Dictionary? Annotations { get; set; }\n\n\t/// \n\t/// The collection of error from this node.\n\t/// \n\tpublic Dictionary? Errors { get; set; }\n\n\t/// \n\t/// Gets the parent result.\n\t/// \n\tpublic EvaluationResults? Parent { get; set; }\n\n\tinternal OutputFormat Format { get; private set; } = OutputFormat.Hierarchical;\n\n\tinternal bool IncludeDroppedAnnotations { get; }\n\n\tinternal IReadOnlyDictionary? AnnotationsToSerialize =>\n\t\tAnnotations is not null && Annotations.Count != 0\n\t\t\t? Annotations.Where(x => !(_backgroundAnnotations?.Contains(x.Key) ?? false)).ToDictionary(x => x.Key, x => x.Value)\n\t\t\t: null;\n\n#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.\n\tinternal EvaluationResults(){}\n\n\tinternal EvaluationResults(JsonPointer evaluationPath, Uri schemaLocation, JsonPointer instanceLocation, EvaluationOptions options)\n\t{\n\t\tEvaluationPath = evaluationPath;\n\t\t_schemaLocation = schemaLocation;\n\t\tInstanceLocation = instanceLocation;\n\n\t\tIncludeDroppedAnnotations = options.PreserveDroppedAnnotations;\n\t\t//if (options.IgnoredAnnotations != null)\n\t\t//{\n\t\t//\t_backgroundAnnotations = new HashSet(options.IgnoredAnnotations.Where(x => x.ProducesDependentAnnotations()).Select(x => x.Keyword()));\n\t\t//}\n\t}\n#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.\n\n\tprivate EvaluationResults(EvaluationResults other)\n\t{\n\t\tIsValid = other.IsValid;\n\t\tEvaluationPath = other.EvaluationPath;\n\t\t_currentUri = other._currentUri;\n\t\t_schemaLocation = other._schemaLocation;\n\t\tInstanceLocation = other.InstanceLocation;\n\t\tAnnotations = other.Annotations?.ToDictionary(x => x.Key, x => x.Value);\n\t\tErrors = other.Errors?.ToDictionary(x => x.Key, x => x.Value);\n\t\tIncludeDroppedAnnotations = other.IncludeDroppedAnnotations;\n\t\t_backgroundAnnotations = other._backgroundAnnotations;\n\t}\n\n\tprivate Uri BuildSchemaLocation()\n\t{\n\t\tvar localEvaluationPathSegmentCount = EvaluationPath.SegmentCount;\n\t\tfor (var i = EvaluationPath.SegmentCount - 1; i >= 0; i--)\n\t\t{\n\t\t\tvar segment = EvaluationPath[i];\n\t\t\tif (segment == RefKeyword.Instance.Name ||\n\t\t\t segment == Keywords.Draft201909.RecursiveRefKeyword.Instance.Name ||\n\t\t\t segment == DynamicRefKeyword.Instance.Name)\n\t\t\t{\n\t\t\t\tlocalEvaluationPathSegmentCount = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tJsonPointer fragment; // 2 allocations\n\t\tif (localEvaluationPathSegmentCount == 0)\n\t\t\tfragment = JsonPointer.Empty;", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\n/" + }, + { + "title": "src/JsonSchema/EvaluationResults.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/EvaluationResults.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/EvaluationResults.cs", + "startLine": 121, + "endLine": 240, + "content": "else if (localEvaluationPathSegmentCount == EvaluationPath.SegmentCount)\n\t\t\tfragment = EvaluationPath;\n\t\telse\n\t\t\tfragment = EvaluationPath.GetLocal(localEvaluationPathSegmentCount);\n\n\t\treturn fragment == JsonPointer.Empty\n\t\t\t? _currentUri\n\t\t\t: new Uri(_currentUri, \"#\" + fragment);\n\t}\n\n\t/// \n\t/// Transforms the results to the `basic` format.\n\t/// \n\tpublic void ToList()\n\t{\n\t\tvar children = GetAllChildren();\n\t\tif (children.Count == 0) return;\n\n\t\tchildren.Remove(this);\n\t\tchildren.Insert(0, new EvaluationResults(this) { Parent = this });\n\t\tAnnotations?.Clear();\n\t\tErrors?.Clear();\n\t\tif (Details == null)\n\t\t\tDetails = [];\n\t\telse\n\t\t\tDetails.Clear();\n\t\tforeach (var child in children)\n\t\t{\n\t\t\tchild.Details?.Clear();\n\t\t\tchild.Format = OutputFormat.List;\n\t\t}\n\t\t//_details.AddRange(children.Where(x => (x.IsValid && x.HasAnnotations) || (!x.IsValid && x.HasErrors)));\n\t\tDetails.AddRange(children);\n\t\tFormat = OutputFormat.List;\n\t}\n\n\tprivate List GetAllChildren()\n\t{\n\t\tvar all = new List();\n\t\tvar toProcess = new Queue();\n\n\t\ttoProcess.Enqueue(this);\n\t\twhile (toProcess.Count != 0)\n\t\t{\n\t\t\tvar current = toProcess.Dequeue();\n\t\t\tall.Add(current);\n\t\t\tif (current.Details is null || current.Details.Count == 0) continue;\n\n\t\t\tforeach (var nestedResult in current.Details)\n\t\t\t{\n\t\t\t\ttoProcess.Enqueue(nestedResult);\n\t\t\t}\n\t\t\tcurrent.Details?.Clear();\n\t\t}\n\n\t\t// we still include the root because it may have annotations\n\t\t// don't report annotations at the root of the output\n\t\treturn all;\n\t}\n\n\t/// \n\t/// Transforms the results to the `flag` format.\n\t/// \n\tpublic void ToFlag()\n\t{\n\t\tDetails?.Clear();\n\t\tAnnotations?.Clear();\n\t\tErrors?.Clear();\n\t\tFormat = OutputFormat.Flag;\n\t}\n}\n\n/// \n/// Default converter for .\n/// \npublic class EvaluationResultsJsonConverter : WeaklyTypedJsonConverter\n{\n\t/// Reads and converts the JSON to type .\n\t/// The reader.\n\t/// The type to convert.\n\t/// An object that specifies serialization options to use.\n\t/// The converted value.\n\tpublic override EvaluationResults Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tthrow new NotImplementedException();\n\t}\n\n\t/// Writes a specified value as JSON.\n\t/// The writer to write to.\n\t/// The value to convert to JSON.\n\t/// An object that specifies serialization options to use.\n\tpublic override void Write(Utf8JsonWriter writer, EvaluationResults value, JsonSerializerOptions options)\n\t{\n\t\twriter.WriteStartObject();\n\n\t\twriter.WriteBoolean(\"valid\", value.IsValid);\n\n\t\tif (value.Format == OutputFormat.Hierarchical || value.Parent != null)\n\t\t{\n\t\t\twriter.WritePropertyName(\"evaluationPath\");\n\t\t\toptions.Write(writer, value.EvaluationPath, JsonSchemaSerializerContext.Default.JsonPointer);\n\n\t\t\t// this can still be null if the root schema is a boolean\n\t\t\tif (value.SchemaLocation != null!)\n\t\t\t{\n\t\t\t\twriter.WritePropertyName(\"schemaLocation\");\n\t\t\t\tvar schemaLocation = value.SchemaLocation.OriginalString;\n\t\t\t\tif (string.IsNullOrEmpty(value.SchemaLocation.Fragment))\n\t\t\t\t\tschemaLocation += \"#\"; // see https://github.com/json-schema-org/JSON-Schema-Test-Suite/pull/671\n\t\t\t\toptions.Write(writer, schemaLocation, JsonSchemaSerializerContext.Default.String);\n\t\t\t}\n\n\t\t\twriter.WritePropertyName(\"instanceLocation\");\n\t\t\toptions.Write(writer, value.InstanceLocation, JsonSchemaSerializerContext.Default.JsonPointer);\n\t\t}\n\n\t\tif (value.IsValid)\n\t\t{\n\t\t\tif (value.AnnotationsToSerialize != null)\n\t\t\t{", + "snippet": "else if (localEvaluationPathSegmentCount == EvaluationPath.SegmentCount)\n\t\t\tfragment = EvaluationPath;\n\t\telse\n\t\t\tfragment = EvaluationPath.GetLocal(localEvaluationPathSegmentCount);\n\n\t\treturn fragment == JsonPointer.Empt" + }, + { + "title": "src/JsonSchema/EvaluationResults.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/EvaluationResults.cs#L241-L268", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/EvaluationResults.cs", + "startLine": 241, + "endLine": 268, + "content": "writer.WritePropertyName(\"annotations\");\n\t\t\t\toptions.WriteDictionary(writer, value.AnnotationsToSerialize!, JsonSchemaSerializerContext.Default.JsonElement);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (value.Errors is not null && value.Errors.Count != 0)\n\t\t\t{\n\t\t\t\twriter.WritePropertyName(\"errors\");\n\t\t\t\toptions.WriteDictionary(writer, value.Errors!, JsonSchemaSerializerContext.Default.String);\n\t\t\t}\n\t\t\tif (value is { IncludeDroppedAnnotations: true, AnnotationsToSerialize: not null })\n\t\t\t{\n\t\t\t\twriter.WritePropertyName(\"droppedAnnotations\");\n\t\t\t\toptions.WriteDictionary(writer, value.AnnotationsToSerialize!, JsonSchemaSerializerContext.Default.JsonElement);\n\t\t\t}\n\t\t}\n\n\t\tif (value.Details is not null && value.Details.Count != 0)\n\t\t{\n\t\t\twriter.WritePropertyName(\"details\");\n\t\t\toptions.WriteList(writer, value.Details, JsonSchemaSerializerContext.Default.EvaluationResults);\n\t\t}\n\n\t\twriter.WriteEndObject();\n\t}\n}", + "snippet": "writer.WritePropertyName(\"annotations\");\n\t\t\t\toptions.WriteDictionary(writer, value.AnnotationsToSerialize!, JsonSchemaSerializerContext.Default.JsonElement);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (value.Errors is not null && value.E" + }, + { + "title": "src/JsonSchema/Format.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Format.cs#L1-L35", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Format.cs", + "startLine": 1, + "endLine": 35, + "content": "using System.Text.Json;\n\nnamespace Json.Schema;\n\n/// \n/// Represents a format.\n/// \npublic class Format\n{\n\t/// \n\t/// The format key.\n\t/// \n\tpublic string Key { get; }\n\n\t/// \n\t/// Creates a new .\n\t/// \n\t/// The format key.\n\tpublic Format(string key)\n\t{\n\t\tKey = key;\n\t}\n\n\t/// \n\t/// Validates an instance against a format and provides an error message.\n\t/// \n\t/// \n\t/// An error message.\n\t/// `true`. Override to return another value.\n\tpublic virtual bool Validate(JsonElement value, out string? errorMessage)\n\t{\n\t\terrorMessage = null;\n\t\treturn true;\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema;\n\n/// \n/// Represents a format.\n/// \npublic class Format\n{\n\t/// \n\t/// The format key.\n\t/// \n\tpublic string Key { get; }\n\n\t/// " + }, + { + "title": "src/JsonSchema/FormatRegistry.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/FormatRegistry.cs#L1-L81", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/FormatRegistry.cs", + "startLine": 1, + "endLine": 81, + "content": "using System.Collections.Concurrent;\nusing System.Collections.Generic;\n\nnamespace Json.Schema;\n\n/// \n/// Represents a thread-safe registry for managing and retrieving format definitions within the application.\n/// \n/// Use the FormatRegistry to register, unregister, and look up format definitions by key. The static\n/// Global property provides access to a shared, application-wide registry pre-populated with common formats. This class\n/// is designed for scenarios where centralized management of formats is required, and is safe for use across multiple\n/// threads.\npublic class FormatRegistry\n{\n\tprivate readonly ConcurrentDictionary _formats = new();\n\n\t/// \n\t/// Gets the global registry of formats available throughout the application.\n\t/// \n\t/// Use this property to access a shared, application-wide instance of the format registry. The\n\t/// global registry is intended for scenarios where a centralized format store is required. This property is\n\t/// thread-safe.\n\tpublic static FormatRegistry Global { get; } = new();\n\n\tstatic FormatRegistry()\n\t{\n\t\tGlobal.Register(Formats.Date);\n\t\tGlobal.Register(Formats.DateTime);\n\t\tGlobal.Register(Formats.Duration);\n\t\tGlobal.Register(Formats.Email);\n\t\tGlobal.Register(Formats.Hostname);\n\t\tGlobal.Register(Formats.IdnEmail);\n\t\tGlobal.Register(Formats.IdnHostname);\n\t\tGlobal.Register(Formats.Ipv4);\n\t\tGlobal.Register(Formats.Ipv6);\n\t\tGlobal.Register(Formats.Iri);\n\t\tGlobal.Register(Formats.IriReference);\n\t\tGlobal.Register(Formats.JsonPointer);\n\t\tGlobal.Register(Formats.Regex);\n\t\tGlobal.Register(Formats.RelativeJsonPointer);\n\t\tGlobal.Register(Formats.Time);\n\t\tGlobal.Register(Formats.Uri);\n\t\tGlobal.Register(Formats.UriReference);\n\t\tGlobal.Register(Formats.UriTemplate);\n\t\tGlobal.Register(Formats.Uuid);\n\t}\n\n\t/// \n\t/// Registers the specified format for later retrieval by its key.\n\t/// \n\t/// The format to register. The format's key must be unique within the collection.\n\tpublic void Register(Format format)\n\t{\n\t\t_formats[format.Key] = format;\n\t}\n\n\t/// \n\t/// Unregisters the format associated with the specified name, removing it from the collection if it exists.\n\t/// \n\t/// If no format is registered with the specified name, this method has no effect. This method is\n\t/// thread-safe.\n\t/// The name of the format to unregister. Cannot be null.\n\tpublic void Unregister(string name)\n\t{\n\t\t_formats.TryRemove(name, out _);\n\t}\n\n\t/// \n\t/// Retrieves the format associated with the specified key, searching local and global collections.\n\t/// \n\t/// If the format is not found in the local collection, the method searches the global collection\n\t/// before returning an unknown format. The returned format is never null.\n\t/// The key that identifies the format to retrieve. Cannot be null.\n\t/// The format associated with the specified key if found; otherwise, a format representing an unknown key.\n\tpublic Format Get(string key)\n\t{\n\t\treturn _formats.GetValueOrDefault(key) ??\n\t\t\tGlobal._formats.GetValueOrDefault(key) ??\n\t\t\tFormats.CreateUnknown(key);\n\t}\n}", + "snippet": "using System.Collections.Concurrent;\nusing System.Collections.Generic;\n\nnamespace Json.Schema;\n\n/// \n/// Represents a thread-safe registry for managing and retrieving format definitions within the application.\n/" + }, + { + "title": "src/JsonSchema/Formats.cs (1/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Formats.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Formats.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Globalization;\nusing System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema;\n\n/// \n/// The formats supported by JSON Schema base specifications.\n/// \npublic static partial class Formats\n{\n#if NET7_0_OR_GREATER\n\t[GeneratedRegex(@\"^((?:([0-9]{4}-[0-9]{2}-[0-9]{2})([Tt_]| )([0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\.[0-9]+)?))([Zz]|[\\+-][0-9]{2}:[0-9]{2}))$\", RegexOptions.Compiled, 250)]\n\tprivate static partial Regex DateTimeRegex();\n#else\n// from https://regex101.com/r/qH0sU7/1, adjusted to enforce ASCII digits only\n\tprivate static readonly Regex _dateTimeRegex = new(@\"^((?:([0-9]{4}-[0-9]{2}-[0-9]{2})([Tt_]| )([0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\.[0-9]+)?))([Zz]|[\\+-][0-9]{2}:[0-9]{2}))$\", RegexOptions.Compiled, TimeSpan.FromMilliseconds(250));\n\n\tprivate static Regex DateTimeRegex() => _dateTimeRegex;\n#endif\n\n\n\t/// \n\t/// Defines the `date` format.\n\t/// \n\tpublic static readonly Format Date = new PredicateFormat(\"date\", CheckDate);\n\t/// \n\t/// Defines the `date-time` format.\n\t/// \n\tpublic static readonly Format DateTime = new PredicateFormat(\"date-time\", CheckDateTime);\n\t/// \n\t/// Defines the `duration` format.\n\t/// \n\tpublic static readonly Format Duration = new PredicateFormat(\"duration\", CheckDuration);\n\t/// \n\t/// Defines the `email` format.\n\t/// \n\tpublic static readonly Format Email = new PredicateFormat(\"email\", CheckEmail);\n\n\n#if NET7_0_OR_GREATER\n\t[GeneratedRegex(@\"^[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?)*$\", RegexOptions.Compiled, 250)]\n\tprivate static partial Regex HostnameRegex();\n#else\n\tprivate static readonly Regex _hostnameRegex = new(@\"^[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?)*$\", RegexOptions.Compiled, TimeSpan.FromMilliseconds(250));\n\n\tprivate static Regex HostnameRegex() => _hostnameRegex;\n#endif\n\n\n\t/// \n\t/// Defines the `hostname` format.\n\t/// \n\tpublic static readonly Format Hostname = new PredicateFormat(\"hostname\", CheckHostName);\n\t/// \n\t/// Defines the `idn-email` format.\n\t/// \n\tpublic static readonly Format IdnEmail = new PredicateFormat(\"idn-email\", CheckIdnEmail);\n\t/// \n\t/// Defines the `idn-hostname` format.\n\t/// \n\tpublic static readonly Format IdnHostname = new PredicateFormat(\"idn-hostname\", CheckIdnHostName);\n\t/// \n\t/// Defines the `ipv4` format.\n\t/// \n\tpublic static readonly Format Ipv4 = new PredicateFormat(\"ipv4\", CheckIpv4);\n\t/// \n\t/// Defines the `ipv6` format.\n\t/// \n\tpublic static readonly Format Ipv6 = new PredicateFormat(\"ipv6\", CheckIpv6);\n\t/// \n\t/// Defines the `iri` format.\n\t/// \n\tpublic static readonly Format Iri = new PredicateFormat(\"iri\", CheckAbsoluteIri);\n\t/// \n\t/// Defines the `iri-reference` format.\n\t/// \n\tpublic static readonly Format IriReference = new PredicateFormat(\"iri-reference\", CheckIriReference);\n\t/// \n\t/// Defines the `json-pointer` format.\n\t/// \n\tpublic static readonly Format JsonPointer = new PredicateFormat(\"json-pointer\", CheckJsonPointer);\n\t/// \n\t/// Defines the `regex` format.\n\t/// \n\tpublic static readonly Format Regex = new PredicateFormat(\"regex\", CheckRegex);\n\t/// \n\t/// Defines the `relative-json-pointer` format.\n\t/// \n\tpublic static readonly Format RelativeJsonPointer = new PredicateFormat(\"relative-json-pointer\", CheckRelativeJsonPointer);\n\t/// \n\t/// Defines the `time` format.\n\t/// \n\tpublic static readonly Format Time = new PredicateFormat(\"time\", CheckTime);\n\t/// \n\t/// Defines the `uri` format.\n\t/// \n\tpublic static readonly Format Uri = new PredicateFormat(\"uri\", CheckAbsoluteUri);\n\t/// \n\t/// Defines the `uri-reference` format.\n\t/// \n\tpublic static readonly Format UriReference = new PredicateFormat(\"uri-reference\", CheckUri);\n\t/// \n\t/// Defines the `uri-template` format.\n\t/// \n\t/// \n\t/// This is currently the same check as `uri`. The infrastructure to check URI templates\n\t/// [does not yet exist in .Net Standard/Core](https://github.com/dotnet/runtime/issues/41587).\n\t/// \n\tpublic static readonly Format UriTemplate = new PredicateFormat(\"uri-template\", CheckUriTemplate);\n\t/// \n\t/// Defines the `uuid` format.\n\t/// \n\tpublic static readonly Format Uuid = new PredicateFormat(\"uuid\", CheckUuid);\n\n\t/// \n\t/// Gets a format by its key.\n\t/// \n\t/// The key.", + "snippet": "using System;\nusing System.Globalization;\nusing System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema;\n\n/// \n/// The formats supported by JSON Schema base specifications.\n/// \n" + }, + { + "title": "src/JsonSchema/Formats.cs (2/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Formats.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Formats.cs", + "startLine": 121, + "endLine": 240, + "content": "/// The specified format, if known; otherwise null.\n\t[Obsolete(\"This just calls FormatRegistry.Global.Get(). Use that instead.\")]\n\tpublic static Format Get(string key)\n\t{\n\t\treturn FormatRegistry.Global.Get(key);\n\t}\n\n\t/// \n\t/// Registers a new format.\n\t/// \n\t/// The format.\n\t[Obsolete(\"This just calls FormatRegistry.Global.Register(). Use that instead.\")]\n\tpublic static void Register(Format format)\n\t{\n\t\tFormatRegistry.Global.Register(format);\n\t}\n\n\t/// \n\t/// Creates an unknown format.\n\t/// \n\t/// The format key.\n\t/// A instance.\n\tpublic static Format CreateUnknown(string name)\n\t{\n\t\treturn new UnknownFormat(name);\n\t}\n\n\tprivate static bool IsHexChar(char ch)\n\t{\n\t\treturn ('0' <= ch && ch <= '9') ||\n\t\t ('A' <= ch && ch <= 'F') ||\n\t\t ('a' <= ch && ch <= 'f');\n\t}\n\n\tprivate static bool HasValidPercentEncodedPairs(string value)\n\t{\n\t\tfor (int i = 0; i < value.Length; i++)\n\t\t{\n\t\t\tif (value[i] != '%') continue;\n\n\t\t\tif (i + 2 >= value.Length) return false;\n\t\t\tif (!IsHexChar(value[i + 1]) || !IsHexChar(value[i + 2])) return false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate static bool CheckAbsoluteIri(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar value = node.GetString()!;\n\n\t\tforeach (var ch in value)\n\t\t{\n\t\t\tif (!IsValidForIri(ch)) return false;\n\t\t}\n\n\t\tif (!System.Uri.TryCreate(value, UriKind.Absolute, out var uri))\n\t\t\treturn false;\n\n\t\t// Must have a proper scheme (reject UNC paths)\n\t\treturn !string.IsNullOrEmpty(uri.Scheme) && value.IndexOf(':') > 0;\n\t}\n\n\tprivate static bool CheckAbsoluteUri(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar value = node.GetString()!;\n\t\tif (!HasValidPercentEncodedPairs(value)) return false;\n\n\t\tforeach (var ch in value)\n\t\t{\n\t\t\tif (!IsValidForIri(ch)) return false;\n\n\t\t\t// URI must be ASCII-only (non-ASCII must be percent-encoded)\n\t\t\tif (ch > 127) return false;\n\t\t}\n\n\t\t// Check for invalid [ or ] in userinfo (before @)\n\t\tvar atIndex = value.IndexOf('@');\n\t\tif (atIndex > 0)\n\t\t{\n\t\t\tvar schemeEnd = value.IndexOf(\"://\");\n\t\t\tif (schemeEnd >= 0)\n\t\t\t{\n\t\t\t\tvar userinfo = value.Substring(schemeEnd + 3, atIndex - schemeEnd - 3);\n\t\t\t\tif (userinfo.IndexOf('[') >= 0 || userinfo.IndexOf(']') >= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (!System.Uri.TryCreate(value, UriKind.Absolute, out var uri))\n\t\t\treturn false;\n\n\t\t// Must have a proper scheme (reject UNC paths)\n\t\treturn !string.IsNullOrEmpty(uri.Scheme) && value.IndexOf(':') > 0;\n\t}\n\n\tprivate static bool CheckIriReference(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar value = node.GetString()!;\n\n\t\tforeach (var ch in value)\n\t\t{\n\t\t\tif (!IsValidForIri(ch)) return false;\n\t\t}\n\n\t\treturn System.Uri.TryCreate(value, UriKind.RelativeOrAbsolute, out _);\n\t}\n\n\tprivate static bool CheckUri(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar value = node.GetString()!;\n\t\tif (!HasValidPercentEncodedPairs(value)) return false;", + "snippet": "/// The specified format, if known; otherwise null.\n\t[Obsolete(\"This just calls FormatRegistry.Global.Get(). Use that instead.\")]\n\tpublic static Format Get(string key)\n\t{\n\t\treturn FormatRegistry.Globa" + }, + { + "title": "src/JsonSchema/Formats.cs (3/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Formats.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Formats.cs", + "startLine": 241, + "endLine": 360, + "content": "foreach (var ch in value)\n\t\t{\n\t\t\tif (!IsValidForIri(ch)) return false;\n\n\t\t\t// URI-reference must be ASCII-only (non-ASCII must be percent-encoded)\n\t\t\tif (ch > 127) return false;\n\t\t}\n\n\t\treturn System.Uri.TryCreate(value, UriKind.RelativeOrAbsolute, out _);\n\t}\n\n\t// Reject invalid characters per RFC3987 (IRI)\n\t// Must not contain: backslash, space, <, >, {, }, |, ^, `, \"\n\tprivate static bool IsValidForIri(char ch)\n\t{\n\t\treturn ch is not ('\\\\' or ' ' or '<' or '>' or '{' or '}' or '|' or '^' or '`' or '\"');\n\t}\n\n\tprivate static bool CheckUriTemplate(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar value = node.GetString()!;\n\n\t\t// Basic RFC 6570 URI Template validation\n\t\t// Check that all { have matching } and vice versa\n\t\tint depth = 0;\n\t\tbool inExpression = false;\n\n\t\tforeach (var ch in value)\n\t\t{\n\t\t\tif (ch == '{')\n\t\t\t{\n\t\t\t\tif (inExpression) return false; // nested braces not allowed\n\t\t\t\tinExpression = true;\n\t\t\t\tdepth++;\n\t\t\t}\n\t\t\telse if (ch == '}')\n\t\t\t{\n\t\t\t\tif (!inExpression) return false; // closing without opening\n\t\t\t\tinExpression = false;\n\t\t\t\tdepth--;\n\t\t\t}\n\t\t}\n\n\t\t// All braces must be closed\n\t\treturn depth == 0;\n\t}\n\n\tprivate static bool CheckJsonPointer(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar str = node.GetString()!;\n\t\treturn string.IsNullOrEmpty(str) || (str[0] != '#' && Pointer.JsonPointer.TryParse(str, out _));\n\t}\n\n\tprivate static bool CheckRelativeJsonPointer(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\treturn Pointer.RelativeJsonPointer.TryParse(node.GetString()!, out _);\n\t}\n\n#if NET7_0_OR_GREATER\n\t[GeneratedRegex(@\"(@)(.+)$\", RegexOptions.Compiled, 250)]\n\tprivate static partial Regex NormalizeDomainRegex();\n\n\t[GeneratedRegex(@\"^(?(\"\")(\"\".+?(? _normalizeDomainRegex;\n\n\tprivate static readonly Regex _emailFormatRegex =\n\t\tnew(@\"^(?(\"\")(\"\".+?(? _emailFormatRegex;\n#endif\n\n\n\t// source: https://docs.microsoft.com/en-us/dotnet/standard/base-types/how-to-verify-that-strings-are-in-valid-email-format\n\tprivate static bool CheckEmail(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar email = node.GetString()!;\n\n\t\tif (string.IsNullOrWhiteSpace(email)) return false;\n\n\t\t// Skip IDN normalization for domain-literals\n\t\tvar atIndex = email.LastIndexOf('@');\n\t\tvar isDomainLiteral = atIndex >= 0 && atIndex + 1 < email.Length && email[atIndex + 1] == '[';\n\n\t\tif (!isDomainLiteral)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\t// Normalize the domain\n\t\t\t\temail = NormalizeDomainRegex().Replace(email, DomainMapper);\n\t\t\t}\n\t\t\tcatch (RegexMatchTimeoutException)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tcatch (ArgumentException)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\ttry\n\t\t{\n\t\t\tif (!EmailFormatRegex().IsMatch(email)) return false;\n\n\t\t\t// Validate IP address domain-literal if present\n\t\t\tif (isDomainLiteral)", + "snippet": "foreach (var ch in value)\n\t\t{\n\t\t\tif (!IsValidForIri(ch)) return false;\n\n\t\t\t// URI-reference must be ASCII-only (non-ASCII must be percent-encoded)\n\t\t\tif (ch > 127) return false;\n\t\t}\n\n\t\treturn System.Uri.TryCreate(value, " + }, + { + "title": "src/JsonSchema/Formats.cs (4/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Formats.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Formats.cs", + "startLine": 361, + "endLine": 480, + "content": "{\n\t\t\t\tvar domain = email[(atIndex + 1)..];\n\t\t\t\tif (!domain.StartsWith(\"[\") || !domain.EndsWith(\"]\"))\n\t\t\t\t\treturn false;\n\n\t\t\t\tvar addrContent = domain.Substring(1, domain.Length - 2);\n\t\t\t\t\n\t\t\t\tif (addrContent.StartsWith(\"IPv6:\", StringComparison.OrdinalIgnoreCase))\n\t\t\t\t{\n\t\t\t\t\t// IPv6 literal\n\t\t\t\t\tvar addr = addrContent[5..];\n\t\t\t\t\tif (!System.Net.IPAddress.TryParse(addr, out var ip)) return false;\n\t\t\t\t\tif (ip.AddressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6) return false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// IPv4 literal\n\t\t\t\t\tif (!System.Net.IPAddress.TryParse(addrContent, out var ip)) return false;\n\t\t\t\t\tif (ip.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork) return false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t\tcatch (RegexMatchTimeoutException)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// source: part of above\n\t// Examines the domain part of the email and normalizes it.\n\tprivate static string DomainMapper(Match match)\n\t{\n\t\t// Use IdnMapping class to convert Unicode domain names.\n\t\tvar idn = new IdnMapping();\n\n\t\t// Pull out and process domain name (throws ArgumentException on invalid)\n\t\tvar domainName = idn.GetAscii(match.Groups[2].Value);\n\n\t\treturn match.Groups[1].Value + domainName;\n\t}\n\n\tprivate static bool CheckIdnEmail(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar email = node.GetString()!;\n\n\t\tif (string.IsNullOrWhiteSpace(email)) return false;\n\n\t\tvar atIndex = email.LastIndexOf('@');\n\t\tif (atIndex <= 0 || atIndex == email.Length - 1) return false;\n\n\t\tvar local = email[..atIndex];\n\t\tvar domain = email[(atIndex + 1)..];\n\n\t\t// Local-part: allow Unicode or quoted strings, basic validation only\n\t\tif (local.Length == 0) return false;\n\t\tif (local[0] == '\"')\n\t\t{\n\t\t\t// Must end with quote\n\t\t\tif (local[^1] != '\"') return false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Unquoted: disallow leading/trailing dots and consecutive dots\n\t\t\tif (local[0] == '.' || local[^1] == '.') return false;\n\t\t\tif (local.Contains(\"..\")) return false;\n\t\t}\n\n\t\t// Domain: normalize and validate using CheckIdnHostName\n\t\tif (domain.Length == 0) return false;\n\t\t\n\t\t// Handle domain literals (IPv4/IPv6)\n\t\tif (domain[0] == '[')\n\t\t{\n\t\t\tif (!domain.EndsWith(\"]\")) return false;\n\t\t\tvar addrContent = domain.Substring(1, domain.Length - 2);\n\t\t\t\n\t\t\tif (addrContent.StartsWith(\"IPv6:\", StringComparison.OrdinalIgnoreCase))\n\t\t\t{\n\t\t\t\tvar addr = addrContent[5..];\n\t\t\t\tif (!System.Net.IPAddress.TryParse(addr, out var ip)) return false;\n\t\t\t\tif (ip.AddressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6) return false;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (!System.Net.IPAddress.TryParse(addrContent, out var ip)) return false;\n\t\t\t\tif (ip.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork) return false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\t// Use idn-hostname validation for domain\n\t\tvar testNode = JsonDocument.Parse($\"\\\"{domain}\\\"\").RootElement;\n\t\treturn CheckIdnHostName(testNode);\n\t}\n\n\tprivate static bool CheckUuid(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\treturn Guid.TryParseExact(node.GetString()!, \"D\", out _);\n\t}\n\n\tprivate static bool CheckDate(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar dateString = node.GetString()!;\n\t\treturn TryParseRfc3339FullDate(dateString);\n\t}\n\n\tprivate static bool IsAsciiDigits(string s)\n\t{\n\t\tforeach (var ch in s)\n\t\t{\n\t\t\tif (ch < '0' || ch > '9') return false;\n\t\t}", + "snippet": "{\n\t\t\t\tvar domain = email[(atIndex + 1)..];\n\t\t\t\tif (!domain.StartsWith(\"[\") || !domain.EndsWith(\"]\"))\n\t\t\t\t\treturn false;\n\n\t\t\t\tvar addrContent = domain.Substring(1, domain.Length - 2);\n\t\t\t\t\n\t\t\t\tif (addrContent.StartsWith(\"" + }, + { + "title": "src/JsonSchema/Formats.cs (5/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Formats.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Formats.cs", + "startLine": 481, + "endLine": 600, + "content": "return true;\n\t}\n\n\tprivate static bool IsLeapYearProlepticGregorian(int year)\n\t{\n\t\treturn year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);\n\t}\n\n\tprivate static int GetDaysInMonthProlepticGregorian(int year, int month)\n\t{\n\t\treturn month switch\n\t\t{\n\t\t\t1 => 31,\n\t\t\t2 => IsLeapYearProlepticGregorian(year) ? 29 : 28,\n\t\t\t3 => 31,\n\t\t\t4 => 30,\n\t\t\t5 => 31,\n\t\t\t6 => 30,\n\t\t\t7 => 31,\n\t\t\t8 => 31,\n\t\t\t9 => 30,\n\t\t\t10 => 31,\n\t\t\t11 => 30,\n\t\t\t12 => 31,\n\t\t\t_ => 0\n\t\t};\n\t}\n\n\tprivate static bool TryParseRfc3339FullDate(string datePart)\n\t{\n\t\tif (datePart.Length != 10) return false;\n\t\tif (datePart[4] != '-' || datePart[7] != '-') return false;\n\n\t\tvar yearPart = datePart[..4];\n\t\tvar monthPart = datePart.Substring(5, 2);\n\t\tvar dayPart = datePart.Substring(8, 2);\n\n\t\tif (!IsAsciiDigits(yearPart) || !IsAsciiDigits(monthPart) || !IsAsciiDigits(dayPart)) return false;\n\t\tif (!int.TryParse(yearPart, NumberStyles.None, CultureInfo.InvariantCulture, out var year)) return false;\n\t\tif (!int.TryParse(monthPart, NumberStyles.None, CultureInfo.InvariantCulture, out var month)) return false;\n\t\tif (!int.TryParse(dayPart, NumberStyles.None, CultureInfo.InvariantCulture, out var day)) return false;\n\n\t\tif (month < 1 || month > 12) return false;\n\t\tvar daysInMonth = GetDaysInMonthProlepticGregorian(year, month);\n\t\tif (day < 1 || day > daysInMonth) return false;\n\n\t\treturn true;\n\t}\n\n\tprivate static bool CheckTime(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar timeString = node.GetString()!;\n\n\t\t// Must contain offset (Z or +/-HH:MM)\n\t\tif (!timeString.EndsWith(\"Z\", StringComparison.OrdinalIgnoreCase) && \n\t\t timeString.IndexOf('+') < 0 && timeString.IndexOf('-') < 0)\n\t\t\treturn false;\n\n\t\t// Parse the time and offset parts\n\t\tstring timePart;\n\t\tstring offsetPart;\n\n\t\tif (timeString.EndsWith(\"Z\", StringComparison.OrdinalIgnoreCase))\n\t\t{\n\t\t\ttimePart = timeString[..^1];\n\t\t\toffsetPart = timeString[^1..];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar lastPlus = timeString.LastIndexOf('+');\n\t\t\tvar lastMinus = timeString.LastIndexOf('-');\n\t\t\tvar offsetIndex = Math.Max(lastPlus, lastMinus);\n\t\t\tif (offsetIndex <= 0) return false;\n\n\t\t\ttimePart = timeString[..offsetIndex];\n\t\t\toffsetPart = timeString[offsetIndex..];\n\t\t}\n\n\t\t// Parse time HH:MM:SS[.fraction]\n\t\tvar fracSplit = timePart.Split('.');\n\t\tvar hms = fracSplit[0].Split(':');\n\t\tif (hms.Length != 3) return false;\n\n\t\t// Each component must be exactly 2 digits\n\t\tif (hms[0].Length != 2 || hms[1].Length != 2 || hms[2].Length != 2) return false;\n\t\tif (!IsAsciiDigits(hms[0]) || !IsAsciiDigits(hms[1]) || !IsAsciiDigits(hms[2])) return false;\n\n\t\tif (!int.TryParse(hms[0], NumberStyles.None, CultureInfo.InvariantCulture, out var hour)) return false;\n\t\tif (!int.TryParse(hms[1], NumberStyles.None, CultureInfo.InvariantCulture, out var minute)) return false;\n\t\tif (!int.TryParse(hms[2], NumberStyles.None, CultureInfo.InvariantCulture, out var second)) return false;\n\n\t\tif (hour < 0 || hour > 23) return false;\n\t\tif (minute < 0 || minute > 59) return false;\n\n\t\tvar isLeapSecond = second == 60;\n\t\tif (!isLeapSecond)\n\t\t{\n\t\t\tif (second < 0 || second > 59) return false;\n\t\t}\n\n\t\t// Validate fraction if present\n\t\tif (fracSplit.Length > 1)\n\t\t{\n\t\t\tvar frac = fracSplit[1];\n\t\t\tif (frac.Length == 0) return false;\n\t\t\tif (!IsAsciiDigits(frac)) return false;\n\t\t}\n\n\t\t// Validate offset\n\t\tif (offsetPart.Equals(\"Z\", StringComparison.Ordinal) || offsetPart.Equals(\"z\", StringComparison.Ordinal))\n\t\t{\n\t\t\tif (isLeapSecond && !(hour == 23 && minute == 59)) return false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar sign = offsetPart[0];\n\t\t\tif (sign != '+' && sign != '-') return false;", + "snippet": "return true;\n\t}\n\n\tprivate static bool IsLeapYearProlepticGregorian(int year)\n\t{\n\t\treturn year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);\n\t}\n\n\tprivate static int GetDaysInMonthProlepticGregorian(int year, int month" + }, + { + "title": "src/JsonSchema/Formats.cs (6/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Formats.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Formats.cs", + "startLine": 601, + "endLine": 720, + "content": "var off = offsetPart.Substring(1).Split(':');\n\t\t\tif (off.Length != 2) return false;\n\t\t\t\n\t\t\t// Each offset component must be exactly 2 digits\n\t\t\tif (off[0].Length != 2 || off[1].Length != 2) return false;\n\t\t\tif (!IsAsciiDigits(off[0]) || !IsAsciiDigits(off[1])) return false;\n\t\t\t\n\t\t\tif (!int.TryParse(off[0], NumberStyles.None, CultureInfo.InvariantCulture, out var offHour)) return false;\n\t\t\tif (!int.TryParse(off[1], NumberStyles.None, CultureInfo.InvariantCulture, out var offMinute)) return false;\n\t\t\tif (offHour < 0 || offHour > 23) return false;\n\t\t\tif (offMinute < 0 || offMinute > 59) return false;\n\n\t\t\t// Validate leap second against UTC\n\t\t\tif (isLeapSecond)\n\t\t\t{\n\t\t\t\tvar utcHour = hour;\n\t\t\t\tvar utcMinute = minute;\n\t\t\t\tif (sign == '+')\n\t\t\t\t{\n\t\t\t\t\tutcHour -= offHour;\n\t\t\t\t\tutcMinute -= offMinute;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tutcHour += offHour;\n\t\t\t\t\tutcMinute += offMinute;\n\t\t\t\t}\n\n\t\t\t\tif (utcMinute < 0)\n\t\t\t\t{\n\t\t\t\t\tutcMinute += 60;\n\t\t\t\t\tutcHour -= 1;\n\t\t\t\t}\n\t\t\t\telse if (utcMinute >= 60)\n\t\t\t\t{\n\t\t\t\t\tutcMinute -= 60;\n\t\t\t\t\tutcHour += 1;\n\t\t\t\t}\n\n\t\t\t\tutcHour %= 24;\n\t\t\t\tif (utcHour < 0) utcHour += 24;\n\n\t\t\t\tif (!(utcHour == 23 && utcMinute == 59)) return false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate static bool CheckDateTime(JsonElement node)\n\t{\n\t\tif (!CheckDateFormat(node))\n\t\t{\n\t\t\treturn CheckDateTimePrecisionFormat(node);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate static bool CheckDateFormat(JsonElement node, params string[] formats)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar dateString = node.GetString()!;\n\t\tdateString = dateString.ToUpperInvariant();\n\t\tif (formats.Length != 0)\n\t\t{\n\t\t\tvar canParseExact = System.DateTime.TryParseExact(dateString, formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out _);\n\t\t\tif (canParseExact) return true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate static bool CheckDateTimePrecisionFormat(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar dateString = node.GetString()!;\n\n\t\tvar match = DateTimeRegex().Match(dateString);\n\t\tif (!match.Success) return false;\n\n\t\t// Extract groups: 2=date, 3=separator, 4=time, 5=offset\n\t\tvar datePart = match.Groups[2].Value; // YYYY-MM-DD\n\t\tvar timePart = match.Groups[4].Value; // HH:MM:SS[.fraction]\n\t\tvar offsetPart = match.Groups[5].Value; // Z or ±HH:MM\n\n\t\tif (!TryParseRfc3339FullDate(datePart)) return false;\n\n\t\tvar fracSplit = timePart.Split('.');\n\t\tvar hms = fracSplit[0].Split(':');\n\t\tif (hms.Length != 3) return false;\n\t\tif (!IsAsciiDigits(hms[0]) || !IsAsciiDigits(hms[1]) || !IsAsciiDigits(hms[2])) return false;\n\t\tif (!int.TryParse(hms[0], NumberStyles.None, CultureInfo.InvariantCulture, out var hour)) return false;\n\t\tif (!int.TryParse(hms[1], NumberStyles.None, CultureInfo.InvariantCulture, out var minute)) return false;\n\t\tif (!int.TryParse(hms[2], NumberStyles.None, CultureInfo.InvariantCulture, out var second)) return false;\n\t\tif (hour < 0 || hour > 23) return false;\n\t\tif (minute < 0 || minute > 59) return false;\n\t\t// RFC3339 allows leap second 60 only at 23:59:60 UTC.\n\t\t// Validate by converting local time to UTC using the offset and\n\t\t// ensuring the resulting time is 23:59 when seconds==60.\n\t\tvar isLeapSecond = second == 60;\n\t\tif (!isLeapSecond)\n\t\t{\n\t\t\tif (second < 0 || second > 59) return false;\n\t\t}\n\n\t\tif (fracSplit.Length > 1)\n\t\t{\n\t\t\tvar frac = fracSplit[1];\n\t\t\tif (frac.Length == 0) return false;\n\t\t\tif (!IsAsciiDigits(frac)) return false;\n\t\t}\n\n\t\t// Offset validation\n\t\tif (offsetPart.Equals(\"Z\", StringComparison.Ordinal) || offsetPart.Equals(\"z\", StringComparison.Ordinal))\n\t\t{\n\t\t\t// Zulu time; for leap second, must be 23:59\n\t\t\tif (isLeapSecond && !(hour == 23 && minute == 59)) return false;", + "snippet": "var off = offsetPart.Substring(1).Split(':');\n\t\t\tif (off.Length != 2) return false;\n\t\t\t\n\t\t\t// Each offset component must be exactly 2 digits\n\t\t\tif (off[0].Length != 2 || off[1].Length != 2) return false;\n\t\t\tif (!IsAsciiD" + }, + { + "title": "src/JsonSchema/Formats.cs (7/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Formats.cs#L721-L840", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Formats.cs", + "startLine": 721, + "endLine": 840, + "content": "}\n\t\telse\n\t\t{\n\t\t\t// ±HH:MM\n\t\t\tvar sign = offsetPart[0];\n\t\t\tif (sign != '+' && sign != '-') return false;\n\t\t\tvar off = offsetPart[1..].Split(':');\n\t\t\tif (off.Length != 2) return false;\n\t\t\tif (!IsAsciiDigits(off[0]) || !IsAsciiDigits(off[1])) return false;\n\t\t\tif (!int.TryParse(off[0], NumberStyles.None, CultureInfo.InvariantCulture, out var offHour)) return false;\n\t\t\tif (!int.TryParse(off[1], NumberStyles.None, CultureInfo.InvariantCulture, out var offMinute)) return false;\n\t\t\tif (offHour < 0 || offHour > 23) return false;\n\t\t\tif (offMinute < 0 || offMinute > 59) return false;\n\n\t\t\tif (isLeapSecond)\n\t\t\t{\n\t\t\t\t// Compute UTC time-of-day: local time minus offset sign\n\t\t\t\t// RFC3339 offset meaning: local time = UTC + offset\n\t\t\t\t// Therefore UTC = local time - offset\n\t\t\t\tvar utcHour = hour;\n\t\t\t\tvar utcMinute = minute;\n\t\t\t\tif (sign == '+')\n\t\t\t\t{\n\t\t\t\t\tutcHour -= offHour;\n\t\t\t\t\tutcMinute -= offMinute;\n\t\t\t\t}\n\t\t\t\telse // sign == '-'\n\t\t\t\t{\n\t\t\t\t\tutcHour += offHour;\n\t\t\t\t\tutcMinute += offMinute;\n\t\t\t\t}\n\n\t\t\t\t// Normalize minutes\n\t\t\t\tif (utcMinute < 0)\n\t\t\t\t{\n\t\t\t\t\tutcMinute += 60;\n\t\t\t\t\tutcHour -= 1;\n\t\t\t\t}\n\t\t\t\telse if (utcMinute >= 60)\n\t\t\t\t{\n\t\t\t\t\tutcMinute -= 60;\n\t\t\t\t\tutcHour += 1;\n\t\t\t\t}\n\n\t\t\t\t// Normalize hours to 0..23 (date rollover ignored for validation)\n\t\t\t\tutcHour %= 24;\n\t\t\t\tif (utcHour < 0) utcHour += 24;\n\n\t\t\t\tif (!(utcHour == 23 && utcMinute == 59)) return false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate static bool CheckHostName(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar value = node.GetString()!;\n\n\t\t// Empty, too long, or contains underscore\n\t\tif (string.IsNullOrEmpty(value) || value.Length > 255 || value.IndexOf('_') >= 0) return false;\n\n\t\t// Leading or trailing dot\n\t\tif (value[0] == '.' || value[^1] == '.') return false;\n\n\t\t// Check basic pattern\n\t\tif (!HostnameRegex().IsMatch(value)) return false;\n\n\t\t// Split into labels and validate each\n\t\tvar labels = value.Split('.');\n\t\tforeach (var label in labels)\n\t\t{\n\t\t\t// Each label max 63 chars\n\t\t\tif (label.Length > 63) return false;\n\n\t\t\t// Cannot have -- in positions 3-4 (index 2-3)\n\t\t\t// Exception: xn-- is allowed as punycode prefix (positions 1-2, not 3-4)\n\t\t\tif (label.Length >= 4 && label[2] == '-' && label[3] == '-')\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate static bool CheckIdnHostName(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar value = node.GetString()!;\n\n\t\t// Empty, too long, or contains underscore\n\t\tif (string.IsNullOrEmpty(value) || value.Length > 255 || value.IndexOf('_') >= 0) return false;\n\n\t\t// Reject Unicode dot separators (fullwidth, halfwidth ideographic)\n\t\t// U+FF0E fullwidth full stop, U+FF61 halfwidth ideographic full stop, U+3002 ideographic full stop\n\t\tif (value.IndexOf('\\uFF0E') >= 0 || value.IndexOf('\\uFF61') >= 0 || value.IndexOf('\\u3002') >= 0)\n\t\t\treturn false;\n\n\t\t// Leading or trailing dot\n\t\tif (value[0] == '.' || value[^1] == '.') return false;\n\n\t\t// Split into labels and validate each\n\t\tvar labels = value.Split('.');\n\t\tforeach (var label in labels)\n\t\t{\n\t\t\tif (label.Length == 0) return false;\n\t\t\t\n\t\t\t// Each label max 63 chars\n\t\t\tif (label.Length > 63) return false;\n\n\t\t\t// Cannot start or end with hyphen\n\t\t\tif (label[0] == '-' || label[^1] == '-') return false;\n\n\t\t\t// Cannot have -- in positions 3-4 (index 2-3)\n\t\t\tif (label.Length >= 4 && label[2] == '-' && label[3] == '-')\n\t\t\t{", + "snippet": "}\n\t\telse\n\t\t{\n\t\t\t// ±HH:MM\n\t\t\tvar sign = offsetPart[0];\n\t\t\tif (sign != '+' && sign != '-') return false;\n\t\t\tvar off = offsetPart[1..].Split(':');\n\t\t\tif (off.Length != 2) return false;\n\t\t\tif (!IsAsciiDigits(off[0]) || !IsA" + }, + { + "title": "src/JsonSchema/Formats.cs (8/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Formats.cs#L841-L960", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Formats.cs", + "startLine": 841, + "endLine": 960, + "content": "return false;\n\t\t\t}\n\n\t\t\t// Check for disallowed starting characters (combining marks)\n\t\t\tif (label.Length > 0)\n\t\t\t{\n\t\t\t\tvar firstChar = label[0];\n\t\t\t\tvar category = char.GetUnicodeCategory(firstChar);\n\t\t\t\t\n\t\t\t\t// Cannot start with combining marks\n\t\t\t\tif (category == UnicodeCategory.SpacingCombiningMark ||\n\t\t\t\t category == UnicodeCategory.NonSpacingMark ||\n\t\t\t\t category == UnicodeCategory.EnclosingMark)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// IDNA2008 contextual rules for specific characters\n\t\t\tfor (int i = 0; i < label.Length; i++)\n\t\t\t{\n\t\t\t\tvar ch = label[i];\n\t\t\t\t\n\t\t\t\t// U+00B7 MIDDLE DOT: must be surrounded by 'l' (U+006C)\n\t\t\t\tif (ch == '\\u00B7')\n\t\t\t\t{\n\t\t\t\t\tif (i == 0 || i == label.Length - 1) return false;\n\t\t\t\t\tif (label[i - 1] != 'l' || label[i + 1] != 'l') return false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// U+0375 Greek KERAIA: must be followed by Greek letter\n\t\t\t\tif (ch == '\\u0375')\n\t\t\t\t{\n\t\t\t\t\tif (i == label.Length - 1) return false;\n\t\t\t\t\tvar next = label[i + 1];\n\t\t\t\t\t// Check if next char is Greek (U+0370-U+03FF range)\n\t\t\t\t\tif (next < '\\u0370' || next > '\\u03FF') return false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// U+05F3 Hebrew GERESH: must be preceded by Hebrew letter\n\t\t\t\tif (ch == '\\u05F3')\n\t\t\t\t{\n\t\t\t\t\tif (i == 0) return false;\n\t\t\t\t\tvar prev = label[i - 1];\n\t\t\t\t\t// Check if prev char is Hebrew (U+0590-U+05FF range)\n\t\t\t\t\tif (prev < '\\u0590' || prev > '\\u05FF') return false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// U+05F4 Hebrew GERSHAYIM: must be preceded by Hebrew letter\n\t\t\t\tif (ch == '\\u05F4')\n\t\t\t\t{\n\t\t\t\t\tif (i == 0) return false;\n\t\t\t\t\tvar prev = label[i - 1];\n\t\t\t\t\t// Check if prev char is Hebrew (U+0590-U+05FF range)\n\t\t\t\t\tif (prev < '\\u0590' || prev > '\\u05FF') return false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// U+30FB KATAKANA MIDDLE DOT: must have Hiragana, Katakana, or Han in the label\n\t\t\t\tif (ch == '\\u30FB')\n\t\t\t\t{\n\t\t\t\t\tbool hasRequiredScript = false;\n\t\t\t\t\tforeach (var c in label)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Hiragana: U+3040-U+309F, Katakana: U+30A0-U+30FF, Han: U+4E00-U+9FFF\n\t\t\t\t\t\tif ((c >= '\\u3040' && c <= '\\u309F') || \n\t\t\t\t\t\t (c >= '\\u30A0' && c <= '\\u30FF') || \n\t\t\t\t\t\t (c >= '\\u4E00' && c <= '\\u9FFF'))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\thasRequiredScript = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!hasRequiredScript) return false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// U+0660-U+0669 Arabic-Indic digits cannot mix with U+06F0-U+06F9 Extended Arabic-Indic\n\t\t\t\tif (ch >= '\\u0660' && ch <= '\\u0669')\n\t\t\t\t{\n\t\t\t\t\tforeach (var c in label)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (c >= '\\u06F0' && c <= '\\u06F9') return false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (ch >= '\\u06F0' && ch <= '\\u06F9')\n\t\t\t\t{\n\t\t\t\t\tforeach (var c in label)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (c >= '\\u0660' && c <= '\\u0669') return false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// U+200D ZERO WIDTH JOINER: must be preceded by Virama\n\t\t\t\tif (ch == '\\u200D')\n\t\t\t\t{\n\t\t\t\t\tif (i == 0) return false;\n\t\t\t\t\tvar prev = label[i - 1];\n\t\t\t\t\t// Virama combining class is 9\n\t\t\t\t\tif (char.GetUnicodeCategory(prev) != System.Globalization.UnicodeCategory.NonSpacingMark ||\n\t\t\t\t\t !IsVirama(prev))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate static bool IsVirama(char ch)\n\t{\n\t\t// Common Virama characters (combining class 9)\n\t\t// This is a simplified check for the most common Viramas\n\t\treturn ch == '\\u094D' || // Devanagari\n\t\t ch == '\\u09CD' || // Bengali\n\t\t ch == '\\u0A4D' || // Gurmukhi\n\t\t ch == '\\u0ACD' || // Gujarati\n\t\t ch == '\\u0B4D' || // Oriya\n\t\t ch == '\\u0BCD' || // Tamil\n\t\t ch == '\\u0C4D' || // Telugu", + "snippet": "return false;\n\t\t\t}\n\n\t\t\t// Check for disallowed starting characters (combining marks)\n\t\t\tif (label.Length > 0)\n\t\t\t{\n\t\t\t\tvar firstChar = label[0];\n\t\t\t\tvar category = char.GetUnicodeCategory(firstChar);\n\t\t\t\t\n\t\t\t\t// Cannot s" + }, + { + "title": "src/JsonSchema/Formats.cs (9/9)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Formats.cs#L961-L1065", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Formats.cs", + "startLine": 961, + "endLine": 1065, + "content": "ch == '\\u0CCD' || // Kannada\n\t\t ch == '\\u0D4D' || // Malayalam\n\t\t ch == '\\u0DCA'; // Sinhala\n\t}\n\n\tprivate static bool CheckIpv4(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar value = node.GetString()!;\n\n\t\t// Must be exactly 4 decimal octets separated by dots\n\t\tvar parts = value.Split('.');\n\t\tif (parts.Length != 4) return false;\n\n\t\tforeach (var part in parts)\n\t\t{\n\t\t\t// Empty part\n\t\t\tif (part.Length == 0) return false;\n\n\t\t\t// Must be 1-3 digits\n\t\t\tif (part.Length > 3) return false;\n\n\t\t\t// Check all characters are ASCII digits\n\t\t\tforeach (var ch in part)\n\t\t\t{\n\t\t\t\tif (ch < '0' || ch > '9') return false;\n\t\t\t}\n\n\t\t\t// No leading zeros (except \"0\" itself)\n\t\t\tif (part.Length > 1 && part[0] == '0') return false;\n\n\t\t\t// Parse and check range 0-255\n\t\t\tif (!int.TryParse(part, NumberStyles.None, CultureInfo.InvariantCulture, out var octet))\n\t\t\t\treturn false;\n\t\t\tif (octet < 0 || octet > 255) return false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate static bool CheckIpv6(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar value = node.GetString()!;\n\n\t\t// Reject zone ID (%) and netmask (/)\n\t\tif (value.IndexOf('%') >= 0 || value.IndexOf('/') >= 0) return false;\n\n\t\tvar actualType = System.Uri.CheckHostName(value);\n\n\t\treturn actualType == UriHostNameType.IPv6;\n\t}\n\n\tprivate static bool CheckDuration(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\treturn Schema.Duration.TryParse(node.GetString()!, out _);\n\t}\n\n\tprivate static bool CheckRegex(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String) return true;\n\n\t\tvar pattern = node.GetString()!;\n\n\t\t// Check for .NET-specific escapes that are not valid in ECMA-262\n\t\t// ECMA-262 valid escapes: b, f, n, r, t, v, 0 (null), x (hex), u (unicode),\n\t\t// c (control), and special regex chars like ., *, +, ?, [, ], {, }, (, ), |, ^, $, \\, /\n\t\t// .NET-specific (invalid in ECMA-262): a (alert), e (escape), A, G, z, Z (anchors)\n\t\tfor (int i = 0; i < pattern.Length - 1; i++)\n\t\t{\n\t\t\tif (pattern[i] == '\\\\')\n\t\t\t{\n\t\t\t\tvar next = pattern[i + 1];\n\t\t\t\t// .NET-specific escapes not in ECMA-262\n\t\t\t\tif (next == 'a' || // alert/bell\n\t\t\t\t next == 'e' || // escape\n\t\t\t\t next == 'A' || // start of string (use ^ in ECMA-262)\n\t\t\t\t next == 'G' || // end of previous match\n\t\t\t\t next == 'z' || // end of string before newline (use $ in ECMA-262) \n\t\t\t\t next == 'Z') // end of string (use $ in ECMA-262)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// \\p and \\P (Unicode property escapes) - these are ES2018+ but .NET ECMAScript mode rejects them\n\t\t\t\t// \\k (named backreference) - ECMA-262 supports this, .NET ECMAScript mode should too\n\t\t\t\t// Lookbehinds (?<=...) and (?...) - ES2018+ but .NET doesn't support in ECMAScript mode\n\t\t\t}\n\t\t}\n\n\t\ttry\n\t\t{\n\t\t\t_ = RegexOrPattern.CreateRegex(pattern, false);\n\t\t\treturn true;\n\t\t}\n\t\tcatch\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}\n}", + "snippet": "ch == '\\u0CCD' || // Kannada\n\t\t ch == '\\u0D4D' || // Malayalam\n\t\t ch == '\\u0DCA'; // Sinhala\n\t}\n\n\tprivate static bool CheckIpv4(JsonElement node)\n\t{\n\t\tif (node.GetSchemaValueType() != SchemaValueType.String" + }, + { + "title": "src/JsonSchema/GeneralExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/GeneralExtensions.cs#L1-L15", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/GeneralExtensions.cs", + "startLine": 1, + "endLine": 15, + "content": "using System;\n\nnamespace Json.Schema;\n\ninternal static class GeneralExtensions\n{\n\tpublic static Uri Resolve(this Uri baseUri, Uri reference)\n\t{\n\t\treturn baseUri.IsFile && reference.OriginalString.StartsWith(\"#\")\n\t\t\t// File URIs have a quirk with fragment-only references\n\t\t\t? new Uri(baseUri.AbsoluteUri + reference)\n\t\t\t// Standard URI resolution works for everything else\n\t\t\t: new Uri(baseUri, reference);\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Schema;\n\ninternal static class GeneralExtensions\n{\n\tpublic static Uri Resolve(this Uri baseUri, Uri reference)\n\t{\n\t\treturn baseUri.IsFile && reference.OriginalString.StartsWith(\"#\")\n\t\t\t// Fi" + }, + { + "title": "src/JsonSchema/IBaseDocument.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/IBaseDocument.cs#L1-L30", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/IBaseDocument.cs", + "startLine": 1, + "endLine": 30, + "content": "using System;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n/// \n/// Represents an identifiable base document that may be or may contain a JSON Schema.\n/// \npublic interface IBaseDocument\n{\n\t/// \n\t/// Gets the base URI that applies to this schema. This may be defined by a parent schema.\n\t/// \n\t/// \n\t/// This property is initialized to a generated random value that matches `https://json-everything.net/{random}`\n\t/// where `random` is 10 hex characters.\n\t///\n\t/// It may change after the initial evaluation based on whether the schema contains an `$id` keyword\n\t/// or is a child of another schema.\n\t/// \n\tUri BaseUri { get; }\n\n\t/// \n\t/// Finds a schema within the document.\n\t/// \n\t/// A JSON Pointer to the location of the schema within the document.\n\t/// Build context.\n\t/// A JSON Schema, if found.\n\tJsonSchemaNode? FindSubschema(JsonPointer pointer, BuildContext context);\n}", + "snippet": "using System;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n/// \n/// Represents an identifiable base document that may be or may contain a JSON Schema.\n/// \npublic interface IBaseDocument\n{\n\t/// \n/// Defines the contract for handling custom JSON Schema keywords, including validation, subschema construction, and\n/// evaluation logic.\n/// \n/// Implementations of this interface enable extensibility for JSON Schema processing by supporting\n/// custom keyword behaviors. Each handler is responsible for validating keyword values, building any required\n/// subschemas, and evaluating the keyword during schema validation. This interface is intended for advanced scenarios\n/// where custom schema keywords are needed.\npublic interface IKeywordHandler\n{\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tstring Name { get; }\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tobject? ValidateKeywordValue(JsonElement value);\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tvoid BuildSubschemas(KeywordData keyword, BuildContext context);\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tKeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context);\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema;\n\n/// \n/// Defines the contract for handling custom JSON Schema keywords, including validation, subschema construction, and\n/// evaluation logic.\n/// \n///" + }, + { + "title": "src/JsonSchema/JsonElementBaseDocument.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonElementBaseDocument.cs#L1-L62", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonElementBaseDocument.cs", + "startLine": 1, + "endLine": 62, + "content": "using System;\nusing System.Collections.Concurrent;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n/// \n/// Provides a general implementation for a .\n/// \npublic class JsonElementBaseDocument : IBaseDocument\n{\n\tprivate readonly JsonElement _root;\n\tprivate readonly ConcurrentDictionary _foundSubschemas;\n\n\t/// \n\t/// Gets the base URI that applies to this schema. This may be defined by a parent schema.\n\t/// \n\tpublic Uri BaseUri { get; }\n\n\t/// \n\t/// Creates a new .\n\t/// \n\t/// The JsonNode.\n\t/// The identifying base URI.\n\tpublic JsonElementBaseDocument(JsonElement node, Uri baseUri)\n\t{\n\t\t_root = node.Clone();\n\t\t_foundSubschemas = new ConcurrentDictionary();\n\n\t\tBaseUri = baseUri;\n\t}\n\n\t/// \n\t/// Finds a schema within the document.\n\t/// \n\t/// A JSON Pointer to the location of the schema within the document.\n\t/// Build context.\n\t/// A JSON Schema, if found.\n#pragma warning disable CS0618 // Type or member is obsolete\n\tpublic JsonSchemaNode? FindSubschema(JsonPointer pointer, BuildContext context)\n\t{\n\t\treturn _foundSubschemas.GetOrAdd(pointer, _ =>\n\t\t{\n\t\t\tvar localSchema = pointer.Evaluate(_root);\n\t\t\tif (localSchema is null) return null;\n\n\t\t\tvar newContext = context with\n\t\t\t{\n\t\t\t\tLocalSchema = localSchema.Value,\n\t\t\t\tBaseUri = BaseUri,\n\t\t\t\tPathFromResourceRoot = pointer\n\t\t\t};\n\t\t\tvar node = JsonSchema.BuildNode(newContext);\n\t\t\tnode.PathFromResourceRoot = pointer;\n\n\t\t\treturn node;\n\t\t});\n#pragma warning restore CS0618 // Type or member is obsolete\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Concurrent;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n/// \n/// Provides a general imple" + }, + { + "title": "src/JsonSchema/JsonElementExtensions.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonElementExtensions.cs#L1-L41", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonElementExtensions.cs", + "startLine": 1, + "endLine": 41, + "content": "using System;\nusing System.Text.Json;\nusing Json.More;\n\nnamespace Json.Schema;\n\n/// \n/// Provides some schema-related functionality for .\n/// \npublic static class JsonElementExtensions\n{\n\t/// \n\t/// Represents a JSON element with the boolean value .\n\t/// \n\tpublic static JsonElement True = true.AsJsonElement();\n\t/// \n\t/// Represents a JSON Boolean value of as a .\n\t/// \n\tpublic static JsonElement False = false.AsJsonElement();\n\n\t/// \n\t/// Provides the JSON Schema type for a value.\n\t/// \n\t/// The node.\n\t/// The of the value.\n\t/// \n\tpublic static SchemaValueType GetSchemaValueType(this JsonElement element) =>\n\t\telement.ValueKind switch\n\t\t{\n\t\t\tJsonValueKind.Object => SchemaValueType.Object,\n\t\t\tJsonValueKind.Array => SchemaValueType.Array,\n\t\t\tJsonValueKind.String => SchemaValueType.String,\n\t\t\tJsonValueKind.Number => JsonMath.IsInteger(element)\n\t\t\t\t? SchemaValueType.Integer\n\t\t\t\t: SchemaValueType.Number,\n\t\t\tJsonValueKind.True => SchemaValueType.Boolean,\n\t\t\tJsonValueKind.False => SchemaValueType.Boolean,\n\t\t\tJsonValueKind.Null => SchemaValueType.Null,\n\t\t\t_ => throw new ArgumentOutOfRangeException(nameof(element.ValueKind), element.ValueKind, null)\n\t\t};\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing Json.More;\n\nnamespace Json.Schema;\n\n/// \n/// Provides some schema-related functionality for .\n/// \npublic static class JsonElementEx" + }, + { + "title": "src/JsonSchema/JsonMath.cs (1/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonMath.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonMath.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema;\n\n/// \n/// Provides static methods for performing mathematical operations and comparisons on JSON numeric values represented by\n/// instances.\n/// \n/// The methods in this class are designed to work directly with the textual representation of JSON\n/// numbers, enabling precise comparison and divisibility checks without converting to .NET numeric types. This is\n/// useful for scenarios where exact JSON number semantics are required, such as schema validation or custom JSON\n/// processing. All methods are thread-safe and do not modify the input instances.\npublic static class JsonMath\n{\n\t/// \n\t/// Compares two JSON number values represented by instances and determines their relative\n\t/// order.\n\t/// \n\t/// This method performs a numeric comparison based on the JSON number representations, handling\n\t/// differences in sign, digit sequence, and exponent. Both parameters must represent valid JSON numbers; otherwise,\n\t/// the result is undefined.\n\t/// The first containing a JSON number to compare.\n\t/// The second containing a JSON number to compare.\n\t/// A signed integer that indicates the relative order of the numbers: less than zero if is less\n\t/// than ; zero if they are equal; greater than zero if is greater than\n\t/// .\n\tpublic static int NumberCompare(JsonElement a, JsonElement b)\n\t{\n\t\tvar aSpan = a.GetRawText().AsSpan();\n\t\tvar bSpan = b.GetRawText().AsSpan();\n\n\tvar (aNeg, aDigitStart, aDigitLen, aExp) = NormalizeNumber(aSpan);\n\tvar (bNeg, bDigitStart, bDigitLen, bExp) = NormalizeNumber(bSpan);\n\n\t// Handle zero values - if either number is zero (digitLen == 0), handle specially\n\tif (aDigitLen == 0 && bDigitLen == 0)\n\t\treturn 0; // both are zero\n\tif (aDigitLen == 0)\n\t\treturn bNeg ? 1 : -1; // a is zero, b is non-zero\n\tif (bDigitLen == 0)\n\t\treturn aNeg ? -1 : 1; // b is zero, a is non-zero\n\n\tif (aNeg != bNeg)\n\t\treturn aNeg ? -1 : 1;\n\n\tint signMultiplier = aNeg ? -1 : 1;\n\n\tif (aExp != bExp)\n\t\treturn aExp > bExp ? signMultiplier : -signMultiplier;\t\tint aIndex = aDigitStart;\n\t\tint bIndex = bDigitStart;\n\t\tint aDigitsCompared = 0;\n\t\tint bDigitsCompared = 0;\n\n\t\tint aEnd = aSpan.Length;\n\t\tint bEnd = bSpan.Length;\n\t\tfor (int i = aDigitStart; i < aSpan.Length; i++)\n\t\t{\n\t\t\tif (aSpan[i] == 'e' || aSpan[i] == 'E')\n\t\t\t{\n\t\t\t\taEnd = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (int i = bDigitStart; i < bSpan.Length; i++)\n\t\t{\n\t\t\tif (bSpan[i] == 'e' || bSpan[i] == 'E')\n\t\t\t{\n\t\t\t\tbEnd = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\twhile (aDigitsCompared < aDigitLen && bDigitsCompared < bDigitLen)\n\t\t{\n\t\t\twhile (aIndex < aEnd && aSpan[aIndex] == '.')\n\t\t\t\taIndex++;\n\t\t\t\n\t\t\twhile (bIndex < bEnd && bSpan[bIndex] == '.')\n\t\t\t\tbIndex++;\n\n\t\t\tif (aIndex >= aEnd || bIndex >= bEnd)\n\t\t\t\tbreak;\n\n\t\t\tchar aChar = aSpan[aIndex];\n\t\t\tchar bChar = bSpan[bIndex];\n\n\t\t\tif (aChar != bChar)\n\t\t\t\treturn aChar > bChar ? signMultiplier : -signMultiplier;\n\n\t\t\taIndex++;\n\t\t\tbIndex++;\n\t\t\taDigitsCompared++;\n\t\t\tbDigitsCompared++;\n\t\t}\n\n\t\tif (aDigitLen != bDigitLen)\n\t\t\treturn aDigitLen > bDigitLen ? signMultiplier : -signMultiplier;\n\n\t\treturn 0;\n\t}\n\n\tprivate static (bool isNegative, int digitStart, int digitLength, int exponent) NormalizeNumber(ReadOnlySpan span)\n\t{\n\t\tbool isNegative = false;\n\t\tint index = 0;\n\n\t\tif (span[index] == '-')\n\t\t{\n\t\t\tisNegative = true;\n\t\t\tindex++;\n\t\t}\n\n\t\tint mantissaEnd = span.Length;\n\t\tfor (int i = index; i < span.Length; i++)\n\t\t{\n\t\t\tif (span[i] == 'e' || span[i] == 'E')\n\t\t\t{\n\t\t\t\tmantissaEnd = i;\n\t\t\t\tbreak;", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema;\n\n/// \n/// Provides static methods for performing mathematical operations and comparisons on JSON numeric values represented by\n/// = '1' && span[i] <= '9')\n\t\t\t{\n\t\t\t\tfirstNonZero = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (firstNonZero == -1)\n\t\t{\n\t\t\treturn (false, index, 0, 0);\n\t\t}\n\n\t\tint exponentValue;\n\t\tif (decimalPos == -1)\n\t\t{\n\t\t\tint digitsAfterFirstNonZero = 0;\n\t\t\tfor (int i = firstNonZero; i < mantissaEnd; i++)\n\t\t\t{\n\t\t\t\tif (span[i] >= '0' && span[i] <= '9')\n\t\t\t\t\tdigitsAfterFirstNonZero++;\n\t\t\t}\n\t\t\texponentValue = digitsAfterFirstNonZero - 1;\n\t\t}\n\t\telse if (firstNonZero < decimalPos)\n\t\t{\n\t\t\tint digitsBeforeDecimal = 0;\n\t\t\tfor (int i = firstNonZero; i < decimalPos; i++)\n\t\t\t{\n\t\t\t\tif (span[i] >= '0' && span[i] <= '9')\n\t\t\t\t\tdigitsBeforeDecimal++;\n\t\t\t}\n\t\t\texponentValue = digitsBeforeDecimal - 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint zerosAfterDecimal = 0;\n\t\t\tfor (int i = decimalPos + 1; i < firstNonZero; i++)\n\t\t\t{\n\t\t\t\tif (span[i] == '0')\n\t\t\t\t\tzerosAfterDecimal++;\n\t\t\t}\n\t\t\texponentValue = -(zerosAfterDecimal + 1);\n\t\t}\n\n\t\tif (mantissaEnd < span.Length)\n\t\t{\n\t\t\tint explicitExp = 0;\n\t\t\tbool expNegative = false;\n\t\t\tint expStart = mantissaEnd + 1;\n\t\t\t\n\t\t\tif (expStart < span.Length && span[expStart] == '-')\n\t\t\t{\n\t\t\t\texpNegative = true;\n\t\t\t\texpStart++;\n\t\t\t}\n\t\t\telse if (expStart < span.Length && span[expStart] == '+')\n\t\t\t{\n\t\t\t\texpStart++;\n\t\t\t}\n\n\t\t\tfor (int i = expStart; i < span.Length; i++)\n\t\t\t{\n\t\t\t\tif (span[i] >= '0' && span[i] <= '9')\n\t\t\t\t\texplicitExp = explicitExp * 10 + (span[i] - '0');\n\t\t\t}\n\n\t\t\tif (expNegative)\n\t\t\t\texplicitExp = -explicitExp;\n\n\t\t\texponentValue += explicitExp;\n\t\t}\n\n\t\tint lastNonZero = -1;\n\t\tfor (int i = mantissaEnd - 1; i >= index; i--)\n\t\t{\n\t\t\tif (span[i] >= '1' && span[i] <= '9')\n\t\t\t{\n\t\t\t\tlastNonZero = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tint significantDigits = 0;\n\t\tfor (int i = firstNonZero; i <= lastNonZero; i++)\n\t\t{\n\t\t\tif (span[i] >= '0' && span[i] <= '9')\n\t\t\t\tsignificantDigits++;\n\t\t}\n\n\t\treturn (isNegative, firstNonZero, significantDigits, exponentValue);\n\t}\n\n\t/// \n\t/// Determines whether the numeric value represented by the specified JSON element is a mathematical integer (i.e.\n\t/// has no fractional part), without converting to a .NET numeric type.\n\t/// \n\t/// \n\t/// Works directly from the JSON text representation so arbitrarily large integers are recognised correctly,\n\t/// avoiding overflow issues that arise when using TryGetInt64.\n\t/// \n\t/// A whose must be\n\t/// .\n\t/// if the value has no fractional part; otherwise .\n\tpublic static bool IsInteger(JsonElement value)", + "snippet": "}\n\t\t}\n\n\t\tint decimalPos = -1;\n\t\tfor (int i = index; i < mantissaEnd; i++)\n\t\t{\n\t\t\tif (span[i] == '.')\n\t\t\t{\n\t\t\t\tdecimalPos = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tint firstNonZero = -1;\n\t\tfor (int i = index; i < mantissaEnd; i++)\n\t\t{\n" + }, + { + "title": "src/JsonSchema/JsonMath.cs (3/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonMath.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonMath.cs", + "startLine": 241, + "endLine": 360, + "content": "{\n\t\tvar span = value.GetRawText().AsSpan();\n\n\t\tvar index = 0;\n\t\tif (index < span.Length && span[index] == '-')\n\t\t\tindex++;\n\n\t\t// Find optional exponent\n\t\tvar mantissaEnd = span.Length;\n\t\tvar expStart = -1;\n\t\tfor (var i = index; i < span.Length; i++)\n\t\t{\n\t\t\tif (span[i] == 'e' || span[i] == 'E')\n\t\t\t{\n\t\t\t\tmantissaEnd = i;\n\t\t\t\texpStart = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Parse exponent value (may be negative)\n\t\tvar exponent = 0;\n\t\tif (expStart >= 0)\n\t\t{\n\t\t\tvar expNeg = false;\n\t\t\tvar ei = expStart;\n\t\t\tif (ei < span.Length && span[ei] == '-')\n\t\t\t{\n\t\t\t\texpNeg = true;\n\t\t\t\tei++;\n\t\t\t}\n\t\t\telse if (ei < span.Length && span[ei] == '+') ei++;\n\t\t\tfor (; ei < span.Length; ei++)\n\t\t\t\texponent = exponent * 10 + (span[ei] - '0');\n\t\t\tif (expNeg) exponent = -exponent;\n\t\t}\n\n\t\t// Find decimal point position within the mantissa\n\t\tvar decimalPos = -1;\n\t\tfor (var i = index; i < mantissaEnd; i++)\n\t\t{\n\t\t\tif (span[i] == '.')\n\t\t\t{\n\t\t\t\tdecimalPos = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (decimalPos == -1)\n\t\t\treturn exponent >= 0;\n\n\t\t// Count fractional digits; a positive exponent shifts the decimal point right\n\t\tvar fractionalDigits = mantissaEnd - decimalPos - 1;\n\t\tif (exponent >= fractionalDigits)\n\t\t\treturn true;\n\n\t\t// Any fractional digit that remains after the exponent shift must be zero\n\t\tvar significantFractionalStart = decimalPos + 1 + exponent;\n\t\tif (significantFractionalStart < decimalPos + 1)\n\t\t\tsignificantFractionalStart = decimalPos + 1;\n\t\tfor (var i = significantFractionalStart; i < mantissaEnd; i++)\n\t\t{\n\t\t\tif (span[i] != '0')\n\t\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/// \n\t/// Determines whether the numeric value represented by the specified JSON element is evenly divisible by the value of\n\t/// another JSON element.\n\t/// \n\t/// Both parameters must represent valid JSON numbers. If the divisor is zero or not a valid number,\n\t/// the method returns false. If the dividend is zero, the method returns true.\n\t/// The JSON element representing the dividend. Must contain a valid numeric value.\n\t/// The JSON element representing the divisor. Must contain a valid numeric value.\n\t/// true if the dividend is evenly divisible by the divisor; otherwise, false.\n\tpublic static bool Divides(JsonElement dividend, JsonElement divisor)\n\t{\n\t\tvar dividendSpan = dividend.GetRawText().AsSpan();\n\t\tvar divisorSpan = divisor.GetRawText().AsSpan();\n\n\t\tvar (_, dividendStart, dividendLen, dividendExp) = NormalizeNumber(dividendSpan);\n\t\tvar (_, divisorStart, divisorLen, divisorExp) = NormalizeNumber(divisorSpan);\n\n\t\tif (divisorLen == 0)\n\t\t\treturn false;\n\n\t\tif (dividendLen == 0)\n\t\t\treturn true;\n\n\t\tSpan dividendDigits = stackalloc byte[dividendLen];\n\t\tSpan divisorDigits = stackalloc byte[divisorLen];\n\n\t\tExtractDigits(dividendSpan, dividendStart, dividendLen, dividendDigits);\n\t\tExtractDigits(divisorSpan, divisorStart, divisorLen, divisorDigits);\n\n\t\tint dividendScale = dividendLen - 1 - dividendExp;\n\t\tint divisorScale = divisorLen - 1 - divisorExp;\n\t\tint scaleDiff = dividendScale - divisorScale;\n\n\t\tif (scaleDiff > 0)\n\t\t{\n\t\t\tSpan extendedDivisor = stackalloc byte[divisorLen + scaleDiff];\n\t\t\tdivisorDigits.CopyTo(extendedDivisor);\n\t\t\textendedDivisor.Slice(divisorLen).Fill(0);\n\t\t\tdivisorDigits = extendedDivisor;\n\t\t\tdivisorLen += scaleDiff;\n\t\t}\n\t\telse if (scaleDiff < 0)\n\t\t{\n\t\t\tSpan extendedDividend = stackalloc byte[dividendLen + (-scaleDiff)];\n\t\t\tdividendDigits.CopyTo(extendedDividend);\n\t\t\textendedDividend.Slice(dividendLen).Fill(0);\n\t\t\tdividendDigits = extendedDividend;\n\t\t\tdividendLen += (-scaleDiff);\n\t\t}\n\n\t\treturn ModuloDigits(dividendDigits.Slice(0, dividendLen), divisorDigits.Slice(0, divisorLen)) == 0;", + "snippet": "{\n\t\tvar span = value.GetRawText().AsSpan();\n\n\t\tvar index = 0;\n\t\tif (index < span.Length && span[index] == '-')\n\t\t\tindex++;\n\n\t\t// Find optional exponent\n\t\tvar mantissaEnd = span.Length;\n\t\tvar expStart = -1;\n\t\tfor (var i =" + }, + { + "title": "src/JsonSchema/JsonMath.cs (4/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonMath.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonMath.cs", + "startLine": 361, + "endLine": 480, + "content": "}\n\n\tprivate static int ModuloDigits(Span dividend, Span divisor)\n\t{\n\t\tulong divisorValue = 0;\n\t\tfor (int i = 0; i < divisor.Length; i++)\n\t\t{\n\t\t\tdivisorValue = divisorValue * 10 + divisor[i];\n\t\t\tif (divisorValue > int.MaxValue)\n\t\t\t\treturn ModuloDigitsLarge(dividend, divisor);\n\t\t}\n\n\t\tif (divisorValue == 0)\n\t\t\treturn -1;\n\n\t\tulong remainder = 0;\n\t\tfor (int i = 0; i < dividend.Length; i++)\n\t\t{\n\t\t\tremainder = (remainder * 10 + dividend[i]) % divisorValue;\n\t\t}\n\n\t\treturn (int)remainder;\n\t}\n\n\tprivate static int ModuloDigitsLarge(Span dividend, Span divisor)\n\t{\n\t\tSpan remainder = stackalloc byte[divisor.Length + 1];\n\t\tint remainderLen = 0;\n\n\t\tfor (int i = 0; i < dividend.Length; i++)\n\t\t{\n\t\t\tremainder[remainderLen++] = dividend[i];\n\n\t\t\twhile (remainderLen > 1 && remainder[0] == 0)\n\t\t\t{\n\t\t\t\tfor (int k = 0; k < remainderLen - 1; k++)\n\t\t\t\t\tremainder[k] = remainder[k + 1];\n\t\t\t\tremainderLen--;\n\t\t\t}\n\n\t\t\twhile (CompareDigits(remainder, remainderLen, divisor) >= 0)\n\t\t\t{\n\t\t\t\tSubtractDigits(remainder, ref remainderLen, divisor);\n\t\t\t}\n\t\t}\n\n\t\tif (IsZero(remainder, remainderLen))\n\t\t\treturn 0;\n\n\t\treturn 1;\n\t}\n\n\tprivate static void ExtractDigits(ReadOnlySpan span, int start, int length, Span output)\n\t{\n\t\tint outputIndex = 0;\n\t\tint digitsExtracted = 0;\n\t\t\n\t\tint end = span.Length;\n\t\tfor (int i = 0; i < span.Length; i++)\n\t\t{\n\t\t\tif (span[i] == 'e' || span[i] == 'E')\n\t\t\t{\n\t\t\t\tend = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = start; i < end && digitsExtracted < length; i++)\n\t\t{\n\t\t\tif (span[i] >= '0' && span[i] <= '9')\n\t\t\t{\n\t\t\t\toutput[outputIndex++] = (byte)(span[i] - '0');\n\t\t\t\tdigitsExtracted++;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static bool IsZero(Span digits, int length)\n\t{\n\t\tfor (int i = 0; i < length; i++)\n\t\t{\n\t\t\tif (digits[i] != 0)\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate static int CompareDigits(Span a, int aLen, Span b)\n\t{\n\t\tint aStart = 0;\n\t\twhile (aStart < aLen && a[aStart] == 0)\n\t\t\taStart++;\n\n\t\tint bStart = 0;\n\t\twhile (bStart < b.Length && b[bStart] == 0)\n\t\t\tbStart++;\n\n\t\tint aSignificant = aLen - aStart;\n\t\tint bSignificant = b.Length - bStart;\n\n\t\tif (aSignificant != bSignificant)\n\t\t\treturn aSignificant.CompareTo(bSignificant);\n\n\t\tfor (int i = 0; i < aSignificant; i++)\n\t\t{\n\t\t\tif (a[aStart + i] != b[bStart + i])\n\t\t\t\treturn a[aStart + i].CompareTo(b[bStart + i]);\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\tprivate static void SubtractDigits(Span a, ref int aLen, Span b)\n\t{\n\t\tint borrow = 0;\n\t\t\n\t\tfor (int i = 0; i < aLen; i++)\n\t\t{\n\t\t\tint aPos = aLen - 1 - i;\n\t\t\tint bPos = b.Length - 1 - i;", + "snippet": "}\n\n\tprivate static int ModuloDigits(Span dividend, Span divisor)\n\t{\n\t\tulong divisorValue = 0;\n\t\tfor (int i = 0; i < divisor.Length; i++)\n\t\t{\n\t\t\tdivisorValue = divisorValue * 10 + divisor[i];\n\t\t\tif (divisorVal" + }, + { + "title": "src/JsonSchema/JsonMath.cs (5/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonMath.cs#L481-L513", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonMath.cs", + "startLine": 481, + "endLine": 513, + "content": "int aVal = a[aPos];\n\t\t\tint bVal = bPos >= 0 ? b[bPos] : 0;\n\t\t\t\n\t\t\tint diff = aVal - bVal - borrow;\n\t\t\t\n\t\t\tif (diff < 0)\n\t\t\t{\n\t\t\t\tdiff += 10;\n\t\t\t\tborrow = 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tborrow = 0;\n\t\t\t}\n\t\t\t\n\t\t\ta[aPos] = (byte)diff;\n\t\t}\n\n\t\twhile (aLen > 0 && a[0] == 0)\n\t\t{\n\t\t\tfor (int k = 0; k < aLen - 1; k++)\n\t\t\t\ta[k] = a[k + 1];\n\t\t\taLen--;\n\t\t}\n\n\t\tif (aLen == 0)\n\t\t{\n\t\t\ta[0] = 0;\n\t\t\taLen = 1;\n\t\t}\n\t}\n}", + "snippet": "int aVal = a[aPos];\n\t\t\tint bVal = bPos >= 0 ? b[bPos] : 0;\n\t\t\t\n\t\t\tint diff = aVal - bVal - borrow;\n\t\t\t\n\t\t\tif (diff < 0)\n\t\t\t{\n\t\t\t\tdiff += 10;\n\t\t\t\tborrow = 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tborrow = 0;\n\t\t\t}\n\t\t\t\n\t\t\ta[aPos] = (byte)d" + }, + { + "title": "src/JsonSchema/JsonSchema.cs (1/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchema.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchema.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Diagnostics.CodeAnalysis;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\nusing Json.Schema.Keywords;\n\n// ReSharper disable LocalizableElement\n\nnamespace Json.Schema;\n\n/// \n/// Represents a JSON Schema.\n/// \n[DebuggerDisplay(\"{ToDebugString()}\")]\n[JsonConverter(typeof(JsonSchemaJsonConverter))]\npublic class JsonSchema : IBaseDocument\n{\n\tprivate readonly BuildOptions _buildOptions;\n\tprivate readonly bool _refIgnoresSiblingKeywords;\n\tprivate bool _resolved;\n\tprivate Dictionary? _discoveredSchemas;\n\n\t/// \n\t/// The `true` schema. Passes all instances.\n\t/// \n\tpublic static readonly JsonSchema True = new(true) { BaseUri = new(\"https://json-schema.org/true\") };\n\n\t/// \n\t/// The `false` schema. Fails all instances.\n\t/// \n\tpublic static readonly JsonSchema False = new(false) { BaseUri = new(\"https://json-schema.org/false\") };\n\n\t/// \n\t/// For boolean schemas, gets the value. Null if the schema isn't a boolean schema.\n\t/// \n\tpublic bool? BoolValue { get; }\n\n\t/// \n\t/// This property is initialized to a generated random value that matches `https://json-everything.lib/{random-guid}`.\n\t///\n\t/// It may change after the initial evaluation based on whether the schema contains an `$id` keyword\n\t/// or is a child of another schema.\n\t/// \n\tpublic Uri BaseUri { get; private set; }\n\n\t/// \n\t/// Gets the root node of the JSON Schema.\n\t/// \n\t/// Use this property to access the top-level schema node, which represents the entry point for\n\t/// traversing or validating the entire schema structure.\n\tpublic JsonSchemaNode Root { get; }\n\n#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.\n\tprivate JsonSchema(bool value)\n\t{\n\t\t_buildOptions = BuildOptions.Default;\n\t\tBoolValue = value;\n\t\tRoot = value ? JsonSchemaNode.True() : JsonSchemaNode.False();\n\t\tBaseUri = Root.BaseUri;\n\t}\n#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.\n\n\tprivate JsonSchema(JsonSchemaNode root, BuildOptions buildOptions, bool refIgnoresSiblingKeywords)\n\t{\n\t\t_buildOptions = buildOptions;\n\t\t_refIgnoresSiblingKeywords = refIgnoresSiblingKeywords;\n\t\tRoot = root;\n\t\tBaseUri = Root.BaseUri;\n\t}\n\n\t/// \n\t/// Loads text from a file and builds a .\n\t/// \n\t/// The filename to load, URL-decoded.\n\t/// (optional) Serializer options.\n\t/// (optional) The base URI for this schema.\n\t/// A new .\n\t/// Could not deserialize a portion of the schema.\n\t/// The filename needs to not be URL-encoded as attempts to encode it.\n\tpublic static JsonSchema FromFile(string fileName, BuildOptions? options = null, Uri? baseUri = null)\n\t{\n\t\tvar text = File.ReadAllText(fileName);\n\t\tbaseUri ??= new Uri(fileName);\n\n\t\treturn FromText(text, options, baseUri);\n\t}\n\n\t/// \n\t/// Builds a from text.\n\t/// \n\t/// The text to parse.\n\t/// (optional) The build options.\n\t/// (optional) The base URI for this schema.\n\t/// (optional) Options for parsing a .\n\t/// A new .\n\t/// Could not deserialize a portion of the schema.\n\tpublic static JsonSchema FromText([StringSyntax(StringSyntaxAttribute.Json)] string jsonText, BuildOptions? buildOptions = null, Uri? baseUri = null, JsonDocumentOptions? jsonOptions = null)\n\t{\n\t\tusing var doc = JsonDocument.Parse(jsonText, jsonOptions ?? default);\n\t\tvar element = doc.RootElement.Clone();\n\t\treturn Build(element, buildOptions, baseUri);\n\t}\n\n\tprivate static Uri GenerateBaseUri() => new($\"https://json-everything.lib/{Guid.NewGuid():N}\");\n\n\t/// \n\t/// Builds a JsonSchema instance from the specified JSON schema root element, applying the provided build options and\n\t/// base URI if specified.\n\t/// \n\t/// The returned schema is registered with the provided or global schema registry. Reference\n\t/// resolution and cycle detection are performed during the build process. The base URI is set on the resulting schema\n\t/// and used for reference resolution.\n\t/// The root JsonElement representing the JSON schema to be parsed and built. Must be a valid JSON schema object.\n\t/// Optional build options that control schema parsing behavior, such as registry usage and dialect settings. If null,", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Diagnostics.CodeAnalysis;\nusing System.IO;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Jso" + }, + { + "title": "src/JsonSchema/JsonSchema.cs (2/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchema.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchema.cs", + "startLine": 121, + "endLine": 240, + "content": "/// default options are used.\n\t/// An optional base URI to associate with the schema for resolving references if the schema does not contain an $id\n\t/// keyword. If null, a default base URI is generated.\n\t/// A JsonSchema instance representing the parsed schema. Returns a singleton schema for boolean schemas ( or ), or a constructed schema for object-based definitions.\n\tpublic static JsonSchema Build(JsonElement root, BuildOptions? options = null, Uri? baseUri = null)\n\t{\n\t\treturn BuildImpl(root, options, baseUri, true);\n\t}\n\n\tinternal static JsonSchema BuildWithoutRegistering(JsonElement root, BuildOptions? options)\n\t{\n\t\treturn BuildImpl(root, options, null, false);\n\t}\n\n\tprivate static JsonSchema BuildImpl(JsonElement root, BuildOptions? options, Uri? baseUri, bool register)\n\t{\n\t\toptions ??= BuildOptions.Default;\n\n\t\tvar context = new BuildContext(options, baseUri ?? GenerateBaseUri(), register)\n\t\t{\n\t\t\tLocalSchema = root\n\t\t};\n\n\t\tvar node = BuildNode(context, true);\n\n\t\tif (node.Source.ValueKind == JsonValueKind.True) return True;\n\t\tif (node.Source.ValueKind == JsonValueKind.False) return False;\n\n\t\tvar schema = new JsonSchema(node, context.Options, context.Dialect.RefIgnoresSiblingKeywords)\n\t\t{\n\t\t\tBaseUri = node.BaseUri\n\t\t};\n\t\tif (register)\n\t\t\tcontext.Options.SchemaRegistry.Register(schema);\n\t\tcontext.BaseUri = node.BaseUri;\n\n\t\tschema._resolved = TryResolveReferences(node, context);\n\t\tDetectCycles(node);\n\n\t\treturn schema;\n\t}\n\n\t/// \n\t/// Builds a new JSON schema node from the specified build context, interpreting the local schema and its keywords\n\t/// according to the active dialect.\n\t/// \n\t/// This method processes schema keywords and handles dialect-specific behaviors, such as anchor\n\t/// registration and embedded resource management. The resulting node reflects the schema's structure and metadata as\n\t/// defined in the context.\n\t/// \n\t/// Use this method from keywords to build subschemas.\n\t///\n\t/// Individual keywords may throw various exceptions during the validation phase.\n\t/// \n\t/// The build context containing the local schema, dialect, base URI, and options used to construct the schema node.\n\t/// Must not be null.\n\t/// A JsonSchemaNode representing the parsed schema, including its keywords and any registered anchors or embedded\n\t/// resources.\n\t/// Thrown if the local schema is not a boolean or an object.\n\tpublic static JsonSchemaNode BuildNode(BuildContext context) => BuildNode(context, false);\n\n\tprivate static JsonSchemaNode BuildNode(BuildContext context, bool isRoot)\n\t{\n\t\tif (context.LocalSchema.ValueKind == JsonValueKind.True)\n\t\t{\n\t\t\tvar trueNode = JsonSchemaNode.True();\n\t\t\ttrueNode.RelativePath = context.RelativePath;\n\t\t\treturn trueNode;\n\t\t}\n\n\t\tif (context.LocalSchema.ValueKind == JsonValueKind.False)\n\t\t{\n\t\t\tvar falseNode = JsonSchemaNode.False();\n\t\t\tfalseNode.RelativePath = context.RelativePath;\n\t\t\treturn falseNode;\n\t\t}\n\n\t\tif (context.LocalSchema.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new ArgumentException($\"Schemas may only booleans or objects. Received {context.LocalSchema.ValueKind}\");\n\n\t\tif (context.LocalSchema.TryGetProperty(\"$schema\", out var dialect))\n\t\t{\n\t\t\tif (!Uri.TryCreate(dialect.GetString(), UriKind.Absolute, out var uri))\n\t\t\t\tthrow new JsonSchemaException(\"$schema value MUST be an absolute IRI\");\n\n\t\t\tcontext.Dialect = context.Options.DialectRegistry.Get(uri, context.Options.SchemaRegistry, context.Options.VocabularyRegistry, context.Dialect);\n\t\t}\n\n\t\tvar allowBaseUriChange = context.LocalSchema.TryGetProperty(\"$ref\", out _) &&\n\t\t context.Dialect.RefIgnoresSiblingKeywords &&\n\t\t !isRoot;\n\n\t\tvar keywordData = new List();\n\t\tvar orderedKeywords = context.LocalSchema\n\t\t\t.EnumerateObject()\n\t\t\t.OrderBy(x => context.Dialect.GetEvaluationOrder(x.Name));\n\t\tforeach (var property in orderedKeywords)\n\t\t{\n\t\t\tvar keyword = property.Name;\n\t\t\tvar value = property.Value;\n\n\t\t\tvar handler = context.Dialect.GetHandler(keyword);\n\n\t\t\tvar data = new KeywordData(context)\n\t\t\t{\n\t\t\t\tEvaluationOrder = context.Dialect.GetEvaluationOrder(keyword) ?? 0,\n\t\t\t\tRawValue = value,\n\t\t\t\tHandler = handler,\n\t\t\t\tValue = handler is AnnotationKeyword\n\t\t\t\t\t? keyword\n\t\t\t\t\t: handler.ValidateKeywordValue(value)\n\t\t\t};\n\t\t\tif (handler is SchemaKeyword) { /* no-op */ }\n\t\t\telse if (handler is IdKeyword && !allowBaseUriChange)\n\t\t\t{\n#pragma warning disable CS0618 // Type or member is obsolete\n\t\t\t\tcontext.PathFromResourceRoot = JsonPointer.Empty;\n\t\t\t\tcontext.BaseUri = context.BaseUri.Resolve((Uri)data.Value!);\n\t\t\t}", + "snippet": "/// default options are used.\n\t/// An optional base URI to associate with the schema for resolving references if the schema does not contain an $id\n\t/// keyword. If null, a default base URI " + }, + { + "title": "src/JsonSchema/JsonSchema.cs (3/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchema.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchema.cs", + "startLine": 241, + "endLine": 360, + "content": "var keywordContext = context with\n\t\t\t{\n\t\t\t\tPathFromResourceRoot = context.PathFromResourceRoot.Combine(context.RelativePath).Combine(keyword)\n\t\t\t};\n\t\t\thandler.BuildSubschemas(data, keywordContext);\n\n\t\t\tforeach (var subschema in data.Subschemas)\n\t\t\t{\n\t\t\t\tsubschema.PathFromResourceRoot = keywordContext.PathFromResourceRoot.Combine(subschema.RelativePath);\n#pragma warning restore CS0618 // Type or member is obsolete\n\t\t\t}\n\n\t\t\tkeywordData.Add(data);\n\t\t}\n\n\t\tvar embeddedResources = keywordData\n\t\t\t.SelectMany(x => x.Subschemas)\n\t\t\t.Where(x => x.BaseUri != context.BaseUri);\n\t\tforeach (var embeddedResource in embeddedResources)\n\t\t{\n\t\t\tif (embeddedResource.BaseUri == True.BaseUri || embeddedResource.BaseUri == False.BaseUri) continue;\n\n\t\t\tvar schema = new JsonSchema(embeddedResource, context.Options, context.Dialect.RefIgnoresSiblingKeywords)\n\t\t\t{\n\t\t\t\tBaseUri = embeddedResource.BaseUri\n\t\t\t};\n\t\t\tif (context.Register)\n\t\t\t\tcontext.Options.SchemaRegistry.Register(schema);\n\t\t}\n\n\t\tvar node = new JsonSchemaNode\n\t\t{\n\t\t\tBaseUri = context.BaseUri,\n\t\t\tSource = context.LocalSchema,\n\t\t\tKeywords = keywordData.OrderBy(x => x.EvaluationOrder).ToArray(),\n\t\t\tRelativePath = context.RelativePath\n\t\t};\n\n\t\tvar oldIdKeyword = keywordData.FirstOrDefault(x => x.Handler is Keywords.Draft06.IdKeyword);\n\t\tif (oldIdKeyword is not null)\n\t\t{\n\t\t\tvar handler = (Keywords.Draft06.IdKeyword)oldIdKeyword.Handler;\n\t\t\tvar uri = (Uri)oldIdKeyword.Value!;\n\t\t\tvar anchor = uri.OriginalString[1..];\n\t\t\tif (uri.OriginalString.StartsWith(\"#\") && handler.AnchorPattern.IsMatch(anchor))\n\t\t\t\tcontext.Options.SchemaRegistry.RegisterAnchor(context.BaseUri, anchor, node);\n\t\t}\n\n\t\tvar anchorKeyword = keywordData.FirstOrDefault(x => x.Handler is AnchorKeyword);\n\t\tif (anchorKeyword is not null)\n\t\t\tcontext.Options.SchemaRegistry.RegisterAnchor(context.BaseUri, (string)anchorKeyword.Value!, node);\n\n\t\tvar dynamicAnchorKeyword = keywordData.FirstOrDefault(x => x.Handler is DynamicAnchorKeyword);\n\t\tif (dynamicAnchorKeyword is not null)\n\t\t\tcontext.Options.SchemaRegistry.RegisterDynamicAnchor(context.BaseUri, (string)dynamicAnchorKeyword.Value!, node);\n\n\t\tvar recursiveAnchorKeyword = keywordData.FirstOrDefault(x => x.Handler is Keywords.Draft201909.RecursiveAnchorKeyword);\n\t\tif (recursiveAnchorKeyword?.Value is true)\n\t\t\tcontext.Options.SchemaRegistry.RegisterRecursiveAnchor(context.BaseUri, node);\n\n\t\treturn node;\n\t}\n\n\tprivate static bool TryResolveReferences(JsonSchemaNode node, BuildContext context, HashSet? checkedNodes = null)\n\t{\n\t\tvar resolved = true;\n\t\tcheckedNodes ??= [];\n\t\tif (!checkedNodes.Add(node)) return resolved;\n\n\t\tvar refKeyword = node.Keywords.SingleOrDefault(x => x.Handler is RefKeyword);\n\t\tif (refKeyword is not null)\n\t\t{\n\t\t\tvar handler = (RefKeyword)refKeyword.Handler;\n\t\t\tresolved &= handler.TryResolve(refKeyword, context);\n\t\t}\n\n\t\tvar dynamicRefKeyword = node.Keywords.SingleOrDefault(x => x.Handler is DynamicRefKeyword);\n\t\tif (dynamicRefKeyword is not null)\n\t\t{\n\t\t\tvar handler = (DynamicRefKeyword)dynamicRefKeyword.Handler;\n\t\t\tresolved &= handler.TryResolve(dynamicRefKeyword, context);\n\t\t}\n\n\t\tforeach (var keyword in node.Keywords)\n\t\t{\n\t\t\tforeach (var subNode in keyword.Subschemas)\n\t\t\t{\n\t\t\t\tvar subschemaContext = context with\n\t\t\t\t{\n\t\t\t\t\tBaseUri = subNode.BaseUri\n\t\t\t\t};\n\t\t\t\tresolved &= TryResolveReferences(subNode, subschemaContext, checkedNodes);\n\t\t\t}\n\t\t}\n\n\t\treturn resolved;\n\t}\n\n\tprivate static void DetectCycles(JsonSchemaNode node, HashSet? checkedNodes = null)\n\t{\n\t\tcheckedNodes ??= [];\n\t\tif (!checkedNodes.Add(node)) return;\n\n\t\tvar foundRefs = new HashSet { node };\n\n\t\tvar refKeyword = node.Keywords.SingleOrDefault(x => x.Handler is RefKeyword);\n\t\twhile (refKeyword is not null)\n\t\t{\n\t\t\tvar nextNode = refKeyword.Subschemas.FirstOrDefault();\n\t\t\tif (nextNode is null) break; // might not have resolved all refs yet\n\n\t\t\tif (!foundRefs.Add(nextNode))\n\t\t\t\tthrow new JsonSchemaException($\"Cycle detected starting with a reference to '{refKeyword.RawValue}'\");\n\n\t\t\trefKeyword = nextNode.Keywords.SingleOrDefault(x => x.Handler is RefKeyword);\n\t\t}\n\n\t\tforeach (var subschema in node.Keywords.SelectMany(x => x.Subschemas))\n\t\t{", + "snippet": "var keywordContext = context with\n\t\t\t{\n\t\t\t\tPathFromResourceRoot = context.PathFromResourceRoot.Combine(context.RelativePath).Combine(keyword)\n\t\t\t};\n\t\t\thandler.BuildSubschemas(data, keywordContext);\n\n\t\t\tforeach (var subsc" + }, + { + "title": "src/JsonSchema/JsonSchema.cs (4/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchema.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchema.cs", + "startLine": 361, + "endLine": 480, + "content": "DetectCycles(subschema, checkedNodes);\n\t\t}\n\t}\n\n\t/// \n\t/// Evaluates the specified JSON instance against the schema and returns the results.\n\t/// \n\t/// The JSON data to be evaluated against the schema.\n\t/// (Optional) Evaluation settings that control validation behavior. If null, default options are used.\n\t/// An EvaluationResults object containing the outcome of the schema validation, including any errors or annotations.\n\tpublic EvaluationResults Evaluate(JsonElement instance, EvaluationOptions? options = null)\n\t{\n\t\tif (!_resolved)\n\t\t{\n\t\t\tvar buildContext = new BuildContext(_buildOptions, BaseUri, true)\n\t\t\t{\n\t\t\t\tLocalSchema = Root.Source\n\t\t\t};\n\t\t\t_resolved = TryResolveReferences(Root, buildContext);\n\t\t}\n\t\t// Let the normal RefResolutionException happen through evaluation if not resolved.\n\n\t\toptions ??= EvaluationOptions.Default;\n\t\tvar context = new EvaluationContext\n\t\t{\n\t\t\tOptions = options,\n\t\t\tSchemaRegistry = _buildOptions.SchemaRegistry,\n\t\t\tRefIgnoresSiblingKeywords = _refIgnoresSiblingKeywords,\n\t\t\tInstanceRoot = instance,\n\t\t\tInstance = instance,\n\t\t\tEvaluationPath = JsonPointer.Empty,\n\t\t\tScope = new(BaseUri),\n\t\t\tCanOptimize = options.OutputFormat == OutputFormat.Flag,\n\t\t\tEvaluatedNodes = new()\n\t\t};\n\n\t\tvar results = Root.Evaluate(context);\n\t\tswitch (options.OutputFormat)\n\t\t{\n\t\t\tcase OutputFormat.Flag:\n\t\t\t\tresults.ToFlag();\n\t\t\t\tbreak;\n\t\t\tcase OutputFormat.List:\n\t\t\t\tresults.ToList();\n\t\t\t\tbreak;\n\t\t\tcase OutputFormat.Hierarchical:\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new ArgumentOutOfRangeException(\"options.OutputFormat\");\n\t\t}\n\n\t\treturn results;\n\t}\n\n\t/// \n\t/// Finds the subschema node within the root schema that corresponds to the specified JSON pointer.\n\t/// \n\t/// The JSON pointer indicating the location of the subschema to find within the root schema.\n\t/// The build context used for schema evaluation and node construction if the subschema is not found directly.\n\t/// A representing the subschema at the specified pointer, or if no\n\t/// matching subschema exists.\n\tpublic JsonSchemaNode? FindSubschema(JsonPointer pointer, BuildContext context)\n\t{\n\t\tvar subschema = _discoveredSchemas?.GetValueOrDefault(pointer);\n\t\tif (subschema is not null) return subschema;\n\n\t\tsubschema = Root;\n\t\tvar currentPointer = pointer;\n\t\twhile (currentPointer.SegmentCount != 0)\n\t\t{\n\t\t\tvar keyword = subschema.Keywords.FirstOrDefault(x => currentPointer.StartsWith(JsonPointer.Create(x.Handler.Name)));\n\t\t\tif (keyword is null)\n\t\t\t{\n\t\t\t\tsubschema = null;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcurrentPointer = currentPointer.GetLocal(currentPointer.SegmentCount - 1);\n\n\t\t\tsubschema = keyword.Subschemas.FirstOrDefault(x => currentPointer.StartsWith(x.RelativePath));\n\t\t\tif (subschema is null) break;\n\n\t\t\tcurrentPointer = currentPointer.GetLocal(currentPointer.SegmentCount - subschema.RelativePath.SegmentCount);\n\t\t}\n\n\t\tif (subschema == null)\n\t\t{\n\t\t\tvar localSchema = pointer.Evaluate(Root.Source);\n\t\t\tif (localSchema.HasValue)\n\t\t\t{\n\t\t\t\tvar newContext = context with\n\t\t\t\t{\n\t\t\t\t\tBaseUri = BaseUri,\n\t\t\t\t\tLocalSchema = localSchema.Value,\n#pragma warning disable CS0618 // Type or member is obsolete\n\t\t\t\t\tPathFromResourceRoot = pointer\n\t\t\t\t};\n\t\t\t\tsubschema = BuildNode(newContext);\n\t\t\t\tsubschema.PathFromResourceRoot = pointer;\n#pragma warning restore CS0618 // Type or member is obsolete\n\t\t\t}\n\t\t}\n\n\t\tif (subschema is not null)\n\t\t{\n\t\t\t_discoveredSchemas ??= [];\n\t\t\t_discoveredSchemas[pointer] = subschema;\n\t\t}\n\n\t\treturn subschema;\n\t}\n\n\t/// \n\t/// Implicitly converts a boolean value into one of the boolean schemas. \n\t/// \n\t/// The boolean value.\n\tpublic static implicit operator JsonSchema(bool value)\n\t{\n\t\treturn value ? True : False;\n\t}", + "snippet": "DetectCycles(subschema, checkedNodes);\n\t\t}\n\t}\n\n\t/// \n\t/// Evaluates the specified JSON instance against the schema and returns the results.\n\t/// \n\t/// The JSON data to be evaluat" + }, + { + "title": "src/JsonSchema/JsonSchema.cs (5/5)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchema.cs#L481-L535", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchema.cs", + "startLine": 481, + "endLine": 535, + "content": "private string ToDebugString()\n\t{\n\t\tif (BoolValue.HasValue) return BoolValue.Value ? \"true\" : \"false\";\n\n\t\tvar idKeyword = Root.Keywords.SingleOrDefault(x => x.Handler is IdKeyword);\n\t\treturn idKeyword?.RawValue.GetString() ?? BaseUri.OriginalString;\n\t}\n}\n\n/// \n/// Provides custom serialization and deserialization logic for objects when using\n/// System.Text.Json.\n/// \n/// Use this converter to enable reading and writing of instances with\n/// System.Text.Json. This converter handles the mapping between JSON schema representations and objects, ensuring correct parsing and formatting during serialization operations.\npublic class JsonSchemaJsonConverter : JsonConverter\n{\n\t/// \n\t/// Deserializes a JSON value from the specified reader into a instance.\n\t/// \n\t/// The positioned at the JSON value to read. The reader must be at the start of a valid\n\t/// JSON schema object.\n\t/// The type to convert the JSON value to. This parameter is ignored; the method always returns a .\n\t/// The serializer options to use when reading the JSON value. Must not be .\n\t/// A instance representing the deserialized schema, or if the JSON\n\t/// value is not a valid schema.\n\t/// Thrown when the JSON value cannot be deserialized into a valid . See the inner exception\n\t/// for details.\n\tpublic override JsonSchema? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar element = options.Read(ref reader, JsonSchemaSerializerContext.Default.JsonElement);\n\t\ttry\n\t\t{\n\t\t\treturn JsonSchema.Build(element);\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tthrow new JsonException(\"An error occurred while deserializing a schema. See inner exception for details.\", e);\n\t\t}\n\t}\n\n\t/// \n\t/// Writes the specified JSON schema to the provided writer using the given serializer options.\n\t/// \n\t/// The writer to which the JSON schema will be written. Must not be null.\n\t/// The JSON schema to write. Must not be null.\n\t/// The serializer options to use when writing the JSON schema. Must not be null.\n\tpublic override void Write(Utf8JsonWriter writer, JsonSchema value, JsonSerializerOptions options)\n\t{\n\t\toptions.Write(writer, value.Root.Source, JsonSchemaSerializerContext.Default.JsonElement);\n\t}\n}", + "snippet": "private string ToDebugString()\n\t{\n\t\tif (BoolValue.HasValue) return BoolValue.Value ? \"true\" : \"false\";\n\n\t\tvar idKeyword = Root.Keywords.SingleOrDefault(x => x.Handler is IdKeyword);\n\t\treturn idKeyword?.RawValue.GetString" + }, + { + "title": "src/JsonSchema/JsonSchemaBuilder.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaBuilder.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaBuilder.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema;\n\n/// \n/// A fluent-style builder for .\n/// \npublic class JsonSchemaBuilder\n{\n\tprivate readonly BuildOptions? _buildOptions;\n\tprivate readonly bool _readOnly;\n\tinternal readonly JsonNode Keywords = new JsonObject();\n\n\t/// \n\t/// Gets an instance of that represents an empty JSON schema.\n\t/// \n\t/// Use this property to obtain a schema with no defined constraints or properties. This can be useful\n\t/// as a starting point for building more complex schemas or when a schema is required but no validation is\n\t/// needed.\n\tpublic static JsonSchemaBuilder Empty { get; } = new(new JsonObject());\n\n\t/// \n\t/// Gets a schema builder that creates a schema which always validates as .\n\t/// \n\t/// Use this property to obtain a schema that unconditionally accepts any JSON value. This is\n\t/// equivalent to a schema defined as true in JSON Schema specifications.\n\tpublic static JsonSchemaBuilder True { get; } = new(true);\n\n\t/// \n\t/// Gets a schema builder that always evaluates to false, representing a schema that does not match any JSON value.\n\t/// \n\t/// Use this property to create a schema that explicitly rejects all input. This can be useful for\n\t/// disabling or invalidating parts of a schema in compositional scenarios.\n\tpublic static JsonSchemaBuilder False { get; } = new(false);\n\n\t/// \n\t/// Initializes a new instance of the JsonSchemaBuilder class.\n\t/// \n\t/// Use this constructor to create a new JsonSchemaBuilder for defining and constructing JSON schema\n\t/// objects. The builder can be configured with various schema properties and constraints before generating the final\n\t/// schema.\n\tpublic JsonSchemaBuilder(BuildOptions? buildOptions = null)\n\t{\n\t\t_buildOptions = buildOptions;\n\t}\n\n\tprivate JsonSchemaBuilder(JsonNode value)\n\t{\n\t\tKeywords = value;\n\t\t_readOnly = true;\n\t}\n\n\t/// \n\t/// Adds a new keyword with a value.\n\t/// \n\t/// The keyword to add.\n\t/// The value.\n\tpublic void Add(string keyword, JsonNode? value)\n\t{\n\t\tif (_readOnly)\n\t\t\tthrow new InvalidOperationException(\"Cannot edit the static builders.\");\n\n\t\tKeywords[keyword] = value;\n\t}\n\n\t/// \n\t/// Adds a new keyword with a nested schema.\n\t/// \n\t/// The keyword to add.\n\t/// Another builder.\n\tpublic void Add(string keyword, JsonSchemaBuilder builder)\n\t{\n\t\tif (_readOnly)\n\t\t\tthrow new InvalidOperationException(\"Cannot edit the static builders.\");\n\n\t\tKeywords[keyword] = builder.Keywords.DeepClone();\n\t}\n\n\t/// \n\t/// Adds a new keyword with a nested schema.\n\t/// \n\t/// The keyword to add.\n\t/// Another builder.\n\tpublic void Add(string keyword, IEnumerable builders)\n\t{\n\t\tif (_readOnly)\n\t\t\tthrow new InvalidOperationException(\"Cannot edit the static builders.\");\n\n\t\tKeywords[keyword] = new JsonArray(builders.Select(x => (JsonNode?)x.Keywords.DeepClone()).ToArray());\n\t}\n\n\t/// \n\t/// Adds a new keyword with a nested schema.\n\t/// \n\t/// The keyword to add.\n\t/// Another builder.\n\tpublic void Add(string keyword, IEnumerable<(string, JsonSchemaBuilder)> builders)\n\t{\n\t\tif (_readOnly)\n\t\t\tthrow new InvalidOperationException(\"Cannot edit the static builders.\");\n\n\t\tKeywords[keyword] = new JsonObject(builders.ToDictionary(x => x.Item1, x => (JsonNode?)x.Item2.Keywords.DeepClone()));\n\t}\n\n\t/// \n\t/// Adds a new keyword with a nested schema.\n\t/// \n\t/// The keyword to add.\n\t/// Another builder.\n\tpublic void Add(string keyword, IEnumerable> builders)\n\t{\n\t\tif (_readOnly)\n\t\t\tthrow new InvalidOperationException(\"Cannot edit the static builders.\");\n\n\t\tKeywords[keyword] = new JsonObject(builders.ToDictionary(x => x.Key, x => (JsonNode?)x.Value.Keywords.DeepClone()));\n\t}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\n\nnamespace Json.Schema;\n\n/// \n/// A fluent-style builder for .\n///" + }, + { + "title": "src/JsonSchema/JsonSchemaBuilder.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaBuilder.cs#L121-L179", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaBuilder.cs", + "startLine": 121, + "endLine": 179, + "content": "/// \n\t/// Creates a new .\n\t/// \n\t/// A JSON Schema that simply refers back to the root schema.\n\tpublic static JsonSchemaBuilder RefRoot()\n\t{\n\t\treturn new JsonSchemaBuilder().Ref(new Uri(\"#\", UriKind.RelativeOrAbsolute));\n\t}\n\n\t/// \n\t/// Creates a new .\n\t/// \n\t/// A JSON Schema that simply refers back to the recursive root schema.\n\tpublic static JsonSchemaBuilder RecursiveRefRoot()\n\t{\n\t\treturn new JsonSchemaBuilder().RecursiveRef(new Uri(\"#\", UriKind.RelativeOrAbsolute));\n\t}\n\n\t/// \n\t/// Builds a JSON schema from the configured keywords and returns a corresponding instance.\n\t/// \n\t/// (Optional) Build options that control schema generation behavior. Overrides build options\n\t/// passed into the constructor.\n\t/// (Optional) A base URI to associate with the generated schema. If specified, it is used to resolve relative\n\t/// references within the schema.\n\t/// A instance representing the constructed schema based on the provided options and base URI.\n\tpublic JsonSchema Build(BuildOptions? options = null, Uri? baseUri = null)\n\t{\n\t\tvar root = JsonSerializer.SerializeToElement(Keywords, JsonSchemaSerializerContext.Default.JsonNode);\n\n\t\treturn JsonSchema.Build(root, options ?? _buildOptions, baseUri);\n\t}\n\n\tinternal JsonSchema BuildWithoutRegistering(BuildOptions? options = null)\n\t{\n\t\tvar root = JsonSerializer.SerializeToElement(Keywords, JsonSchemaSerializerContext.Default.JsonNode);\n\n\t\treturn JsonSchema.BuildWithoutRegistering(root, options ?? _buildOptions);\n\t}\n\n\t/// \n\t/// For convenience, implicitly calls .\n\t/// \n\t/// A .\n\tpublic static implicit operator JsonSchema(JsonSchemaBuilder builder)\n\t{\n\t\treturn builder.Build();\n\t}\n\n\t/// \n\t/// Defines an implicit conversion from a Boolean value to a JsonSchemaBuilder representing either the 'true' or\n\t/// 'false' JSON Schema.\n\t/// \n\t/// A Boolean value indicating whether to create a schema that always validates () or never\n\t/// validates ().\n\tpublic static implicit operator JsonSchemaBuilder(bool schema) => schema ? True : False;\n}", + "snippet": "/// \n\t/// Creates a new .\n\t/// \n\t/// A JSON Schema that simply refers back to the root schema.\n\tpublic static JsonSchemaBuilder RefRoot()\n\t{\n\t\treturn new Json" + }, + { + "title": "src/JsonSchema/JsonSchemaBuilderExtensions.cs (1/10)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaBuilderExtensions.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaBuilderExtensions.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\n/// \n/// Provides a fluent interface for .\n/// \npublic static class JsonSchemaBuilderExtensions\n{\n\t/// \n\t/// Add an `additionalItems` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `additionalItems`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder AdditionalItems(this JsonSchemaBuilder builder, JsonSchemaBuilder schema)\n\t{\n\t\tbuilder.Add(\"additionalItems\", schema);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `additionalProperties` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `additionalProperties`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder AdditionalProperties(this JsonSchemaBuilder builder, JsonSchemaBuilder schema)\n\t{\n\t\tbuilder.Add(\"additionalProperties\", schema);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `allOf` keyword.\n\t/// \n\t/// The builder.\n\t/// The schemas for `allOf`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder AllOf(this JsonSchemaBuilder builder, params JsonSchemaBuilder[] schemas)\n\t{\n\t\tbuilder.Add(\"allOf\", schemas);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `allOf` keyword.\n\t/// \n\t/// The builder.\n\t/// The schemas for `allOf`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder AllOf(this JsonSchemaBuilder builder, IEnumerable schemas)\n\t{\n\t\tbuilder.Add(\"allOf\", schemas);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `$anchor` keyword.\n\t/// \n\t/// The builder.\n\t/// The anchor reference.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Anchor(this JsonSchemaBuilder builder, string reference)\n\t{\n\t\tbuilder.Add(\"$anchor\", reference);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `anyOf` keyword.\n\t/// \n\t/// The builder.\n\t/// The schemas for `anyOf`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder AnyOf(this JsonSchemaBuilder builder, params JsonSchemaBuilder[] schemas)\n\t{\n\t\tbuilder.Add(\"anyOf\", schemas);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `anyOf` keyword.\n\t/// \n\t/// The builder.\n\t/// The schemas for `anyOf`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder AnyOf(this JsonSchemaBuilder builder, IEnumerable schemas)\n\t{\n\t\tbuilder.Add(\"anyOf\", schemas);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `$comment` keyword.\n\t/// \n\t/// The builder.\n\t/// The comment.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Comment(this JsonSchemaBuilder builder, string comment)\n\t{\n\t\tbuilder.Add(\"$comment\", comment);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `const` keyword.\n\t/// \n\t/// The builder.\n\t/// The constant value.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Const(this JsonSchemaBuilder builder, JsonNode? node)\n\t{", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.RegularExpressions;\nusing Json.Schema.Keyw" + }, + { + "title": "src/JsonSchema/JsonSchemaBuilderExtensions.cs (2/10)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaBuilderExtensions.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaBuilderExtensions.cs", + "startLine": 121, + "endLine": 240, + "content": "builder.Add(\"const\", node);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `contains` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `contains`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Contains(this JsonSchemaBuilder builder, JsonSchemaBuilder schema)\n\t{\n\t\tbuilder.Add(\"contains\", schema);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `default` keyword.\n\t/// \n\t/// The builder.\n\t/// The value.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Default(this JsonSchemaBuilder builder, JsonNode? node)\n\t{\n\t\tbuilder.Add(\"default\", node);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `definitions` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema definition map.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Definitions(this JsonSchemaBuilder builder, IReadOnlyDictionary defs)\n\t{\n\t\tbuilder.Add(\"definitions\", defs);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `definitions` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema definition map.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Definitions(this JsonSchemaBuilder builder, params (string name, JsonSchemaBuilder schema)[] defs)\n\t{\n\t\tbuilder.Add(\"definitions\", defs);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `$defs` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema definition map.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Defs(this JsonSchemaBuilder builder, IReadOnlyDictionary defs)\n\t{\n\t\tbuilder.Add(\"$defs\", defs);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `$defs` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema definition map.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Defs(this JsonSchemaBuilder builder, params (string name, JsonSchemaBuilder schema)[] defs)\n\t{\n\t\tbuilder.Add(\"$defs\", defs);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `dependencies` keyword.\n\t/// \n\t/// The builder.\n\t/// The dependencies.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Dependencies(this JsonSchemaBuilder builder, IReadOnlyDictionary deps)\n\t{\n\t\tbuilder.Add(\"dependencies\", new JsonObject(deps\n\t\t\t.ToDictionary(x => x.Key,\n\t\t\t\tx => x.Value.Requirements is not null\n\t\t\t\t\t? JsonSerializer.SerializeToNode(x.Value.Requirements, JsonSchemaSerializerContext.Default.StringArray)\n\t\t\t\t\t: x.Value.Schema!.Keywords.DeepClone())));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `dependencies` keyword.\n\t/// \n\t/// The builder.\n\t/// The dependencies.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Dependencies(this JsonSchemaBuilder builder, params (string name, SchemaOrPropertyList dep)[] deps)\n\t{\n\t\tbuilder.Add(\"dependencies\", new JsonObject(deps\n\t\t\t.ToDictionary(x => x.name,\n\t\t\t\tx => x.dep.Requirements is not null\n\t\t\t\t\t? JsonSerializer.SerializeToNode(x.dep.Requirements, JsonSchemaSerializerContext.Default.StringArray)\n\t\t\t\t\t: x.dep.Schema!.Keywords.DeepClone())));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `dependentRequired` keyword.\n\t/// \n\t/// The builder.\n\t/// The dependencies.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder DependentRequired(this JsonSchemaBuilder builder, IReadOnlyDictionary> deps)\n\t{\n\t\tbuilder.Add(\"dependentRequired\", new JsonObject(deps.ToDictionary(x => x.Key, x => (JsonNode?)new JsonArray(x.Value.Select(v => (JsonNode?)v).ToArray()))));\n\t\treturn builder;\n\t}", + "snippet": "builder.Add(\"const\", node);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `contains` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `contains`.\n\t/// Add a `dependentRequired` keyword.\n\t/// \n\t/// The builder.\n\t/// The dependencies.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder DependentRequired(this JsonSchemaBuilder builder, params (string name, IEnumerable properties)[] deps)\n\t{\n\t\tbuilder.Add(\"dependentRequired\", new JsonObject(deps.ToDictionary(x => x.name, x => (JsonNode?)new JsonArray(x.properties.Select(v => (JsonNode?)v).ToArray()))));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `dependentSchemas` keyword.\n\t/// \n\t/// The builder.\n\t/// The dependencies.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder DependentSchemas(this JsonSchemaBuilder builder, IReadOnlyDictionary deps)\n\t{\n\t\tbuilder.Add(\"dependentSchemas\", deps);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `dependentSchemas` keyword.\n\t/// \n\t/// The builder.\n\t/// The dependencies.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder DependentSchemas(this JsonSchemaBuilder builder, params (string name, JsonSchemaBuilder schema)[] deps)\n\t{\n\t\tbuilder.Add(\"dependentSchemas\", deps);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `deprecated` keyword.\n\t/// \n\t/// The builder.\n\t/// Whether the schema is deprecated.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Deprecated(this JsonSchemaBuilder builder, bool deprecated)\n\t{\n\t\tbuilder.Add(\"deprecated\", (JsonNode)deprecated);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `description` keyword.\n\t/// \n\t/// The builder.\n\t/// The description.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Description(this JsonSchemaBuilder builder, string description)\n\t{\n\t\tbuilder.Add(\"description\", description);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `$dynamicAnchor` keyword.\n\t/// \n\t/// The builder.\n\t/// The anchor reference.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder DynamicAnchor(this JsonSchemaBuilder builder, string reference)\n\t{\n\t\tbuilder.Add(\"$dynamicAnchor\", reference);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `$dynamicRef` keyword.\n\t/// \n\t/// The builder.\n\t/// The URI reference.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder DynamicRef(this JsonSchemaBuilder builder, Uri reference)\n\t{\n\t\tbuilder.Add(\"$dynamicRef\", reference.OriginalString);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `$dynamicRef` keyword.\n\t/// \n\t/// The builder.\n\t/// The URI reference.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder DynamicRef(this JsonSchemaBuilder builder, string reference)\n\t{\n\t\tbuilder.Add(\"$dynamicRef\", reference);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `else` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `else`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Else(this JsonSchemaBuilder builder, JsonSchemaBuilder schema)\n\t{\n\t\tbuilder.Add(\"else\", schema);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `enum` keyword.\n\t/// \n\t/// The builder.\n\t/// The values for the enum.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Enum(this JsonSchemaBuilder builder, IEnumerable elements)\n\t{\n\t\tbuilder.Add(\"enum\", new JsonArray(elements.Select(x => x?.DeepClone()).ToArray()));\n\t\treturn builder;\n\t}", + "snippet": "/// \n\t/// Add a `dependentRequired` keyword.\n\t/// \n\t/// The builder.\n\t/// The dependencies.\n\t/// The builder.\n\tpublic static " + }, + { + "title": "src/JsonSchema/JsonSchemaBuilderExtensions.cs (4/10)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaBuilderExtensions.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaBuilderExtensions.cs", + "startLine": 361, + "endLine": 480, + "content": "/// \n\t/// Add an `enum` keyword.\n\t/// \n\t/// The builder.\n\t/// The values for the enum.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Enum(this JsonSchemaBuilder builder, params JsonNode?[] elements)\n\t{\n\t\tbuilder.Add(\"enum\", new JsonArray(elements.Select(x => x?.DeepClone()).ToArray()));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `enum` keyword.\n\t/// \n\t/// The builder.\n\t/// The values for the enum.\n\t/// The builder.\n\t/// \n\t/// This overload is provided as a convenience as string-only enums are most common.\n\t/// \n\tpublic static JsonSchemaBuilder Enum(this JsonSchemaBuilder builder, IEnumerable elements)\n\t{\n\t\tbuilder.Add(\"enum\", new JsonArray(elements.Select(x => (JsonNode?)x).ToArray()));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `examples` keyword.\n\t/// \n\t/// The builder.\n\t/// The example values.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Examples(this JsonSchemaBuilder builder, IEnumerable elements)\n\t{\n\t\tbuilder.Add(\"examples\", new JsonArray(elements.Select(x => x?.DeepClone()).ToArray()));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `examples` keyword.\n\t/// \n\t/// The builder.\n\t/// The example values.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Examples(this JsonSchemaBuilder builder, params JsonNode?[] elements)\n\t{\n\t\tbuilder.Add(\"examples\", new JsonArray(elements.Select(x => x?.DeepClone()).ToArray()));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `exclusiveMaximum` keyword.\n\t/// \n\t/// The builder.\n\t/// The max value.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder ExclusiveMaximum(this JsonSchemaBuilder builder, decimal max)\n\t{\n\t\tbuilder.Add(\"exclusiveMaximum\", max);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `exclusiveMinimum` keyword.\n\t/// \n\t/// The builder.\n\t/// The min value.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder ExclusiveMinimum(this JsonSchemaBuilder builder, decimal min)\n\t{\n\t\tbuilder.Add(\"exclusiveMinimum\", min);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `format` keyword.\n\t/// \n\t/// The builder.\n\t/// The format.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Format(this JsonSchemaBuilder builder, string format)\n\t{\n\t\tbuilder.Add(\"format\", format);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `format` keyword.\n\t/// \n\t/// The builder.\n\t/// The format.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Format(this JsonSchemaBuilder builder, Format format)\n\t{\n\t\tbuilder.Add(\"format\", format.Key);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `$id` keyword.\n\t/// \n\t/// The builder.\n\t/// The ID.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Id(this JsonSchemaBuilder builder, Uri id)\n\t{\n\t\tbuilder.Add(\"$id\", id.OriginalString);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `$id` keyword.\n\t/// \n\t/// The builder.\n\t/// The ID.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Id(this JsonSchemaBuilder builder, string id)\n\t{\n\t\tbuilder.Add(\"$id\", id);", + "snippet": "/// \n\t/// Add an `enum` keyword.\n\t/// \n\t/// The builder.\n\t/// The values for the enum.\n\t/// The builder.\n\tpublic static J" + }, + { + "title": "src/JsonSchema/JsonSchemaBuilderExtensions.cs (5/10)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaBuilderExtensions.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaBuilderExtensions.cs", + "startLine": 481, + "endLine": 600, + "content": "return builder;\n\t}\n\n\t/// \n\t/// Add an `if` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `if`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder If(this JsonSchemaBuilder builder, JsonSchemaBuilder schema)\n\t{\n\t\tbuilder.Add(\"if\", schema);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a single-schema `items` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `items`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Items(this JsonSchemaBuilder builder, JsonSchemaBuilder schema)\n\t{\n\t\tbuilder.Add(\"items\", schema);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a schema-array `items` keyword.\n\t/// \n\t/// The builder.\n\t/// The schemas for `items`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Items(this JsonSchemaBuilder builder, IEnumerable schemas)\n\t{\n\t\tbuilder.Add(\"items\", schemas);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `maxContains` keyword.\n\t/// \n\t/// The builder.\n\t/// The max number of expected matches.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder MaxContains(this JsonSchemaBuilder builder, uint value)\n\t{\n\t\tbuilder.Add(\"maxContains\", value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `maximum` keyword.\n\t/// \n\t/// The builder.\n\t/// The max value.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Maximum(this JsonSchemaBuilder builder, decimal value)\n\t{\n\t\tbuilder.Add(\"maximum\", value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `maxItems` keyword.\n\t/// \n\t/// The builder.\n\t/// The max number of expected items.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder MaxItems(this JsonSchemaBuilder builder, uint value)\n\t{\n\t\tbuilder.Add(\"maxItems\", value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `maxLength` keyword.\n\t/// \n\t/// The builder.\n\t/// The max string length.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder MaxLength(this JsonSchemaBuilder builder, uint value)\n\t{\n\t\tbuilder.Add(\"maxLength\", value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `maxProperties` keyword.\n\t/// \n\t/// The builder.\n\t/// The max number of expected properties.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder MaxProperties(this JsonSchemaBuilder builder, uint value)\n\t{\n\t\tbuilder.Add(\"maxProperties\", value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `minContains` keyword.\n\t/// \n\t/// The builder.\n\t/// The min number of expected matches.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder MinContains(this JsonSchemaBuilder builder, uint value)\n\t{\n\t\tbuilder.Add(\"minContains\", value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `minimum` keyword.\n\t/// \n\t/// The builder.\n\t/// The min value.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Minimum(this JsonSchemaBuilder builder, decimal value)\n\t{\n\t\tbuilder.Add(\"minimum\", value);", + "snippet": "return builder;\n\t}\n\n\t/// \n\t/// Add an `if` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `if`.\n\t/// The builder.\n\tpu" + }, + { + "title": "src/JsonSchema/JsonSchemaBuilderExtensions.cs (6/10)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaBuilderExtensions.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaBuilderExtensions.cs", + "startLine": 601, + "endLine": 720, + "content": "return builder;\n\t}\n\n\t/// \n\t/// Add a `minItems` keyword.\n\t/// \n\t/// The builder.\n\t/// The min number of expected items.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder MinItems(this JsonSchemaBuilder builder, uint value)\n\t{\n\t\tbuilder.Add(\"minItems\", value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `minLength` keyword.\n\t/// \n\t/// The builder.\n\t/// The min string length.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder MinLength(this JsonSchemaBuilder builder, uint value)\n\t{\n\t\tbuilder.Add(\"minLength\", value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `minProperties` keyword.\n\t/// \n\t/// The builder.\n\t/// The min number of expected properties.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder MinProperties(this JsonSchemaBuilder builder, uint value)\n\t{\n\t\tbuilder.Add(\"minProperties\", value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `multipleOf` keyword.\n\t/// \n\t/// The builder.\n\t/// The divisor.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder MultipleOf(this JsonSchemaBuilder builder, decimal value)\n\t{\n\t\tbuilder.Add(\"multipleOf\", value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `not` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `not`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Not(this JsonSchemaBuilder builder, JsonSchemaBuilder schema)\n\t{\n\t\tbuilder.Add(\"not\", schema);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `oneOf` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `oneOf`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder OneOf(this JsonSchemaBuilder builder, params JsonSchemaBuilder[] schemas)\n\t{\n\t\tbuilder.Add(\"oneOf\", schemas);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `oneOf` keyword.\n\t/// \n\t/// The builder.\n\t/// The schemas for `oneOf`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder OneOf(this JsonSchemaBuilder builder, IEnumerable schemas)\n\t{\n\t\tbuilder.Add(\"oneOf\", schemas);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `pattern` keyword.\n\t/// \n\t/// The builder.\n\t/// The Regex instance to match.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Pattern(this JsonSchemaBuilder builder, Regex pattern)\n\t{\n\t\tbuilder.Add(\"pattern\", pattern.ToString());\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `pattern` keyword.\n\t/// \n\t/// The builder.\n\t/// The pattern to match.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Pattern(this JsonSchemaBuilder builder, [StringSyntax(StringSyntaxAttribute.Regex)] string pattern)\n\t{\n\t\tbuilder.Add(\"pattern\", pattern);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `patternProperties` keyword.\n\t/// \n\t/// The builder.\n\t/// The property schemas.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder PatternProperties(this JsonSchemaBuilder builder, IReadOnlyDictionary props)\n\t{\n\t\tbuilder.Add(\"patternProperties\", props.ToDictionary(x => x.Key.ToString(), x => x.Value));", + "snippet": "return builder;\n\t}\n\n\t/// \n\t/// Add a `minItems` keyword.\n\t/// \n\t/// The builder.\n\t/// The min number of expected items.\n\t/// The build" + }, + { + "title": "src/JsonSchema/JsonSchemaBuilderExtensions.cs (7/10)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaBuilderExtensions.cs#L721-L840", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaBuilderExtensions.cs", + "startLine": 721, + "endLine": 840, + "content": "return builder;\n\t}\n\n\t/// \n\t/// Add a `patternProperties` keyword.\n\t/// \n\t/// The builder.\n\t/// The property schemas.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder PatternProperties(this JsonSchemaBuilder builder, params (Regex pattern, JsonSchemaBuilder schema)[] props)\n\t{\n\t\tbuilder.Add(\"patternProperties\", props.ToDictionary(x => x.pattern.ToString(), x => x.schema));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `patternProperties` keyword.\n\t/// \n\t/// The builder.\n\t/// The property schemas.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder PatternProperties(this JsonSchemaBuilder builder, IReadOnlyDictionary props)\n\t{\n\t\tbuilder.Add(\"patternProperties\", props.ToDictionary(x => x.Key, x => x.Value));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `patternProperties` keyword.\n\t/// \n\t/// The builder.\n\t/// The property schemas.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder PatternProperties(this JsonSchemaBuilder builder, params (string pattern, JsonSchemaBuilder schema)[] props)\n\t{\n\t\tbuilder.Add(\"patternProperties\", props.ToDictionary(x => x.pattern, x => x.schema));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `prefixItems` keyword.\n\t/// \n\t/// The builder.\n\t/// The schemas for `prefixItems`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder PrefixItems(this JsonSchemaBuilder builder, params JsonSchemaBuilder[] schemas)\n\t{\n\t\tbuilder.Add(\"prefixItems\", schemas);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `prefixItems` keyword.\n\t/// \n\t/// The builder.\n\t/// The schemas for `prefixItems`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder PrefixItems(this JsonSchemaBuilder builder, IEnumerable schemas)\n\t{\n\t\tbuilder.Add(\"prefixItems\", schemas);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `properties` keyword.\n\t/// \n\t/// The builder.\n\t/// The property schemas.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Properties(this JsonSchemaBuilder builder, IReadOnlyDictionary props)\n\t{\n\t\tbuilder.Add(\"properties\", props);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `properties` keyword.\n\t/// \n\t/// The builder.\n\t/// The property schemas.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Properties(this JsonSchemaBuilder builder, params (string name, JsonSchemaBuilder schema)[] props)\n\t{\n\t\tbuilder.Add(\"properties\", props);\n\t\treturn builder;\n\t}\n\n\t///// \n\t///// Adds a `propertyDependencies` keyword.\n\t///// \n\t///// The builder.\n\t///// The property dependency schemas.\n\t///// The builder.\n\t//public static JsonSchemaBuilder PropertyDependencies(this JsonSchemaBuilder builder, IReadOnlyDictionary dependencies)\n\t//{\n\t//\tbuilder.Add(new PropertyDependenciesKeyword(dependencies.ToDictionary(x => x.Key, x => x.Value)));\n\t//\treturn builder;\n\t//}\n\n\t///// \n\t///// Adds a `propertyDependencies` keyword.\n\t///// \n\t///// The builder.\n\t///// The property dependency schemas.\n\t///// The builder.\n\t//public static JsonSchemaBuilder PropertyDependencies(this JsonSchemaBuilder builder, params (string property, PropertyDependency dependency)[] dependencies)\n\t//{\n\t//\tbuilder.Add(new PropertyDependenciesKeyword(dependencies.ToDictionary(x => x.property, x => x.dependency)));\n\t//\treturn builder;\n\t//}\n\n\t/// \n\t/// Add a `propertyNames` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `propertyNames`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder PropertyNames(this JsonSchemaBuilder builder, JsonSchemaBuilder schema)\n\t{\n\t\tbuilder.Add(\"propertyNames\", schema);", + "snippet": "return builder;\n\t}\n\n\t/// \n\t/// Add a `patternProperties` keyword.\n\t/// \n\t/// The builder.\n\t/// The property schemas.\n\t/// The builder." + }, + { + "title": "src/JsonSchema/JsonSchemaBuilderExtensions.cs (8/10)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaBuilderExtensions.cs#L841-L960", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaBuilderExtensions.cs", + "startLine": 841, + "endLine": 960, + "content": "return builder;\n\t}\n\n\t/// \n\t/// Add a `readOnly` keyword.\n\t/// \n\t/// The builder.\n\t/// Whether the instance is read-only.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder ReadOnly(this JsonSchemaBuilder builder, bool value)\n\t{\n\t\tbuilder.Add(\"readOnly\", (JsonNode)value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `$recursiveAnchor` keyword.\n\t/// \n\t/// The builder.\n\t/// The value.\n\t/// The builder.\n\t/// \n\t/// Per Draft 2019-09, the value must always be `true`. This is implied for this method.\n\t/// \n\tpublic static JsonSchemaBuilder RecursiveAnchor(this JsonSchemaBuilder builder, bool value = true)\n\t{\n\t\tbuilder.Add(\"$recursiveAnchor\", (JsonNode)value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `$recursiveRef` keyword.\n\t/// \n\t/// The builder.\n\t/// The URI reference.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder RecursiveRef(this JsonSchemaBuilder builder, Uri reference)\n\t{\n\t\tbuilder.Add(\"$recursiveRef\", reference.OriginalString);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `$recursiveRef` keyword.\n\t/// \n\t/// The builder.\n\t/// The URI reference.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder RecursiveRef(this JsonSchemaBuilder builder, string reference)\n\t{\n\t\tbuilder.Add(\"$recursiveRef\", reference);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `$ref` keyword.\n\t/// \n\t/// The builder.\n\t/// The URI reference.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Ref(this JsonSchemaBuilder builder, Uri reference)\n\t{\n\t\tbuilder.Add(\"$ref\", reference.OriginalString);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `$ref` keyword.\n\t/// \n\t/// The builder.\n\t/// The URI reference.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Ref(this JsonSchemaBuilder builder, string reference)\n\t{\n\t\tbuilder.Add(\"$ref\", reference);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `required` keyword.\n\t/// \n\t/// The builder.\n\t/// The required property collections.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Required(this JsonSchemaBuilder builder, IEnumerable properties)\n\t{\n\t\tbuilder.Add(\"required\", new JsonArray(properties.Select(x => (JsonNode?)x).ToArray()));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `required` keyword.\n\t/// \n\t/// The builder.\n\t/// The required property collections.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Required(this JsonSchemaBuilder builder, params string[] properties)\n\t{\n\t\tbuilder.Add(\"required\", new JsonArray(properties.Select(x => (JsonNode?)x).ToArray()));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `$schema` keyword.\n\t/// \n\t/// The builder.\n\t/// The uri of the meta-schema.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Schema(this JsonSchemaBuilder builder, Uri uri)\n\t{\n\t\tbuilder.Add(\"$schema\", uri.OriginalString);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `$schema` keyword.\n\t/// \n\t/// The builder.\n\t/// The uri of the meta-schema.\n\t/// The builder.", + "snippet": "return builder;\n\t}\n\n\t/// \n\t/// Add a `readOnly` keyword.\n\t/// \n\t/// The builder.\n\t/// Whether the instance is read-only.\n\t/// The buil" + }, + { + "title": "src/JsonSchema/JsonSchemaBuilderExtensions.cs (9/10)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaBuilderExtensions.cs#L961-L1080", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaBuilderExtensions.cs", + "startLine": 961, + "endLine": 1080, + "content": "public static JsonSchemaBuilder Schema(this JsonSchemaBuilder builder, string uri)\n\t{\n\t\tbuilder.Add(\"$schema\", uri);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `then` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `then`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Then(this JsonSchemaBuilder builder, JsonSchemaBuilder schema)\n\t{\n\t\tbuilder.Add(\"then\", schema);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `title` keyword.\n\t/// \n\t/// The builder.\n\t/// The title.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Title(this JsonSchemaBuilder builder, string title)\n\t{\n\t\tbuilder.Add(\"title\", title);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `type` keyword.\n\t/// \n\t/// The builder.\n\t/// The type. Can be combined with the bit-wise OR operator `|`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Type(this JsonSchemaBuilder builder, SchemaValueType type)\n\t{\n\t\tvar types = GetString(type);\n\t\tif (types.Length == 1)\n\t\t\tbuilder.Add(\"type\", types[0]);\n\t\telse\n\t\t\tbuilder.Add(\"type\", new JsonArray(types));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `type` keyword.\n\t/// \n\t/// The builder.\n\t/// The types.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Type(this JsonSchemaBuilder builder, params SchemaValueType[] types)\n\t{\n\t\tvar type = types.Aggregate((SchemaValueType)0, (t, x) => t | x);\n\t\tvar strings = GetString(type);\n\t\tif (strings.Length == 1)\n\t\t\tbuilder.Add(\"type\", strings[0]);\n\t\telse\n\t\t\tbuilder.Add(\"type\", new JsonArray(strings));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `type` keyword.\n\t/// \n\t/// The builder.\n\t/// The types.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Type(this JsonSchemaBuilder builder, IEnumerable types)\n\t{\n\t\tvar type = types.Aggregate((SchemaValueType)0, (t, x) => t | x);\n\t\tvar strings = GetString(type);\n\t\tif (strings.Length == 1)\n\t\t\tbuilder.Add(\"type\", strings[0]);\n\t\telse\n\t\t\tbuilder.Add(\"type\", new JsonArray(strings));\n\t\treturn builder;\n\t}\n\n\tprivate static JsonNode?[] GetString(SchemaValueType type)\n\t{\n\t\tvar strings = new List();\n\t\t\n\t\tif (type.HasFlag(SchemaValueType.Null))\n\t\t\tstrings.Add(\"null\");\n\t\tif (type.HasFlag(SchemaValueType.Boolean))\n\t\t\tstrings.Add(\"boolean\");\n\t\tif (type.HasFlag(SchemaValueType.Object))\n\t\t\tstrings.Add(\"object\");\n\t\tif (type.HasFlag(SchemaValueType.Array))\n\t\t\tstrings.Add(\"array\");\n\t\tif (type.HasFlag(SchemaValueType.Number))\n\t\t\tstrings.Add(\"number\");\n\t\tif (type.HasFlag(SchemaValueType.String))\n\t\t\tstrings.Add(\"string\");\n\t\tif (type.HasFlag(SchemaValueType.Integer))\n\t\t\tstrings.Add(\"integer\");\n\t\t\n\t\treturn strings.ToArray();\n\t}\n\n\t/// \n\t/// Add an `unevaluatedItems` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `unevaluatedItems`.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder UnevaluatedItems(this JsonSchemaBuilder builder, JsonSchemaBuilder schema)\n\t{\n\t\tbuilder.Add(\"unevaluatedItems\", schema);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `unevaluatedProperties` keyword.\n\t/// \n\t/// The builder.\n\t/// The schema for `unevaluatedProperties`.\n\t/// The builder.", + "snippet": "public static JsonSchemaBuilder Schema(this JsonSchemaBuilder builder, string uri)\n\t{\n\t\tbuilder.Add(\"$schema\", uri);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `then` keyword.\n\t/// \n\t/// \n\t/// Add a `uniqueItems` keyword.\n\t/// \n\t/// The builder.\n\t/// Whether to expect a unique item set.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder UniqueItems(this JsonSchemaBuilder builder, bool value)\n\t{\n\t\tbuilder.Add(\"uniqueItems\", (JsonNode)value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Adds a keyword that's not recognized by any vocabulary - extra data - to the schema.\n\t/// \n\t/// The builder.\n\t/// The keyword name.\n\t/// The value.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Unrecognized(this JsonSchemaBuilder builder, string name, JsonNode? value)\n\t{\n\t\tbuilder.Add(name, value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `$vocabulary` keyword.\n\t/// \n\t/// The builder.\n\t/// The vocabulary callouts.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Vocabulary(this JsonSchemaBuilder builder, params (Uri id, bool required)[] vocabs)\n\t{\n\t\tbuilder.Add(\"$vocabulary\", new JsonObject(vocabs.ToDictionary(x => x.id.OriginalString, x => (JsonNode?)x.required)));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `$vocabulary` keyword.\n\t/// \n\t/// The builder.\n\t/// The vocabulary callouts.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Vocabulary(this JsonSchemaBuilder builder, params (string id, bool required)[] vocabs)\n\t{\n\t\tbuilder.Add(\"$vocabulary\", new JsonObject(vocabs.ToDictionary(x => x.id, x => (JsonNode?)x.required)));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `$vocabulary` keyword.\n\t/// \n\t/// The builder.\n\t/// The vocabulary callouts.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Vocabulary(this JsonSchemaBuilder builder, IReadOnlyDictionary vocabs)\n\t{\n\t\tbuilder.Add(\"$vocabulary\", new JsonObject(vocabs.ToDictionary(x => x.Key.OriginalString, x => (JsonNode?)x.Value)));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add an `$vocabulary` keyword.\n\t/// \n\t/// The builder.\n\t/// The vocabulary callouts.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder Vocabulary(this JsonSchemaBuilder builder, IReadOnlyDictionary vocabs)\n\t{\n\t\tbuilder.Add(\"$vocabulary\", new JsonObject(vocabs.ToDictionary(x => x.Key, x => (JsonNode?)x.Value)));\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `writeOnly` keyword.\n\t/// \n\t/// The builder.\n\t/// Whether the instance is write-only.\n\t/// The builder.\n\tpublic static JsonSchemaBuilder WriteOnly(this JsonSchemaBuilder builder, bool value)\n\t{\n\t\tbuilder.Add(\"writeOnly\", (JsonNode)value);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Convenience method that builds and evaluates with a single call.\n\t/// \n\t/// The builder.\n\t/// The root instance.\n\t/// The options to use for this evaluation.\n\t/// A that provides the outcome of the evaluation.\n\tpublic static EvaluationResults Evaluate(this JsonSchemaBuilder builder, JsonElement root, EvaluationOptions? options = null)\n\t{\n\t\treturn builder.Build().Evaluate(root, options);\n\t}\n}", + "snippet": "public static JsonSchemaBuilder UnevaluatedProperties(this JsonSchemaBuilder builder, JsonSchemaBuilder schema)\n\t{\n\t\tbuilder.Add(\"unevaluatedProperties\", schema);\n\t\treturn builder;\n\t}\n\n\t/// \n\t/// Add a `uniqueIt" + }, + { + "title": "src/JsonSchema/JsonSchemaException.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaException.cs#L1-L29", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaException.cs", + "startLine": 1, + "endLine": 29, + "content": "using System;\n\nnamespace Json.Schema;\n\n/// \n/// Thrown when a schema is invalid or cannot be processed with the current configuration.\n/// \npublic class JsonSchemaException : Exception\n{\n\t/// \n\t/// Creates a new instance of the type.\n\t/// \n\t/// The message that describes the error.\n\tpublic JsonSchemaException(string message)\n\t\t: base(message)\n\t{\n\t}\n\n\t/// \n\t/// Initializes a new instance of the JsonSchemaException class with a specified error message and a reference to the\n\t/// inner exception that is the cause of this exception.\n\t/// \n\t/// The error message that explains the reason for the exception.\n\t/// The exception that is the cause of the current exception, or a null reference if no inner exception is specified.\n\tpublic JsonSchemaException(string message, Exception innerException)\n\t\t: base(message, innerException)\n\t{\n\t}\n}", + "snippet": "using System;\n\nnamespace Json.Schema;\n\n/// \n/// Thrown when a schema is invalid or cannot be processed with the current configuration.\n/// \npublic class JsonSchemaException : Exception\n{\n\t/// " + }, + { + "title": "src/JsonSchema/JsonSchemaNode.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaNode.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaNode.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\n/// \n/// Represents a subschema.\n/// \n/// A JsonSchemaNode provides the context and data necessary for evaluating a subschema\n/// against an instance. It supports evaluation of schema logic, including handling of boolean schemas and keyword-based\n/// validation.\n[DebuggerDisplay(\"{BaseUri}\")]\npublic class JsonSchemaNode\n{\n\tprivate const string _unknownKeywordsAnnotation = \"$unknownKeywords\";\n\n\tprivate static readonly Uri _trueBaseUri = new(\"https://json-schema.org/true\");\n\tprivate static readonly JsonElement _trueElement = JsonDocument.Parse(\"true\").RootElement;\n\tinternal static JsonSchemaNode True() => new()\n\t{\n\t\tBaseUri = _trueBaseUri,\n\t\tSource = _trueElement\n\t};\n\tprivate static readonly Uri _falseBaseUri = new(\"https://json-schema.org/false\");\n\tprivate static readonly JsonElement _falseElement = JsonDocument.Parse(\"false\").RootElement;\n\tinternal static JsonSchemaNode False() => new()\n\t{\n\t\tBaseUri = _falseBaseUri,\n\t\tSource = _falseElement\n\t};\n\n\t/// \n\t/// Gets or sets the base URI used for resolving relative paths or requests.\n\t/// \n\t/// The base URI should be an absolute URI.\n\tpublic required Uri BaseUri { get; init; }\n\n\t/// \n\t/// Gets the original JSON source data this subschema.\n\t/// \n\t/// Use this property to access the raw JSON content for inspection or further processing.\n\tpublic JsonElement Source { get; init; }\n\n\t/// \n\t/// Gets the collection of keyword data this subschema.\n\t/// \n\tpublic KeywordData[] Keywords { get; init; } = [];\n\n\t/// \n\t/// Gets a JSON Pointer to this subschema from the parent subschema, excluding the intermediate keyword.\n\t/// \n\tpublic JsonPointer RelativePath { get; internal set; }\n\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\t[Obsolete(\"This is only for advanced usage.\")]\n\tpublic JsonPointer PathFromResourceRoot { get; set; }\n#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member\n\n\tinternal JsonSchemaNode()\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the schema against the provided context and returns the results of the evaluation.\n\t/// \n\t/// If the schema is a boolean schema, the evaluation result is determined immediately. For schemas\n\t/// with keywords, each keyword is evaluated in order, and the overall validity is determined by their contributions.\n\t/// The method manages evaluation scope and tracks evaluated keywords, errors, and annotations as\n\t/// appropriate.\n\t/// The evaluation context containing the instance data, schema location, and evaluation options to use during schema\n\t/// evaluation. Cannot be null.\n\t/// An EvaluationResults object containing the outcome of the schema evaluation, including validity, errors,\n\t/// annotations, and details. The results reflect the evaluation of all applicable keywords in the schema.\n\tpublic EvaluationResults Evaluate(EvaluationContext context)\n\t{\n\t\tvar baseUri = BaseUri == _trueBaseUri || BaseUri == _falseBaseUri\n\t\t\t? context.Scope.LocalScope\n\t\t\t: BaseUri;\n\n\t\tcontext.CanOptimize &= Keywords.All(x =>\n\t\t\tx.Handler is not (UnevaluatedItemsKeyword or\n\t\t\t\tUnevaluatedPropertiesKeyword or\n\t\t\t\tSchema.Keywords.Draft201909.UnevaluatedItemsKeyword));\n\n#pragma warning disable CS0618 // Type or member is obsolete\n\t\tvar results = context.CanOptimize\n\t\t\t? new EvaluationResults()\n\t\t\t: new EvaluationResults(context.EvaluationPath, new Uri(baseUri, $\"#{PathFromResourceRoot}\"), context.InstanceLocation, context.Options);\n#pragma warning restore CS0618 // Type or member is obsolete\n\t\tif (Source.ValueKind == JsonValueKind.True)\n\t\t{\n\t\t\treturn results;\n\t\t}\n\t\tif (Source.ValueKind == JsonValueKind.False)\n\t\t{\n\t\t\tresults.IsValid = false;\n\t\t\tresults.Errors = new() { [\"\"] = ErrorMessages.FalseSchema };\n\t\t\treturn results;\n\t\t}\n\n\t\tvar evaluationRegistration = (this, context.InstanceLocation);\n\t\tif (context.EvaluatedNodes.Any(x => x == evaluationRegistration))\n\t\t\tthrow new JsonSchemaException($\"Cycle detected at evaluation path '{context.EvaluationPath}' and instance location '{context.InstanceLocation}'\");\n\t\tcontext.EvaluatedNodes.Push(evaluationRegistration);\n\n\t\tvar newScope = !Equals(BaseUri, context.Scope.LocalScope);\n\t\tif (newScope)\n\t\t\tcontext.Scope.Push(BaseUri);\n\n\t\tresults.IsValid = true;\n\t\tcontext.EvaluatedKeywords = new KeywordEvaluation[Keywords.Length];\n\t\tint i = 0;\n\t\tforeach (var keyword in Keywords.OrderBy(x => x.EvaluationOrder))\n\t\t{\n\t\t\tvar evaluation = keyword.Handler.Evaluate(keyword, context);\n\t\t\tcontext.EvaluatedKeywords[i] = evaluation;", + "snippet": "using System;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\nusing Json.Schema.Keywords;\n\nnamespace Json.Schema;\n\n/// \n/// Represents a subschema.\n/// \n/// 0 })\n\t\t\t\t{\n\t\t\t\t\tresults.Details ??= [];\n\t\t\t\t\tforeach (var detail in evaluation.Details)\n\t\t\t\t\t{\n\t\t\t\t\t\tdetail.Parent = results;\n\t\t\t\t\t\tresults.Details.Add(detail);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (evaluation.Error is not null)\n\t\t\t\t{\n\t\t\t\t\tresults.Errors ??= [];\n\t\t\t\t\tresults.Errors[evaluation.Keyword] = evaluation.Error!;\n\t\t\t\t}\n\t\t\t\tif (evaluation.Annotation is not null &&\n\t\t\t\t (context.Options.IgnoredAnnotations == null ||\n\t\t\t\t !context.Options.IgnoredAnnotations.Contains(keyword.Handler.GetType())))\n\t\t\t\t{\n\t\t\t\t\tresults.Annotations ??= [];\n\t\t\t\t\tresults.Annotations[evaluation.Keyword] = evaluation.Annotation.Value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ti++;\n\n\t\t\tif (keyword.Handler is RefKeyword && context.RefIgnoresSiblingKeywords) break;\n\t\t}\n\n\t\tif (!context.CanOptimize)\n\t\t{\n\t\t\tif (!results.IsValid && !context.Options.PreserveDroppedAnnotations)\n\t\t\t\tresults.Annotations?.Clear();\n\n\t\t\tif (context.Options.AddAnnotationForUnknownKeywords)\n\t\t\t{\n\t\t\t\tvar unknownKeywords = Keywords\n\t\t\t\t\t.Where(x => x.Handler is AnnotationKeyword)\n\t\t\t\t\t.Select(x => (string)x.Value!)\n\t\t\t\t\t.ToArray();\n\t\t\t\tif (unknownKeywords.Length != 0)\n\t\t\t\t{\n\t\t\t\t\tresults.Annotations ??= [];\n\t\t\t\t\tresults.Annotations[_unknownKeywordsAnnotation] = JsonSerializer.SerializeToElement(unknownKeywords, JsonSchemaSerializerContext.Default.StringArray);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (newScope)\n\t\t\tcontext.Scope.Pop();\n\n\t\tcontext.EvaluatedNodes.Pop();\n\n\t\treturn results;\n\t}\n}", + "snippet": "results.IsValid &= evaluation.IsValid || !evaluation.ContributesToValidation;\n\n\t\t\tif (!context.CanOptimize)\n\t\t\t{\n\t\t\t\tif (evaluation.Details is { Length: > 0 })\n\t\t\t\t{\n\t\t\t\t\tresults.Details ??= [];\n\t\t\t\t\tforeach (var detail " + }, + { + "title": "src/JsonSchema/JsonSchemaSerializerContext.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/JsonSchemaSerializerContext.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/JsonSchemaSerializerContext.cs", + "startLine": 1, + "endLine": 25, + "content": "using System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n[JsonSerializable(typeof(JsonSchema))]\n[JsonSerializable(typeof(SchemaValueType))]\n[JsonSerializable(typeof(EvaluationResults))]\n[JsonSerializable(typeof(JsonPointer))]\n[JsonSerializable(typeof(JsonSchemaBuilder))]\n[JsonSerializable(typeof(decimal))]\n[JsonSerializable(typeof(double))]\n[JsonSerializable(typeof(string))]\n[JsonSerializable(typeof(string[]))]\n[JsonSerializable(typeof(bool))]\n[JsonSerializable(typeof(int[]))]\n[JsonSerializable(typeof(long))]\n[JsonSerializable(typeof(JsonElement))]\n[JsonSerializable(typeof(JsonNode))]\n[JsonSerializable(typeof(Dictionary))]\n[JsonSerializable(typeof(HashSet))]\ninternal partial class JsonSchemaSerializerContext : JsonSerializerContext;", + "snippet": "using System.Collections.Generic;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n[JsonSerializable(typeof(JsonSchema))]\n[JsonSeria" + }, + { + "title": "src/JsonSchema/KeywordData.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/KeywordData.cs#L1-L51", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/KeywordData.cs", + "startLine": 1, + "endLine": 51, + "content": "using System.Diagnostics;\nusing System.Text.Json;\n#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.\n\nnamespace Json.Schema;\n\n/// \n/// Represents the data and metadata associated with a JSON Schema keyword, including its handler, raw value, evaluated\n/// value, and any associated subschemas.\n/// \n/// Instances of this class are used during JSON Schema processing to track keyword-specific\n/// information. The properties provide access to both the raw JSON representation and the processed value, as well as\n/// any subschemas relevant to the keyword.\n[DebuggerDisplay(\"{Handler.Name} {RawValue}\")]\npublic class KeywordData\n{\n\t/// \n\t/// Gets the keyword handler used to process keyword-related operations.\n\t/// \n\tpublic IKeywordHandler Handler { get; internal set; }\n\n\t/// \n\t/// Gets the underlying JSON value represented by this instance.\n\t/// \n\t/// This property provides direct access to the raw JSON data as a . It can be used to inspect or process the value without additional parsing or\n\t/// conversion.\n\tpublic JsonElement RawValue { get; internal set; }\n\n\t/// \n\t/// Gets or sets the collection of subschema nodes.\n\t/// \n\t/// Each element in the array represents a subschema that is part of the overall schema definition.\n\tpublic JsonSchemaNode[] Subschemas { get; set; } = [];\n\n\t/// \n\t/// Gets or sets a value.\n\t/// \n\t/// The value may or may not represent the value of the keyword. It is primarily useful for pre-processing\n\t/// values and communicating them between the methods.\n\tpublic object? Value { get; set; }\n\n\tinternal long EvaluationOrder { get; set; }\n\n\tinternal BuildContext Context { get; }\n\n\tinternal KeywordData(BuildContext context)\n\t{\n\t\tContext = context;\n\t}\n}", + "snippet": "using System.Diagnostics;\nusing System.Text.Json;\n#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nulla" + }, + { + "title": "src/JsonSchema/KeywordEvaluation.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/KeywordEvaluation.cs#L1-L66", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/KeywordEvaluation.cs", + "startLine": 1, + "endLine": 66, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema;\n\n/// \n/// Represents the result of evaluating a keyword, including its validity, associated annotation, and any subschema\n/// evaluation results.\n/// \n/// Use this struct to capture the outcome of a keyword evaluation, such as in schema validation\n/// scenarios. The struct provides information about the keyword, whether it was valid, any related annotation data,\n/// subschema results, and error information if applicable. The static Ignore field can be used to represent a keyword\n/// evaluation that should be excluded from further processing.\npublic readonly struct KeywordEvaluation\n{\n\t/// \n\t/// Represents a special evaluation that indicates a keyword should be ignored during processing.\n\t/// \n\t/// This instance is typically used to mark keywords that are intentionally excluded from validation or\n\t/// further analysis. The generated keyword value is unique for each application run.\n\tpublic static readonly KeywordEvaluation Ignore = new()\n\t{\n\t\tKeyword = Guid.NewGuid().ToString(\"N\"),\n\t\tIsValid = true\n\t};\n\n\t/// \n\t/// Gets the keyword that produced the evaluation.\n\t/// \n\tpublic required string Keyword { get; init; }\n\n\t/// \n\t/// Gets a value indicating whether a validation succeeded.\n\t/// \n\t/// Some keywords do not produce a validation result.\n\t/// In these cases, this property will default to true.\n\tpublic required bool IsValid { get; init; }\n\t\n\t/// \n\t/// Gets the a JSON annotation produced by the keyword.\n\t/// \n\t/// The annotation can contain arbitrary metadata or additional information in JSON format. If no\n\t/// annotation is present, the value is .\n\tpublic JsonElement? Annotation { get; init; }\n\t\n\t/// \n\t/// Gets the collection of evaluation results produced by subschemas.\n\t/// \n\tpublic EvaluationResults[]? Details { get; init; }\n\t\n\t/// \n\t/// If validation failed, this may get an error message.\n\t/// \n\t/// Not all keywords produce an error message when they fail validation.\n\tpublic string? Error { get; init; }\n\t\n\t/// \n\t/// Gets a value indicating whether this member participates in validation.\n\t/// \n\tpublic bool ContributesToValidation { get; init; } = true;\n\n\t/// \n\t/// Initializes a new instance of the KeywordEvaluation type.\n\t/// \n\tpublic KeywordEvaluation(){}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema;\n\n/// \n/// Represents the result of evaluating a keyword, including its validity, associated annotation, and any subschema\n/// evaluation results.\n///" + }, + { + "title": "src/JsonSchema/Keywords/AdditionalPropertiesKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/AdditionalPropertiesKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/AdditionalPropertiesKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `additionalProperties`.\n/// \n/// \n/// This keyword specifies a schema that will be used to validate properties that are not explicitly defined\n/// by `properties` or `patternProperties`.\n/// \n[DependsOnAnnotationsFrom(typeof(PropertiesKeyword))]\n[DependsOnAnnotationsFrom(typeof(PatternPropertiesKeyword))]\npublic class AdditionalPropertiesKeyword : IKeywordHandler\n{\n\tprivate class KnownProperties\n\t{\n\t\tpublic HashSet Properties { get; set; } = [];\n\t\tpublic Regex[] PatternProperties { get; set; } = [];\n\t}\n\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static AdditionalPropertiesKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"additionalProperties\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected AdditionalPropertiesKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a valid schema, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Subschemas = [node];\n\n\t\tvar knownProperties = new KnownProperties();\n\n\t\tif (context.LocalSchema.TryGetProperty(\"properties\", out var properties))\n\t\t\tknownProperties.Properties =\n\t\t\t[\n\t\t\t\t..properties\n\t\t\t\t\t.EnumerateObject()\n\t\t\t\t\t.Select(x => x.Name)\n\t\t\t];\n\n\t\tif (context.LocalSchema.TryGetProperty(\"patternProperties\", out var patternProperties))\n\t\t\tknownProperties.PatternProperties = patternProperties\n\t\t\t\t.EnumerateObject()\n\t\t\t\t.Select(x => new Regex(x.Name, RegexOptions.ECMAScript | RegexOptions.Compiled))\n\t\t\t\t.ToArray();\n\n\t\tkeyword.Value = knownProperties;\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Object) return KeywordEvaluation.Ignore;\n\n\t\t\tvar knownProperties = (KnownProperties) keyword.Value!;\n\n\t\t// Get evaluated properties from annotations instead of re-running regex matches\n\t\tvar evaluatedByPatterns = context.EvaluatedKeywords?\n\t\t\t.SingleOrDefault(x => x.Keyword == \"patternProperties\")\n\t\t\t.Annotation?.EnumerateArray().Select(p => p.GetString()!) ?? [];\n\t\tvar evaluatedByPatternsSet = new HashSet(evaluatedByPatterns);\n\n\t\tvar subschemaEvaluations = new List();\n\t\tvar subschema = keyword.Subschemas[0];\n\n\t\tvar evaluationPath = context.EvaluationPath.Combine(Name);\n\t\tforeach (var instance in context.Instance.EnumerateObject())\n\t\t{\n\t\t\tif (knownProperties.Properties.Contains(instance.Name)) continue;\n\t\t\tif (evaluatedByPatternsSet.Contains(instance.Name)) continue;\n\n\t\t\tvar itemContext = context with\n\t\t\t{\n\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(instance.Name),\n\t\t\t\tInstance = instance.Value,\n\t\t\t\tEvaluationPath = evaluationPath", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `additionalProperties`.\n/// \n/// x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray(),\n\t\t\tAnnotation = JsonElementExtensions.True\n\t\t};\n\t}\n}", + "snippet": "};\n\n\t\t\tvar local = subschema.Evaluate(itemContext);\n\t\t\tsubschemaEvaluations.Add(local);\n\n\t\t\tif (context.CanOptimize && !local.IsValid)\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false\n\t\t\t\t" + }, + { + "title": "src/JsonSchema/Keywords/AllOfKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/AllOfKeyword.cs#L1-L119", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/AllOfKeyword.cs", + "startLine": 1, + "endLine": 119, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `allOf`.\n/// \n/// \n/// This keyword specifies that the instance must be valid against all of the subschemas.\n/// \npublic class AllOfKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static AllOfKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"allOf\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected AllOfKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Array)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an array, found {value.ValueKind}.\");\n\n\t\tvar count = 0;\n\t\tforeach (var x in value.EnumerateArray())\n\t\t{\n\t\t\tif (x.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' values must be valid schemas.\");\n\t\t\tcount++;\n\t\t}\n\n\t\tif (count == 0)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' requires at least one subschema.\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar subschemas = new List();\n\t\tvar index = 0;\n\t\tforeach (var definition in keyword.RawValue.EnumerateArray())\n\t\t{\n\t\t\tvar defContext = context with\n\t\t\t{\n\t\t\t\tLocalSchema = definition,\n\t\t\t\tRelativePath = JsonPointer.Create(index)\n\t\t\t};\n\t\t\tsubschemas.Add(JsonSchema.BuildNode(defContext));\n\t\t\tindex++;\n\t\t}\n\n\t\tkeyword.Subschemas = subschemas.ToArray();\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar subschemaEvaluations = new List();\n\n\t\tvar i = 0;\n\t\tforeach (var subschema in keyword.Subschemas)\n\t\t{\n\t\t\tvar itemContext = context with\n\t\t\t{\n\t\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name, i)\n\t\t\t};\n\n\t\t\tvar local = subschema.Evaluate(itemContext);\n\t\t\tsubschemaEvaluations.Add(local);\n\n\t\t\tif (context.CanOptimize && !local.IsValid)\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false\n\t\t\t\t};\n\n\t\t\ti++;\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray()\n\t\t\t// TODO: add error message\n\t\t};\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `allOf`.\n/// \n/// \n/// This keyword specifie" + }, + { + "title": "src/JsonSchema/Keywords/AnchorKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/AnchorKeyword.cs#L1-L83", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/AnchorKeyword.cs", + "startLine": 1, + "endLine": 83, + "content": "using System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$anchor`.\n/// \n/// \n/// The `$anchor` keyword is used to create a location-independent identifier for the current subschema.\n/// This anchor can be used with `$ref` to reference the subschema.\n/// \npublic partial class AnchorKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static AnchorKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"$anchor\";\n\n#if NET7_0_OR_GREATER\n\t/// \n\t/// Gets the regular expression for validating the anchor value.\n\t/// \n\tpublic virtual Regex AnchorPattern { get; } = GetAnchorPatternRegex();\n\t[GeneratedRegex(\"^[A-Za-z_][-A-Za-z0-9._]*$\", RegexOptions.Compiled)]\n\tprivate static partial Regex GetAnchorPatternRegex();\n#else\n\t/// \n\t/// Gets the regular expression for validating the anchor value.\n\t/// \n\tpublic virtual Regex AnchorPattern { get; } = new(\"^[A-Za-z_][-A-Za-z0-9._]*$\", RegexOptions.Compiled);\n#endif\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected AnchorKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.String)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\tvar anchor = value.GetString()!;\n\t\tif (!AnchorPattern.IsMatch(anchor))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must match '{AnchorPattern}'\");\n\n\t\treturn anchor;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn KeywordEvaluation.Ignore;\n\t}\n}", + "snippet": "using System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$anchor`.\n/// \n/// \n/// The `$anchor` keyword is used to create a location-ind" + }, + { + "title": "src/JsonSchema/Keywords/AnnotationKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/AnnotationKeyword.cs#L1-L69", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/AnnotationKeyword.cs", + "startLine": 1, + "endLine": 69, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles unrecognized keywords.\n/// \n/// \n/// This keyword handler is used for any keyword that is not recognized by the vocabulary.\n/// It will always pass validation and will add an annotation with the keyword's value.\n/// \npublic class AnnotationKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static AnnotationKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\t/// \n\t/// For this keyword, this value is not used. The keyword name is determined during schema building.\n\t/// \n\tpublic string Name { get; } = Guid.NewGuid().ToString(\"N\");\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected AnnotationKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = (string) keyword.Value!,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles unrecognized keywords.\n/// \n/// \n/// This keyword handler is used for any keyword that is not recognize" + }, + { + "title": "src/JsonSchema/Keywords/AnyOfKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/AnyOfKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/AnyOfKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `anyOf`.\n/// \n/// \n/// This keyword specifies that the instance must be valid against at least one of the subschemas.\n/// \npublic class AnyOfKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static AnyOfKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"anyOf\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected AnyOfKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Array)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an array, found {value.ValueKind}.\");\n\n\t\tvar count = 0;\n\t\tforeach (var x in value.EnumerateArray())\n\t\t{\n\t\t\tif (x.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' values must be valid schemas.\");\n\t\t\tcount++;\n\t\t}\n\n\t\tif (count == 0)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' requires at least one subschema.\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar subschemas = new List();\n\t\tvar index = 0;\n\t\tforeach (var definition in keyword.RawValue.EnumerateArray())\n\t\t{\n\t\t\tvar defContext = context with\n\t\t\t{\n\t\t\t\tLocalSchema = definition,\n\t\t\t\tRelativePath = JsonPointer.Create(index)\n\t\t\t};\n\t\t\tvar node = JsonSchema.BuildNode(defContext);\n\n\t\t\tsubschemas.Add(node);\n\t\t\tindex++;\n\t\t}\n\n\t\tkeyword.Subschemas = subschemas.ToArray();\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar subschemaEvaluations = new List();\n\n\t\tvar i = 0;\n\t\tforeach (var subschema in keyword.Subschemas)\n\t\t{\n\t\t\tvar itemContext = context with\n\t\t\t{\n\t\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name, i)\n\t\t\t};\n\n\t\t\tvar local = subschema.Evaluate(itemContext);\n\t\t\tsubschemaEvaluations.Add(local);\n\n\t\t\tif (context.CanOptimize && local.IsValid)\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = true\n\t\t\t\t};\n\n\t\t\ti++;\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.Any(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray()\n\t\t\t// TODO: add error message\n\t\t};\n\t}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `anyOf`.\n/// \n/// \n/// This keyword specifie" + }, + { + "title": "src/JsonSchema/Keywords/AnyOfKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/AnyOfKeyword.cs#L121-L121", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/AnyOfKeyword.cs", + "startLine": 121, + "endLine": 121, + "content": "}", + "snippet": "}" + }, + { + "title": "src/JsonSchema/Keywords/CommentKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/CommentKeyword.cs#L1-L63", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/CommentKeyword.cs", + "startLine": 1, + "endLine": 63, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$comment`.\n/// \n/// \n/// This keyword is intended for adding comments to a schema. It has no effect on validation and is not returned in the\n/// evaluation results.\n/// \npublic class CommentKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static CommentKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"$comment\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected CommentKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.String)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn KeywordEvaluation.Ignore;\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$comment`.\n/// \n/// \n/// This keyword is intended for adding comments to a schema. It has no effect on validation an" + }, + { + "title": "src/JsonSchema/Keywords/ConstKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ConstKeyword.cs#L1-L76", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ConstKeyword.cs", + "startLine": 1, + "endLine": 76, + "content": "using System.Text.Json;\nusing Json.More;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `const`.\n/// \n/// \n/// This keyword specifies that the instance must be equal to the value of the keyword.\n/// \npublic class ConstKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ConstKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"const\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ConstKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (!keyword.RawValue.IsEquivalentTo(context.Instance))\n\t\t{\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tIsValid = false,\n\t\t\t\tKeyword = Name,\n\t\t\t\tError = ErrorMessages.GetConst(context.Options.Culture)\n\t\t\t\t\t.ReplaceToken(\"value\", keyword.RawValue.ToJsonString())\n\t\t\t};\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tIsValid = true,\n\t\t\tKeyword = Name\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\nusing Json.More;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `const`.\n/// \n/// \n/// This keyword specifies that the instance must be equal to the value of the ke" + }, + { + "title": "src/JsonSchema/Keywords/ContainsKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ContainsKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ContainsKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles the `contains` keyword.\n/// \n/// \n/// This keyword specifies a schema that must be met by at least one of the items in an array.\n/// The `minContains` and `maxContains` keywords can be used to further constrain the number of items\n/// that must match the `contains` schema.\n/// \npublic class ContainsKeyword : IKeywordHandler\n{\n\tprivate struct ContainsLimits\n\t{\n\t\tpublic int Min { get; init; }\n\t\tpublic int? Max { get; init; }\n\t}\n\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ContainsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"contains\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ContainsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a valid schema, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Subschemas = [node];\n\n\t\tvar limits = new ContainsLimits\n\t\t{\n\t\t\tMin = context.LocalSchema.TryGetProperty(\"minContains\", out var minContains) ? (int) Math.Truncate(minContains.GetDouble()) : 1,\n\t\t\tMax = context.LocalSchema.TryGetProperty(\"maxContains\", out var maxContains) ? (int)Math.Truncate(maxContains.GetDouble()) : null\n\t\t};\n\t\tkeyword.Value = limits;\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Array) return KeywordEvaluation.Ignore;\n\n\t\tvar limits = (ContainsLimits)keyword.Value!;\n\n\t\tvar subschemaEvaluations = new List();\n\t\tvar found = new List();\n\t\tvar subschema = keyword.Subschemas[0];\n\n\t\tvar i = 0;\n\t\tforeach (var instance in context.Instance.EnumerateArray())\n\t\t{\n\t\t\tvar itemContext = context with\n\t\t\t{\n\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(i),\n\t\t\t\tInstance = instance,\n\t\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t\t};\n\n\t\t\tvar result = subschema.Evaluate(itemContext);\n\t\t\tsubschemaEvaluations.Add(result);\n\t\t\tif (result.IsValid)\n\t\t\t\tfound.Add(i);\n\t\t\ti++;\n\t\t}\n\n\t\tvar valid = true;\n\t\tstring? error = null;\n\t\tif (limits.Min > found.Count)\n\t\t{\n\t\t\tvalid = false;\n\t\t\terror = ErrorMessages.GetContainsTooFew(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", found.Count)\n\t\t\t\t.ReplaceToken(\"minimum\", limits.Min);\n\t\t}\n\t\telse if (found.Count > limits.Max)\n\t\t{", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles the `contains` keyword.\n/// \n/// \n/// This keyword" + }, + { + "title": "src/JsonSchema/Keywords/ContainsKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ContainsKeyword.cs#L121-L137", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ContainsKeyword.cs", + "startLine": 121, + "endLine": 137, + "content": "valid = false;\n\t\t\terror = ErrorMessages.GetContainsTooMany(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", found.Count)\n\t\t\t\t.ReplaceToken(\"maximum\", limits.Max.Value);\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = valid,\n\t\t\tDetails = subschemaEvaluations.ToArray(),\n\t\t\tError = error,\n\t\t\tAnnotation = JsonSerializer.SerializeToElement(found.ToArray(), JsonSchemaSerializerContext.Default.Int32Array)\n\t\t};\n\t}\n}", + "snippet": "valid = false;\n\t\t\terror = ErrorMessages.GetContainsTooMany(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", found.Count)\n\t\t\t\t.ReplaceToken(\"maximum\", limits.Max.Value);\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKe" + }, + { + "title": "src/JsonSchema/Keywords/ContentEncodingKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ContentEncodingKeyword.cs#L1-L68", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ContentEncodingKeyword.cs", + "startLine": 1, + "endLine": 68, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `contentEncoding`.\n/// \n/// \n/// This keyword indicates the encoding of the content of a string value. It does not perform any validation,\n/// but it does produce an annotation.\n/// \npublic class ContentEncodingKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ContentEncodingKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"contentEncoding\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ContentEncodingKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.String))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `contentEncoding`.\n/// \n/// \n/// This keyword indicates the encoding of the content of a string value. It does not pe" + }, + { + "title": "src/JsonSchema/Keywords/ContentMediaTypeKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ContentMediaTypeKeyword.cs#L1-L68", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ContentMediaTypeKeyword.cs", + "startLine": 1, + "endLine": 68, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `contentMediaType`.\n/// \n/// \n/// This keyword indicates the media type of the content of a string value. It does not perform any validation,\n/// but it does produce an annotation.\n/// \npublic class ContentMediaTypeKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ContentMediaTypeKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"contentMediaType\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ContentMediaTypeKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.String))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `contentMediaType`.\n/// \n/// \n/// This keyword indicates the media type of the content of a string value. It does not" + }, + { + "title": "src/JsonSchema/Keywords/ContentSchemaKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ContentSchemaKeyword.cs#L1-L68", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ContentSchemaKeyword.cs", + "startLine": 1, + "endLine": 68, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `contentSchema`.\n/// \n/// \n/// This keyword applies a subschema to the decoded content of a string. It does not perform any validation,\n/// but it does produce an annotation.\n/// \npublic class ContentSchemaKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ContentSchemaKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"contentSchema\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ContentSchemaKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a valid schema, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `contentSchema`.\n/// \n/// \n/// This keyword applies a subschema to the decoded content of a string. It does not perfo" + }, + { + "title": "src/JsonSchema/Keywords/DefaultKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/DefaultKeyword.cs#L1-L64", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/DefaultKeyword.cs", + "startLine": 1, + "endLine": 64, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `default`.\n/// \n/// \n/// This keyword provides a default value for an instance. It has no validation effect but produces an annotation.\n/// \npublic class DefaultKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static DefaultKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"default\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected DefaultKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `default`.\n/// \n/// \n/// This keyword provides a default value for an instance. It has no validation effect but produ" + }, + { + "title": "src/JsonSchema/Keywords/DefsKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/DefsKeyword.cs#L1-L81", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/DefsKeyword.cs", + "startLine": 1, + "endLine": 81, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$defs`.\n/// \n/// \n/// This keyword is used to hold schema definitions for reuse. It produces neither validation nor annotation results.\n/// \npublic class DefsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static DefsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"$defs\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected DefsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}\");\n\n\t\tif (value.EnumerateObject().Any(x => x.Value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False)))\n\t\t\tthrow new JsonSchemaException(\"Values must be valid schemas\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar subschemas = new List();\n\t\tforeach (var definition in keyword.RawValue.EnumerateObject())\n\t\t{\n\t\t\tvar defContext = context with\n\t\t\t{\n\t\t\t\tLocalSchema = definition.Value,\n\t\t\t\tRelativePath = JsonPointer.Create(definition.Name)\n\t\t\t};\n\t\t\tsubschemas.Add(JsonSchema.BuildNode(defContext));\n\t\t}\n\n\t\tkeyword.Subschemas = subschemas.ToArray();\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn KeywordEvaluation.Ignore;\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$defs`.\n/// \n/// \n/// This keyword is used " + }, + { + "title": "src/JsonSchema/Keywords/DependentRequiredKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/DependentRequiredKeyword.cs#L1-L118", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/DependentRequiredKeyword.cs", + "startLine": 1, + "endLine": 118, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `dependentRequired`.\n/// \n/// \n/// This keyword specifies that if a property is present in an object, then other properties must also be present.\n/// The value of this keyword is an object where each key is a property name, and each value is an array of\n/// strings representing the required properties.\n/// \npublic class DependentRequiredKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static DependentRequiredKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"dependentRequired\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected DependentRequiredKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}\");\n\n\t\tforeach (var x in value.EnumerateObject())\n\t\t{\n\t\t\tif (x.Value.ValueKind is not JsonValueKind.Array ||\n\t\t\t x.Value.EnumerateArray().Any(y => y.ValueKind is not JsonValueKind.String))\n\t\t\t\tthrow new JsonSchemaException(\"Values must be arrays of strings\");\n\t\t}\n\n\t\tvar required = value\n\t\t\t.EnumerateObject()\n\t\t\t.ToDictionary(x => x.Name, x => x.Value.EnumerateArray().Select(y => y.GetString()!).ToArray());\n\n\t\treturn required;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.Object) return KeywordEvaluation.Ignore;\n\n\t\tHashSet? missing = null;\n\n\t\tvar required = (Dictionary)keyword.Value!;\n\t\tforeach (var property in required)\n\t\t{\n\t\t\tif (!context.Instance.TryGetProperty(property.Key, out _)) continue;\n\n\t\t\tforeach (var requiredProperty in property.Value)\n\t\t\t{\n\t\t\t\tif (context.Instance.TryGetProperty(requiredProperty, out _)) continue;\n\n\t\t\t\tif (context.CanOptimize)\n\t\t\t\t{\n\t\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t\t{\n\t\t\t\t\t\tKeyword = Name,\n\t\t\t\t\t\tIsValid = false\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tmissing ??= [];\n\t\t\t\tmissing.Add(requiredProperty);\n\t\t\t}\n\t\t}\n\n\t\tif (missing is null or { Count: 0 })\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetDependentRequired(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"missing\", missing, JsonSchemaSerializerContext.Default.HashSetString)\n\t\t};\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `dependentRequired`.\n/// \n/// \n/// This keyword specifies that i" + }, + { + "title": "src/JsonSchema/Keywords/DependentSchemasKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/DependentSchemasKeyword.cs#L1-L119", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/DependentSchemasKeyword.cs", + "startLine": 1, + "endLine": 119, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `dependentSchemas`.\n/// \n/// \n/// This keyword specifies that if a property is present in an object, then the instance (the full object, not the property's\n/// value) must be valid against the corresponding subschema.\n/// \npublic class DependentSchemasKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static DependentSchemasKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"dependentSchemas\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected DependentSchemasKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}\");\n\n\t\tif (value.EnumerateObject().Any(x => x.Value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False)))\n\t\t\tthrow new JsonSchemaException(\"Values must be valid schemas\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar subschemas = new List();\n\t\tvar propertyNames = new HashSet();\n\t\tforeach (var definition in keyword.RawValue.EnumerateObject())\n\t\t{\n\t\t\tvar defContext = context with\n\t\t\t{\n\t\t\t\tLocalSchema = definition.Value,\n\t\t\t\tRelativePath = JsonPointer.Create(definition.Name)\n\t\t\t};\n\t\t\tsubschemas.Add(JsonSchema.BuildNode(defContext));\n\t\t\tpropertyNames.Add(definition.Name);\n\t\t}\n\n\t\tkeyword.Subschemas = subschemas.ToArray();\n\t\tkeyword.Value = propertyNames;\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Object) return KeywordEvaluation.Ignore;\n\n\t\tvar propertyNames = (HashSet)keyword.Value!;\n\t\tvar subschemaEvaluations = new List();\n\n\t\tforeach (var property in context.Instance.EnumerateObject())\n\t\t{\n\t\t\tif (!propertyNames.Contains(property.Name)) continue;\n\n\t\t\tvar schemaIndex = Array.FindIndex(keyword.Subschemas, s => s.RelativePath[0].ToString() == property.Name);\n\t\t\tif (schemaIndex == -1) continue;\n\n\t\t\tvar propContext = context with\n\t\t\t{\n\t\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name, property.Name)\n\t\t\t};\n\n\t\t\tvar local = keyword.Subschemas[schemaIndex].Evaluate(propContext);\n\t\t\tsubschemaEvaluations.Add(local);\n\n\t\t\tif (context.CanOptimize && !local.IsValid)\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false\n\t\t\t\t};\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray()\n\t\t};\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `dependentSchemas`.\n/// \n/// \n" + }, + { + "title": "src/JsonSchema/Keywords/DeprecatedKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/DeprecatedKeyword.cs#L1-L67", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/DeprecatedKeyword.cs", + "startLine": 1, + "endLine": 67, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `deprecated`.\n/// \n/// \n/// This keyword indicates that the instance is deprecated. It has no validation effect but produces an annotation.\n/// \npublic class DeprecatedKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static DeprecatedKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"deprecated\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected DeprecatedKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a boolean, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `deprecated`.\n/// \n/// \n/// This keyword indicates that the instance is deprecated. It has no validation effect but p" + }, + { + "title": "src/JsonSchema/Keywords/DescriptionKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/DescriptionKeyword.cs#L1-L67", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/DescriptionKeyword.cs", + "startLine": 1, + "endLine": 67, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `description`.\n/// \n/// \n/// This keyword is used to provide a human-readable description of a schema. It has no validation effect but produces an annotation.\n/// \npublic class DescriptionKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static DescriptionKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"description\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected DescriptionKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.String))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `description`.\n/// \n/// \n/// This keyword is used to provide a human-readable description of a schema. It has no vali" + }, + { + "title": "src/JsonSchema/Keywords/Draft06/AdditionalItemsKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft06/AdditionalItemsKeyword.cs#L1-L107", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft06/AdditionalItemsKeyword.cs", + "startLine": 1, + "endLine": 107, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `additionalItems`.\n/// \n/// \n/// This keyword is used to validate items in an array not covered by the `items` keyword.\n/// \npublic class AdditionalItemsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static AdditionalItemsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"additionalItems\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected AdditionalItemsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a valid schema, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tif (context.LocalSchema.TryGetProperty(\"items\", out var items) &&\n\t\t items.ValueKind != JsonValueKind.Array) return;\n\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Value = items.ValueKind == JsonValueKind.Undefined\n\t\t\t? null\n\t\t\t: items.EnumerateArray().Count(); // how is there a .GetPropertyCount(), but not a .GetItemCount()?\n\t\tkeyword.Subschemas = [node];\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Array) return KeywordEvaluation.Ignore;\n\n\t\tvar itemsCount = (int?)keyword.Value;\n\t\tif (itemsCount is null) return KeywordEvaluation.Ignore;\n\n\t\tvar subschemaEvaluations = new List();\n\t\tvar subschema = keyword.Subschemas[0];\n\n\t\tvar evaluationPath = context.EvaluationPath.Combine(Name);\n\t\tvar i = itemsCount.Value;\n\t\tforeach (var instance in context.Instance.EnumerateArray().Skip(itemsCount.Value))\n\t\t{\n\t\t\tvar itemContext = context with\n\t\t\t{\n\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(i),\n\t\t\t\tInstance = instance,\n\t\t\t\tEvaluationPath = evaluationPath.Combine(Name)\n\t\t\t};\n\n\t\t\tsubschemaEvaluations.Add(subschema.Evaluate(itemContext));\n\t\t\ti++;\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray(),\n\t\t\tAnnotation = JsonElementExtensions.True\n\t\t};\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `additionalItems`.\n/// \n/// \n/// This keyword is used to" + }, + { + "title": "src/JsonSchema/Keywords/Draft06/ContainsKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft06/ContainsKeyword.cs#L1-L89", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft06/ContainsKeyword.cs", + "startLine": 1, + "endLine": 89, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `contains`.\n/// \n/// \n/// This keyword is used to validate that an array contains at least one item that matches the subschema.\n/// \npublic class ContainsKeyword : Json.Schema.Keywords.ContainsKeyword\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic new static ContainsKeyword Instance { get; set; } = new();\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ContainsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic override void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Subschemas = [node];\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic override KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Array) return KeywordEvaluation.Ignore;\n\n\t\tvar subschemaEvaluations = new List();\n\t\tvar subschema = keyword.Subschemas[0];\n\n\t\tvar evaluationPath = context.EvaluationPath.Combine(Name);\n\t\tvar i = 0;\n\t\tforeach (var instance in context.Instance.EnumerateArray())\n\t\t{\n\t\t\tvar itemContext = context with\n\t\t\t{\n\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(i),\n\t\t\t\tInstance = instance,\n\t\t\t\tEvaluationPath = evaluationPath.Combine(Name)\n\t\t\t};\n\n\t\t\tsubschemaEvaluations.Add(subschema.Evaluate(itemContext));\n\t\t\ti++;\n\t\t}\n\n\t\tvar found = subschemaEvaluations.Any(x => x.IsValid);\n\t\tstring? error = null;\n\t\tif (found)\n\t\t{\n\t\t\terror = ErrorMessages.GetContainsTooFew(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", found)\n\t\t\t\t.ReplaceToken(\"minimum\", 1);\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = found,\n\t\t\tDetails = subschemaEvaluations.ToArray(),\n\t\t\tError = error\n\t\t};\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `contains`.\n/// \n/// \n/// This keyword is used to valida" + }, + { + "title": "src/JsonSchema/Keywords/Draft06/DefinitionsKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft06/DefinitionsKeyword.cs#L1-L82", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft06/DefinitionsKeyword.cs", + "startLine": 1, + "endLine": 82, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `definitions`.\n/// \n/// \n/// This keyword is used to define subschemas that can be referenced from elsewhere in the schema.\n/// \npublic class DefinitionsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static DefinitionsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"definitions\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected DefinitionsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}\");\n\n\t\tif (value.EnumerateObject().Any(x => x.Value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False)))\n\t\t\tthrow new JsonSchemaException(\"Values must be valid schemas\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar subschemas = new List();\n\t\tforeach (var definition in keyword.RawValue.EnumerateObject())\n\t\t{\n\t\t\tvar defContext = context with\n\t\t\t{\n\t\t\t\tLocalSchema = definition.Value,\n\t\t\t\tRelativePath = JsonPointer.Create(definition.Name)\n\t\t\t};\n\t\t\tsubschemas.Add(JsonSchema.BuildNode(defContext));\n\t\t}\n\n\t\tkeyword.Subschemas = subschemas.ToArray();\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn KeywordEvaluation.Ignore;\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `definitions`.\n/// \n/// \n/// Handles `dependencies`.\n/// \n/// \n/// This keyword defines requirements for an object instance on the condition that given properties are present.\n/// If a property is present, then its value represents a requirement. That requirement may be an array of other\n/// required properties or a subschema that the instance (the full object, not the value of the property) must pass.\n/// \npublic class DependenciesKeyword : IKeywordHandler\n{\n\t/// \n\t/// Represents a dependency, which can be either a schema or a list of required properties.\n\t/// \n\tprotected struct SchemaOrPropertyList\n\t{\n\t\t/// \n\t\t/// The schema dependency.\n\t\t/// \n\t\tpublic JsonSchemaNode? Schema { get; }\n\t\t/// \n\t\t/// The property dependency.\n\t\t/// \n\t\tpublic string[]? Requirements { get; }\n\n\t\t/// \n\t\t/// Creates a new schema dependency.\n\t\t/// \n\t\t/// The schema.\n\t\tpublic SchemaOrPropertyList(JsonSchemaNode value)\n\t\t{\n\t\t\tSchema = value;\n\t\t}\n\n\t\t/// \n\t\t/// Creates a new property dependency.\n\t\t/// \n\t\t/// The list of required properties.\n\t\tpublic SchemaOrPropertyList(string[] requirements)\n\t\t{\n\t\t\tRequirements = requirements;\n\t\t}\n\t}\n\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static DependenciesKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"dependencies\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected DependenciesKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}\");\n\n\t\tforeach (var x in value.EnumerateObject())\n\t\t{\n\t\t\tif (x.Value.ValueKind is JsonValueKind.Array &&\n\t\t\t !x.Value.EnumerateArray().Any(y => y.ValueKind is not JsonValueKind.String)) continue;\n\n\t\t\tif (x.Value.ValueKind is (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False)) continue;\n\n\t\t\tthrow new JsonSchemaException(\"Values must be an arrays of strings or a valid schemas\");\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar dependencies = new Dictionary();\n\t\tvar subschemas = new List();\n\t\tforeach (var property in keyword.RawValue.EnumerateObject())\n\t\t{\n\t\t\tif (property.Value.ValueKind is JsonValueKind.Array)\n\t\t\t{\n\t\t\t\tvar requirements = property.Value.EnumerateArray().Select(x => x.GetString()!).ToArray();\n\t\t\t\tdependencies.Add(property.Name, new SchemaOrPropertyList(requirements));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar defContext = context with\n\t\t\t\t{\n\t\t\t\t\tLocalSchema = property.Value,\n\t\t\t\t\tRelativePath = JsonPointer.Create(property.Name)\n\t\t\t\t};\n\t\t\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\t\t\tdependencies.Add(property.Name, new SchemaOrPropertyList(node));\n\t\t\t\tsubschemas.Add(node);\n\t\t\t}\n\t\t}\n\t\tkeyword.Value = dependencies;\n\t\tkeyword.Subschemas = subschemas.ToArray();", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `dependencies`.\n/// \n/// \n/// This k" + }, + { + "title": "src/JsonSchema/Keywords/Draft06/DependenciesKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft06/DependenciesKeyword.cs#L121-L182", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft06/DependenciesKeyword.cs", + "startLine": 121, + "endLine": 182, + "content": "}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.Object) return KeywordEvaluation.Ignore;\n\n\t\tHashSet? missing = null;\n\n\t\tList? subschemaEvaluations = null;\n\t\tvar dependencies = (Dictionary)keyword.Value!;\n\t\tforeach (var dependency in dependencies)\n\t\t{\n\t\t\tif (!context.Instance.TryGetProperty(dependency.Key, out _)) continue;\n\n\t\t\tif (dependency.Value.Requirements is not null)\n\t\t\t{\n\t\t\t\tforeach (var requiredProperty in dependency.Value.Requirements)\n\t\t\t\t{\n\t\t\t\t\tif (context.Instance.TryGetProperty(requiredProperty, out _)) continue;\n\n\t\t\t\t\tmissing ??= [];\n\t\t\t\t\tmissing.Add(requiredProperty);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar propContext = context with\n\t\t\t\t{\n\t\t\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name, dependency.Key)\n\t\t\t\t};\n\n\t\t\t\tsubschemaEvaluations ??= [];\n\t\t\t\tsubschemaEvaluations.Add(dependency.Value.Schema!.Evaluate(propContext));\n\t\t\t}\n\t\t}\n\n\t\tif (missing is null or { Count: 0 } && (subschemaEvaluations is null || subschemaEvaluations.All(x => x.IsValid)))\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tDetails = subschemaEvaluations?.ToArray(),\n\t\t\tError = missing is null or { Count: 0 }\n\t\t\t\t? null\n\t\t\t\t: ErrorMessages.GetDependentRequired(context.Options.Culture)\n\t\t\t\t\t.ReplaceToken(\"missing\", missing, JsonSchemaSerializerContext.Default.HashSetString)\n\t\t};\n\t}\n}", + "snippet": "}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot b" + }, + { + "title": "src/JsonSchema/Keywords/Draft06/FormatKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft06/FormatKeyword.cs#L1-L73", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft06/FormatKeyword.cs", + "startLine": 1, + "endLine": 73, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `format`.\n/// \n/// \n/// This keyword is used to validate the format of a value. Typically, this value is a string, but may be of any JSON type.\n/// \npublic class FormatKeyword : Json.Schema.Keywords.FormatKeyword\n{\n\tprivate readonly bool _requireFormatValidation;\n\n\t/// \n\t/// Gets an instance that just annotates.\n\t/// \n\tpublic static FormatKeyword Annotate { get; set; } = new(false);\n\t/// \n\t/// Gets an instance that validates.\n\t/// \n\tpublic static FormatKeyword Validate { get; set; } = new(true);\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\t/// Whether to require format validation.\n\tprotected FormatKeyword(bool requireFormatValidation)\n\t{\n\t\t_requireFormatValidation = requireFormatValidation;\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic override object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.String))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic override void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic override KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Options.RequireFormatValidation || _requireFormatValidation)\n\t\t\treturn base.Evaluate(keyword, context);\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `format`.\n/// \n/// \n/// This keyword is used to validate the format of a value. Typically, this value is a s" + }, + { + "title": "src/JsonSchema/Keywords/Draft06/IdKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft06/IdKeyword.cs#L1-L56", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft06/IdKeyword.cs", + "startLine": 1, + "endLine": 56, + "content": "using System;\nusing System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `id`.\n/// \n/// \n/// This keyword is used to set the base URI for a schema or to identify a location-independent identifier\n/// for a subschema.\n/// \npublic partial class IdKeyword : Json.Schema.Keywords.IdKeyword\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic new static IdKeyword Instance { get; } = new();\n\n#if NET7_0_OR_GREATER\n\t/// \n\t/// The pattern for valid anchor identifiers.\n\t/// \n\tpublic Regex AnchorPattern { get; } = GetAnchorPatternRegex();\n\t[GeneratedRegex(\"^[A-Za-z][-A-Za-z0-9.:_]*$\", RegexOptions.Compiled)]\n\tprivate static partial Regex GetAnchorPatternRegex();\n#else\n\t/// \n\t/// The pattern for valid anchor identifiers.\n\t/// \n\tpublic Regex AnchorPattern { get; } = new(\"^[A-Za-z][-A-Za-z0-9.:_]*$\", RegexOptions.Compiled);\n#endif\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected IdKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic override object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.String || \n\t\t !Uri.TryCreate(value.GetString(), UriKind.RelativeOrAbsolute, out var uri))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' requires a string in the format of a URI\");\n\n\t\treturn uri;\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `id`.\n/// \n/// \n/// This keyword is used to set the base " + }, + { + "title": "src/JsonSchema/Keywords/Draft06/ItemsKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft06/ItemsKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft06/ItemsKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `items`.\n/// \n/// \n/// This keyword is used to validate items in an array. It may be a single subschema, which is evaluated against all\n/// items in the array, or an array of subsubschemas, which are evaluated in an index-matched manner.\n/// \npublic class ItemsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ItemsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"items\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ItemsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tswitch (value.ValueKind)\n\t\t{\n\t\t\tcase JsonValueKind.True:\n\t\t\tcase JsonValueKind.False:\n\t\t\tcase JsonValueKind.Object:\n\t\t\t\treturn null;\n\t\t\tcase JsonValueKind.Array:\n\t\t\t\tif (value.EnumerateArray().Any(x => x.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False)))\n\t\t\t\t\tthrow new JsonSchemaException(\"Values must be valid schemas\");\n\t\t\t\treturn null;\n\t\t\tdefault:\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}\");\n\t\t}\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tif (keyword.RawValue.ValueKind is (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t{\n\t\t\tvar defContext = context with\n\t\t\t{\n\t\t\t\tLocalSchema = keyword.RawValue\n\t\t\t};\n\n\t\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\t\tkeyword.Subschemas = [node];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar subschemas = new List();\n\t\t\tvar index = 0;\n\t\t\tforeach (var definition in keyword.RawValue.EnumerateArray())\n\t\t\t{\n\t\t\t\tvar defContext = context with\n\t\t\t\t{\n\t\t\t\t\tLocalSchema = definition,\n\t\t\t\t\tRelativePath = JsonPointer.Create(index)\n\t\t\t\t};\n\t\t\t\tvar node = JsonSchema.BuildNode(defContext);\n\n\t\t\t\tsubschemas.Add(node);\n\t\t\t\tindex++;\n\t\t\t}\n\n\t\t\tkeyword.Subschemas = subschemas.ToArray();\n\t\t}\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Array) return KeywordEvaluation.Ignore;\n\n\t\tJsonElement annotation;\n\t\tvar subschemaEvaluations = new List();\n\t\tif (keyword.RawValue.ValueKind == JsonValueKind.Object)\n\t\t{\n\t\t\tvar subschema = keyword.Subschemas[0];\n\n\t\t\tvar evaluationPath = context.EvaluationPath.Combine(Name);\n\t\t\tvar i = 0;\n\t\t\tforeach (var instance in context.Instance.EnumerateArray())\n\t\t\t{\n\t\t\t\tvar itemContext = context with\n\t\t\t\t{\n\t\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(i),\n\t\t\t\t\tInstance = instance,\n\t\t\t\t\tEvaluationPath = evaluationPath\n\t\t\t\t};", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords.Draft06;\n\n/// \n/// Handles `items`.\n/// \n/// \n" + }, + { + "title": "src/JsonSchema/Keywords/Draft06/ItemsKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft06/ItemsKeyword.cs#L121-L159", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft06/ItemsKeyword.cs", + "startLine": 121, + "endLine": 159, + "content": "subschemaEvaluations.Add(subschema.Evaluate(itemContext));\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\tannotation = JsonElementExtensions.True;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar pairs = keyword.Subschemas.Zip(context.Instance.EnumerateArray(), (s, i) => (s, i));\n\n\t\t\tvar i = 0;\n\t\t\tforeach (var (subschema,instance) in pairs)\n\t\t\t{\n\t\t\t\tvar evaluationPath = context.EvaluationPath.Combine(i);\n\t\t\t\tvar itemContext = context with\n\t\t\t\t{\n\t\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(i),\n\t\t\t\t\tInstance = instance,\n\t\t\t\t\tEvaluationPath = evaluationPath.Combine(Name, i)\n\t\t\t\t};\n\n\t\t\t\tsubschemaEvaluations.Add(subschema.Evaluate(itemContext));\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\tannotation = (i - 1).AsJsonElement();\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray(),\n\t\t\tAnnotation = annotation\n\t\t};\n\t}\n}", + "snippet": "subschemaEvaluations.Add(subschema.Evaluate(itemContext));\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\tannotation = JsonElementExtensions.True;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar pairs = keyword.Subschemas.Zip(context.Instance.EnumerateArray(), (s, i) => (s, " + }, + { + "title": "src/JsonSchema/Keywords/Draft201909/AnchorKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft201909/AnchorKeyword.cs#L1-L39", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft201909/AnchorKeyword.cs", + "startLine": 1, + "endLine": 39, + "content": "using System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords.Draft201909;\n\n/// \n/// Handles `$anchor`.\n/// \n/// \n/// This keyword is used to define a location-independent identifier that can be referenced from elsewhere in the schema.\n/// \npublic partial class AnchorKeyword : Json.Schema.Keywords.AnchorKeyword\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic new static AnchorKeyword Instance { get; } = new();\n\n#if NET7_0_OR_GREATER\n\t/// \n\t/// The pattern for valid anchor identifiers.\n\t/// \n\tpublic override Regex AnchorPattern { get; } = GetAnchorPatternRegex();\n\t[GeneratedRegex(\"^[A-Za-z][-A-Za-z0-9.:_]*$\", RegexOptions.Compiled)]\n\tprivate static partial Regex GetAnchorPatternRegex();\n#else\n\t/// \n\t/// The pattern for valid anchor identifiers.\n\t/// \n\tpublic override Regex AnchorPattern { get; } = new(\"^[A-Za-z][-A-Za-z0-9.:_]*$\", RegexOptions.Compiled);\n#endif\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected AnchorKeyword()\n\t{\n\t}\n}", + "snippet": "using System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords.Draft201909;\n\n/// \n/// Handles `$anchor`.\n/// \n/// \n/// This keyword is used to define a location-independent identifier t" + }, + { + "title": "src/JsonSchema/Keywords/Draft201909/RecursiveAnchorKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft201909/RecursiveAnchorKeyword.cs#L1-L64", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft201909/RecursiveAnchorKeyword.cs", + "startLine": 1, + "endLine": 64, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft201909;\n\n/// \n/// Handles `$recursiveAnchor`.\n/// \n/// \n/// This keyword is used to create a recursive anchor that can be referenced by a recursive reference.\n/// \npublic class RecursiveAnchorKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static RecursiveAnchorKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"$recursiveAnchor\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected RecursiveAnchorKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\treturn value.ValueKind switch\n\t\t{\n\t\t\tJsonValueKind.True => true,\n\t\t\tJsonValueKind.False => false,\n\t\t\t_ => throw new JsonSchemaException($\"'{Name}' value must be a boolean, found {value.ValueKind}\")\n\t\t};\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn KeywordEvaluation.Ignore;\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft201909;\n\n/// \n/// Handles `$recursiveAnchor`.\n/// \n/// \n/// This keyword is used to create a recursive anchor that can be reference" + }, + { + "title": "src/JsonSchema/Keywords/Draft201909/RecursiveRefKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft201909/RecursiveRefKeyword.cs#L1-L92", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft201909/RecursiveRefKeyword.cs", + "startLine": 1, + "endLine": 92, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft201909;\n\n/// \n/// Handles `$recursiveRef`.\n/// \n/// \n/// This keyword is used to create a recursive reference to a schema.\n/// \npublic class RecursiveRefKeyword : RefKeyword\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic new static RecursiveRefKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic override string Name => \"$recursiveRef\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected RecursiveRefKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic override object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.String || !value.ValueEquals(\"#\"))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string with value '#', found {value.ValueKind}\");\n\n\t\tif (!Uri.TryCreate(value.GetString(), UriKind.RelativeOrAbsolute, out var uri))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a valid URI\");\n\n\t\treturn uri;\n\t}\n\n\tinternal override bool TryResolve(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar recursiveTarget = context.Options.SchemaRegistry.GetRecursive(context.BaseUri);\n\t\tif (recursiveTarget is not null)\n\t\t{\n\t\t\t// don't set the subschema because we may need to go deeper into the scope\n\t\t\tkeyword.Value = null;\n\t\t\treturn false;\n\t\t}\n\n\t\treturn base.TryResolve(keyword, context);\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic override KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar recursiveRef = keyword.Value is null;\n\t\tif (recursiveRef)\n\t\t{\n\t\t\tvar subschema = context.SchemaRegistry.GetRecursive(context.Scope);\n\t\t\tif (subschema is null)\n\t\t\t\tthrow new RefResolutionException(context.Scope.LocalScope, string.Empty, AnchorType.Recursive);\n\n\t\t\tvar refContext = context with\n\t\t\t{\n\t\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t\t};\n\n\t\t\tvar subschemaEvaluation = subschema.Evaluate(refContext);\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = subschemaEvaluation.IsValid,\n\t\t\t\tDetails = [subschemaEvaluation]\n\t\t\t};\n\t\t}\n\n\t\t// behaves like $ref\n\t\treturn base.Evaluate(keyword, context);\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft201909;\n\n/// \n/// Handles `$recursiveRef`.\n/// \n/// \n/// This keyword is used to create a recursive reference to a sc" + }, + { + "title": "src/JsonSchema/Keywords/Draft201909/UnevaluatedItemsKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft201909/UnevaluatedItemsKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft201909/UnevaluatedItemsKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft201909;\n\n/// \n/// Handles `unevaluatedItems`.\n/// \n/// \n/// This keyword validates items in an array that are not evaluated by `items`, `additionalItems`, or other `unevaluatedItems`\n/// keywords that are found either in the local subschema directly or in subschemas of the local schema which produce a true\n/// validation result.\n/// \npublic class UnevaluatedItemsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static UnevaluatedItemsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"unevaluatedItems\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected UnevaluatedItemsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a valid schema, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Subschemas = [node];\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Array) return KeywordEvaluation.Ignore;\n\n\t\tvar (all, lastIndex) = GetLastEvaluatedIndex(context);\n\t\tif (all)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true,\n\t\t\t\tAnnotation = JsonElementExtensions.True\n\t\t\t};\n\n\t\tvar subschemaEvaluations = new List();\n\t\tvar subschema = keyword.Subschemas[0];\n\n\t\tvar i = 0;\n\t\tforeach (var instance in context.Instance.EnumerateArray().Skip(lastIndex + 1))\n\t\t{\n\t\t\tvar itemContext = context with\n\t\t\t{\n\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(i),\n\t\t\t\tInstance = instance,\n\t\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t\t};\n\n\t\t\tsubschemaEvaluations.Add(subschema.Evaluate(itemContext));\n\t\t\ti++;\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray(),\n\t\t\tAnnotation = JsonElementExtensions.True\n\t\t};\n\t}\n\n\tprivate static (bool All, int Some) GetLastEvaluatedIndex(EvaluationContext context)\n\t{\n\t\tif (context.EvaluatedKeywords?.Any(x => x.Keyword == \"additionalItems\") ?? false)\n\t\t\treturn (true, 0);\n\n\t\tvar index = -1;\n\n\t\tvar itemsAnnotation = context.EvaluatedKeywords?.SingleOrDefault(x => x.Keyword == \"items\");\n\t\tif (itemsAnnotation?.Annotation is not null)\n\t\t{\n\t\t\tif (itemsAnnotation.Value.Annotation.Value.ValueKind is JsonValueKind.True)\n\t\t\t\treturn (true, 0);", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft201909;\n\n/// \n/// Handles `unevaluatedItems`.\n/// \n/// \n/// This" + }, + { + "title": "src/JsonSchema/Keywords/Draft201909/UnevaluatedItemsKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft201909/UnevaluatedItemsKeyword.cs#L121-L167", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft201909/UnevaluatedItemsKeyword.cs", + "startLine": 121, + "endLine": 167, + "content": "index = itemsAnnotation.Value.Annotation.Value.GetInt32();\n\t\t}\n\n\t\tvar details = context.EvaluatedKeywords?\n\t\t\t.SelectMany(x => x.Details ?? [])\n\t\t\t.Where(x => x.IsValid && x.InstanceLocation == context.InstanceLocation) ?? [];\n\n\t\tvar all = false;\n\t\tforeach (var detail in details)\n\t\t{\n\t\t\tall |= GetNestedEvaluatedProperties(detail, ref index);\n\t\t\tif (all) break;\n\t\t}\n\n\t\treturn (all, index);\n\t}\n\n\tprivate static bool GetNestedEvaluatedProperties(EvaluationResults results, ref int index)\n\t{\n\t\tif (results.Annotations is not null)\n\t\t{\n\t\t\tif (results.Annotations.ContainsKey(\"additionalItems\") ||\n\t\t\t results.Annotations.ContainsKey(\"unevaluatedItems\"))\n\t\t\t\treturn true;\n\n\t\t\tif (results.Annotations.TryGetValue(\"items\", out var itemsAnnotation))\n\t\t\t{\n\t\t\t\tif (itemsAnnotation.ValueKind == JsonValueKind.True) return true;\n\n\t\t\t\tindex = Math.Max(index, itemsAnnotation.GetInt32());\n\t\t\t}\n\t\t}\n\n\t\tvar details = results.Details?\n\t\t\t.Where(x => x.IsValid && x.InstanceLocation == results.InstanceLocation) ?? [];\n\n\t\tvar all = false;\n\t\tforeach (var detail in details)\n\t\t{\n\t\t\tall |= GetNestedEvaluatedProperties(detail, ref index);\n\t\t\tif (all) break;\n\t\t}\n\n\t\treturn all;\n\t}\n}", + "snippet": "index = itemsAnnotation.Value.Annotation.Value.GetInt32();\n\t\t}\n\n\t\tvar details = context.EvaluatedKeywords?\n\t\t\t.SelectMany(x => x.Details ?? [])\n\t\t\t.Where(x => x.IsValid && x.InstanceLocation == context.InstanceLocation) " + }, + { + "title": "src/JsonSchema/Keywords/Draft201909/VocabularyKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft201909/VocabularyKeyword.cs#L1-L75", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft201909/VocabularyKeyword.cs", + "startLine": 1, + "endLine": 75, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft201909;\n\n/// \n/// Handles `$vocabulary`.\n/// \n/// \n/// This keyword is used in the meta-schema to declare which vocabularies a schema uses.\n/// \npublic class VocabularyKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static VocabularyKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"$vocabulary\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected VocabularyKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' requires a object.\");\n\n\t\tforeach (var entry in value.EnumerateObject())\n\t\t{\n\t\t\tvar uri = entry.Name;\n\t\t\tvar required = entry.Value;\n\n\t\t\tif (!Uri.TryCreate(uri, UriKind.Absolute, out _))\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' keys must be absolute URIs.\");\n\t\t\tif (required.ValueKind is not (JsonValueKind.True or JsonValueKind.False))\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' values must be booleans.\");\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn KeywordEvaluation.Ignore;\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords.Draft201909;\n\n/// \n/// Handles `$vocabulary`.\n/// \n/// \n/// This keyword is used in the meta-schema to declare which vocab" + }, + { + "title": "src/JsonSchema/Keywords/Draft202012/DynamicRefKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft202012/DynamicRefKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft202012/DynamicRefKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords.Draft202012;\n\n/// \n/// Handles `$dynamicRef`.\n/// \n/// \n/// This keyword is used to create a dynamic reference to a schema.\n/// \npublic class DynamicRefKeyword : Json.Schema.Keywords.DynamicRefKeyword\n{\n\tprivate class DynamicRefInfo\n\t{\n\t\tpublic required Uri Uri { get; set; }\n\t\tpublic bool IsDynamic { get; set; }\n\t}\n\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic new static DynamicRefKeyword Instance { get; } = new();\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected DynamicRefKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic override object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.String)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\tif (!Uri.TryCreate(value.GetString(), UriKind.RelativeOrAbsolute, out var uri))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a valid URI\");\n\n\t\treturn new DynamicRefInfo { Uri = uri };\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic override void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar reference = (DynamicRefInfo)keyword.Value!;\n\t\tvar newUri = context.BaseUri.Resolve(reference.Uri);\n\n\t\treference.Uri = newUri; // need an absolute URI for .Fragment to work\n\t}\n\n\tinternal override bool TryResolve(KeywordData keyword, BuildContext context)\n\t{\n\t\t// This method only resolves static refs.\n\t\t// Occurs when (any of)\n\t\t// - the dynamic ref has a pointer fragment\n\t\t// - there is no dynamic anchor in the local schema resource\n\t\tvar reference = (DynamicRefInfo)keyword.Value!;\n\t\tvar fragment = reference.Uri.Fragment;\n\t\tvar fragmentIsPointer = JsonPointer.TryParse(fragment, out var pointerFragment);\n\t\tif (!fragmentIsPointer)\n\t\t{\n\t\t\t// check for local dynamic anchor\n\t\t\t// if there is one, reference is dynamic, so we leave\n\t\t\tvar anchorFragment = fragment[1..]; // drop #\n\t\t\tvar dynamicAnchor = context.Options.SchemaRegistry.GetDynamic(reference.Uri, anchorFragment);\n\t\t\tif (dynamicAnchor is not null)\n\t\t\t{\n\t\t\t\treference.IsDynamic = true;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\tJsonSchemaNode? targetSchema;\n\t\tif (fragmentIsPointer)\n\t\t{\n\t\t\tvar targetBase = context.Options.SchemaRegistry.Get(reference.Uri);\n\n\t\t\ttargetSchema = targetBase?.FindSubschema(pointerFragment, context);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar anchorFragment = fragment[1..]; // drop #\n\t\t\ttargetSchema = context.Options.SchemaRegistry.Get(reference.Uri, anchorFragment) ??\n\t\t\t\t\t\t // 2020-12 supports $dynamicAnchor also acting as an $anchor when $dynamicRef acts as $ref\n\t\t\t context.Options.SchemaRegistry.GetDynamic(reference.Uri, anchorFragment);\n\t\t}\n\n\t\tif (targetSchema is not null)\n\t\t{\n\t\t\tkeyword.Subschemas = [targetSchema];\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic override KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar reference = (DynamicRefInfo)keyword.Value!;\n\t\tJsonSchemaNode? subschema;\n\t\tif (reference.IsDynamic)\n\t\t{", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords.Draft202012;\n\n/// \n/// Handles `$dynamicRef`.\n/// \n/// \n/// This keyword is used to" + }, + { + "title": "src/JsonSchema/Keywords/Draft202012/DynamicRefKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/Draft202012/DynamicRefKeyword.cs#L121-L147", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/Draft202012/DynamicRefKeyword.cs", + "startLine": 121, + "endLine": 147, + "content": "var anchor = reference.Uri.Fragment[1..];\n\t\t\tsubschema = context.SchemaRegistry.GetDynamic(context.Scope, anchor);\n\t\t\tif (subschema is null)\n\t\t\t\tthrow new RefResolutionException(context.Scope.LocalScope, anchor, AnchorType.Dynamic);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsubschema = keyword.Subschemas.FirstOrDefault();\n\t\t\tif (subschema is null)\n\t\t\t\tthrow new RefResolutionException(reference.Uri);\n\t\t}\n\n\t\tvar refContext = context with\n\t\t{\n\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t};\n\n\t\tvar subschemaEvaluation = subschema.Evaluate(refContext);\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluation.IsValid,\n\t\t\tDetails = [subschemaEvaluation]\n\t\t};\n\t}\n}", + "snippet": "var anchor = reference.Uri.Fragment[1..];\n\t\t\tsubschema = context.SchemaRegistry.GetDynamic(context.Scope, anchor);\n\t\t\tif (subschema is null)\n\t\t\t\tthrow new RefResolutionException(context.Scope.LocalScope, anchor, AnchorTy" + }, + { + "title": "src/JsonSchema/Keywords/DynamicAnchorKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/DynamicAnchorKeyword.cs#L1-L85", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/DynamicAnchorKeyword.cs", + "startLine": 1, + "endLine": 85, + "content": "using System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$dynamicAnchor`.\n/// \n/// \n/// This keyword is used to create a named dynamic anchor at the current schema location.\n/// This anchor can be used with `$dynamicRef` to reference this schema. The `$dynamicAnchor` that will be resolved\n/// is the first occurence of the anchor being referenced found in the schema resources along the evaluation path.\n/// \npublic partial class DynamicAnchorKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static DynamicAnchorKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"$dynamicAnchor\";\n\n#if NET7_0_OR_GREATER\n\t/// \n\t/// Gets the regular expression for validating the anchor value.\n\t/// \n\tpublic virtual Regex AnchorPattern { get; } = GetAnchorPatternRegex();\n\t[GeneratedRegex(\"^[A-Za-z_][-A-Za-z0-9._]*$\", RegexOptions.Compiled)]\n\tprivate static partial Regex GetAnchorPatternRegex();\n#else\n\t/// \n\t/// Gets the regular expression for validating the anchor value.\n\t/// \n\tpublic virtual Regex AnchorPattern { get; } = new(\"^[A-Za-z_][-A-Za-z0-9._]*$\", RegexOptions.Compiled);\n#endif\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected DynamicAnchorKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.String)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\tvar anchor = value.GetString()!;\n\t\tif (!AnchorPattern.IsMatch(anchor))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value '{anchor}' must match '{AnchorPattern}'\");\n\n\t\treturn anchor;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn KeywordEvaluation.Ignore;\n\t}\n}", + "snippet": "using System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$dynamicAnchor`.\n/// \n/// \n/// This keyword is used to create a named dynamic " + }, + { + "title": "src/JsonSchema/Keywords/DynamicRefKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/DynamicRefKeyword.cs#L1-L117", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/DynamicRefKeyword.cs", + "startLine": 1, + "endLine": 117, + "content": "using System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$dynamicRef`.\n/// \n/// \n/// This keyword is used to reference a schema with a dynamic anchor. The resolution of the reference\n/// is dynamic, meaning it can change based on the context of the schema evaluation. The `$dynamicAnchor` that\n/// will be resolved is the first occurence of the anchor being referenced found in the schema resources along\n/// the evaluation path.\n/// \npublic partial class DynamicRefKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static DynamicRefKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"$dynamicRef\";\n\n#if NET7_0_OR_GREATER\n\t/// \n\t/// Gets the regular expression for validating the anchor value.\n\t/// \n\tpublic virtual Regex AnchorPattern { get; } = GetAnchorPatternRegex();\n\t[GeneratedRegex(\"^#[A-Za-z_][-A-Za-z0-9._]*$\", RegexOptions.Compiled)]\n\tprivate static partial Regex GetAnchorPatternRegex();\n#else\n\t/// \n\t/// Gets the regular expression for validating the anchor value.\n\t/// \n\tpublic virtual Regex AnchorPattern { get; } = new(\"^#[A-Za-z_][-A-Za-z0-9._]*$\", RegexOptions.Compiled);\n#endif\n\t// TODO: this is the correct version - uncomment before publishing\n//#if NET7_0_OR_GREATER\n//\tpublic virtual Regex AnchorPattern { get; } = GetAnchorPatternRegex();\n//\t[GeneratedRegex(\"^[A-Za-z_][-A-Za-z0-9._]*$\", RegexOptions.Compiled)]\n//\tprivate static partial Regex GetAnchorPatternRegex();\n//#else\n//\tpublic virtual Regex AnchorPattern { get; } = new(\"^[A-Za-z_][-A-Za-z0-9._]*$\", RegexOptions.Compiled);\n//#endif\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected DynamicRefKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.String)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\tvar anchor = value.GetString()!;\n\t\tif (!AnchorPattern.IsMatch(anchor))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must match '{AnchorPattern}'\");\n\n\t\treturn anchor[1..];\n\t\t// TODO: this is the correct version - uncomment after updating to latest test suite\n\t\t//return anchor;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\tinternal virtual bool TryResolve(KeywordData keyword, BuildContext context)\n\t{\n\t\t// nothing to do for v1 $dynamicRef\n\t\treturn true;\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar anchor = (string)keyword.Value!;\n\t\tvar subschema = context.SchemaRegistry.GetDynamic(context.Scope, anchor);\n\t\tif (subschema is null)\n\t\t\tthrow new RefResolutionException(context.Scope.LocalScope, anchor, AnchorType.Dynamic);\n\n\t\tvar refContext = context with\n\t\t{\n\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t};\n\n\t\tvar subschemaEvaluation = subschema.Evaluate(refContext);\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluation.IsValid,\n\t\t\tDetails = [subschemaEvaluation]\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$dynamicRef`.\n/// \n/// \n/// This keyword is used to reference a schema with a " + }, + { + "title": "src/JsonSchema/Keywords/ElseKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ElseKeyword.cs#L1-L88", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ElseKeyword.cs", + "startLine": 1, + "endLine": 88, + "content": "using System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `else`.\n/// \n/// \n/// This keyword is used in conjunction with `if` and `then`. If the `if` schema fails, then this schema is applied.\n/// It is ignored if there is no `if` keyword or if the `if` keyword's subschema passes validation.\n/// \n[DependsOnAnnotationsFrom(typeof(IfKeyword))]\npublic class ElseKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ElseKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"else\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ElseKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' values must be valid schemas.\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Subschemas = [node];\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar ifEvaluation = context.EvaluatedKeywords?\n\t\t\t.SingleOrDefault(x => x.Keyword == \"if\");\n\t\tif (ifEvaluation?.Keyword is null || ifEvaluation.Value.IsValid) return KeywordEvaluation.Ignore;\n\n\t\tvar subschema = keyword.Subschemas[0];\n\t\tvar oneOfContext = context with\n\t\t{\n\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t};\n\t\tvar result = subschema.Evaluate(oneOfContext);\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = result.IsValid,\n\t\t\tDetails = [result]\n\t\t};\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `else`.\n/// \n/// \n/// This keyword is used in conjunction with `if` and `then`. If the `if` schema" + }, + { + "title": "src/JsonSchema/Keywords/EnumKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/EnumKeyword.cs#L1-L81", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/EnumKeyword.cs", + "startLine": 1, + "endLine": 81, + "content": "using System.Linq;\nusing System.Text.Json;\nusing Json.More;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `enum`.\n/// \n/// \n/// This keyword specifies that the instance must be equal to one of the values in the keyword's array.\n/// \npublic class EnumKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static EnumKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"enum\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected EnumKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Array)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an array, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (!keyword.RawValue.EnumerateArray().Any(x => x.IsEquivalentTo(context.Instance)))\n\t\t{\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tIsValid = false,\n\t\t\t\tKeyword = Name,\n\t\t\t\tError = ErrorMessages.GetEnum(context.Options.Culture)\n\t\t\t\t\t.ReplaceToken(\"received\", context.Instance, JsonSchemaSerializerContext.Default.JsonElement)\n\t\t\t\t\t.ReplaceToken(\"values\", keyword.RawValue!, JsonSchemaSerializerContext.Default.JsonElement)\n\t\t\t};\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tIsValid = true,\n\t\t\tKeyword = Name\n\t\t};\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json;\nusing Json.More;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `enum`.\n/// \n/// \n/// This keyword specifies that the instance must be equal to o" + }, + { + "title": "src/JsonSchema/Keywords/ExamplesKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ExamplesKeyword.cs#L1-L67", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ExamplesKeyword.cs", + "startLine": 1, + "endLine": 67, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `examples`.\n/// \n/// \n/// This keyword is used to provide examples of valid instances. It has no validation effect but produces an annotation.\n/// \npublic class ExamplesKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ExamplesKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"examples\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ExamplesKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Array))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an array, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `examples`.\n/// \n/// \n/// This keyword is used to provide examples of valid instances. It has no validation effect bu" + }, + { + "title": "src/JsonSchema/Keywords/ExclusiveMaximumKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ExclusiveMaximumKeyword.cs#L1-L81", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ExclusiveMaximumKeyword.cs", + "startLine": 1, + "endLine": 81, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `exclusiveMaximum`.\n/// \n/// \n/// This keyword specifies that a numeric instance must be strictly less than the value of the keyword.\n/// \npublic class ExclusiveMaximumKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ExclusiveMaximumKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"exclusiveMaximum\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ExclusiveMaximumKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a number, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.Number) return KeywordEvaluation.Ignore;\n\n\t\tvar comparison = JsonMath.NumberCompare(context.Instance, keyword.RawValue);\n\n\t\tif (comparison < 0)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetExclusiveMaximum(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", context.Instance)\n\t\t\t\t.ReplaceToken(\"limit\", keyword.RawValue)\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `exclusiveMaximum`.\n/// \n/// \n/// This keyword specifies that a numeric instance must be strictly less than the value" + }, + { + "title": "src/JsonSchema/Keywords/ExclusiveMinimumKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ExclusiveMinimumKeyword.cs#L1-L81", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ExclusiveMinimumKeyword.cs", + "startLine": 1, + "endLine": 81, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `exclusiveMinimum`.\n/// \n/// \n/// This keyword specifies that a numeric instance must be strictly greater than the value of the keyword.\n/// \npublic class ExclusiveMinimumKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ExclusiveMinimumKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"exclusiveMinimum\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ExclusiveMinimumKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a number, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.Number) return KeywordEvaluation.Ignore;\n\n\t\tvar comparison = JsonMath.NumberCompare(context.Instance, keyword.RawValue);\n\n\t\tif (comparison > 0)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetExclusiveMinimum(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", context.Instance)\n\t\t\t\t.ReplaceToken(\"limit\", keyword.RawValue)\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `exclusiveMinimum`.\n/// \n/// \n/// This keyword specifies that a numeric instance must be strictly greater than the va" + }, + { + "title": "src/JsonSchema/Keywords/FormatKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/FormatKeyword.cs#L1-L76", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/FormatKeyword.cs", + "startLine": 1, + "endLine": 76, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `format`.\n/// \n/// \n/// This keyword validates that a string instance conforms to a predefined format. Custom formats may be used\n/// however they must be registered with . Unknown formats will cause a schema to fail the build step.\n/// \npublic class FormatKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static FormatKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"format\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected FormatKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.String))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar formatName = keyword.RawValue.GetString()!;\n\t\tvar format = context.Options.FormatRegistry.Get(formatName);\n\n\t\tvar valid = format.Validate(context.Instance, out var error);\n\t\tif (!valid)\n\t\t\terror ??= ErrorMessages.GetFormat(context.Options.Culture).ReplaceToken(\"format\", formatName);\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = valid,\n\t\t\tAnnotation = keyword.RawValue,\n\t\t\tError = error\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `format`.\n/// \n/// \n/// This keyword validates that a string instance conforms to a predefined format. Custom format" + }, + { + "title": "src/JsonSchema/Keywords/IdKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/IdKeyword.cs#L1-L71", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/IdKeyword.cs", + "startLine": 1, + "endLine": 71, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$id`.\n/// \n/// \n/// This keyword sets the base URI for the current schema, which is used to resolve relative references.\n/// \npublic class IdKeyword : IKeywordHandler //, IIdKeyword\n{\n\tprivate static readonly Uri _testUri = new(\"https://json-everything.test\");\n\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static IdKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"$id\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected IdKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.String || \n\t\t !Uri.TryCreate(value.GetString(), UriKind.RelativeOrAbsolute, out var uri))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' requires a string in the format of a URI\");\n\n\t\tvar testUri = _testUri.Resolve(uri);\n\t\tif (!string.IsNullOrEmpty(testUri.Fragment) && testUri.Fragment != \"#\")\n\t\t\tthrow new JsonSchemaException($\"'{Name}' must not contain a non-empty fragment\");\n\n\t\treturn uri;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn KeywordEvaluation.Ignore;\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$id`.\n/// \n/// \n/// This keyword sets the base URI for the current schema, which is used to resolve re" + }, + { + "title": "src/JsonSchema/Keywords/IfKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/IfKeyword.cs#L1-L84", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/IfKeyword.cs", + "startLine": 1, + "endLine": 84, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `if`.\n/// \n/// \n/// This keyword is used to conditionally apply subschemas. If the instance is valid against this schema,\n/// then the `then` schema is applied. Otherwise, the `else` schema is applied. Its subschema does not directly\n/// affect the validation result, meaning that its subschema can fail while the host subschema still passes.\n/// \npublic class IfKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static IfKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"if\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected IfKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' values must be valid schemas.\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Subschemas = [node];\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar subschema = keyword.Subschemas[0];\n\t\tvar oneOfContext = context with\n\t\t{\n\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t};\n\t\tvar result = subschema.Evaluate(oneOfContext);\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = result.IsValid,\n\t\t\tDetails = [result],\n\t\t\tContributesToValidation = false\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `if`.\n/// \n/// \n/// This keyword is used to conditionally apply subschemas. If the instance is valid against this sch" + }, + { + "title": "src/JsonSchema/Keywords/ItemsKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ItemsKeyword.cs#L1-L112", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ItemsKeyword.cs", + "startLine": 1, + "endLine": 112, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `items`.\n/// \n/// \n/// This keyword applies to the items in an array not covered by the `prefixItems` keyword.\n/// \npublic class ItemsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ItemsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"items\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ItemsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a valid schema, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Subschemas = [node];\n\n\t\tif (context.LocalSchema.TryGetProperty(\"prefixItems\", out var items))\n\t\t\tkeyword.Value = items.EnumerateArray().Count();\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Array) return KeywordEvaluation.Ignore;\n\n\t\tvar prefixItemsCount = (int?)keyword.Value ?? 0;\n\n\t\tvar subschemaEvaluations = new List();\n\t\tvar subschema = keyword.Subschemas[0];\n\n\t\tvar evaluationPath = context.EvaluationPath.Combine(Name);\n\t\tvar i = 0;\n\t\tforeach (var instance in context.Instance.EnumerateArray().Skip(prefixItemsCount))\n\t\t{\n\t\t\tvar itemContext = context with\n\t\t\t{\n\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(i),\n\t\t\t\tInstance = instance,\n\t\t\t\tEvaluationPath = evaluationPath.Combine(Name)\n\t\t\t};\n\n\t\t\tvar local = subschema.Evaluate(itemContext);\n\t\t\tsubschemaEvaluations.Add(local);\n\n\t\t\tif (context.CanOptimize && !local.IsValid)\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false\n\t\t\t\t};\n\n\t\t\ti++;\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray(),\n\t\t\tAnnotation = JsonElementExtensions.True\n\t\t};\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `items`.\n/// \n/// \n/// This keyword applies to the items in an a" + }, + { + "title": "src/JsonSchema/Keywords/MaxContainsKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/MaxContainsKeyword.cs#L1-L73", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/MaxContainsKeyword.cs", + "startLine": 1, + "endLine": 73, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `maxContains`.\n/// \n/// \n/// This keyword specifies the maximum number of items in an array that must be valid against the `contains` schema.\n/// \npublic class MaxContainsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static MaxContainsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"maxContains\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected MaxContainsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a integer, found {value.ValueKind}\");\n\n\t\tvar number = value.GetDouble();\n\t\tvar rounded = Math.Truncate(number);\n\t\tif (number != rounded)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a integer, found {value.ValueKind}\");\n\n\t\tvar max = (long)rounded;\n\t\tif (max < 0)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be non-negative, found {max}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn KeywordEvaluation.Ignore;\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `maxContains`.\n/// \n/// \n/// This keyword specifies the maximum number of items in an array that must b" + }, + { + "title": "src/JsonSchema/Keywords/MaximumKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/MaximumKeyword.cs#L1-L81", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/MaximumKeyword.cs", + "startLine": 1, + "endLine": 81, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `maximum`.\n/// \n/// \n/// This keyword specifies that a numeric instance must be less than or equal to the value of the keyword.\n/// \npublic class MaximumKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static MaximumKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"maximum\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected MaximumKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a number, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.Number) return KeywordEvaluation.Ignore;\n\n\t\tvar comparison = JsonMath.NumberCompare(context.Instance, keyword.RawValue);\n\n\t\tif (comparison <= 0)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetMaximum(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", context.Instance)\n\t\t\t\t.ReplaceToken(\"limit\", keyword.RawValue)\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `maximum`.\n/// \n/// \n/// This keyword specifies that a numeric instance must be less than or equal to the value of th" + }, + { + "title": "src/JsonSchema/Keywords/MaxItemsKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/MaxItemsKeyword.cs#L1-L93", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/MaxItemsKeyword.cs", + "startLine": 1, + "endLine": 93, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `maxItems`.\n/// \n/// \n/// This keyword specifies the maximum number of items in an array.\n/// \npublic class MaxItemsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static MaxItemsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"maxItems\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected MaxItemsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a integer, found {value.ValueKind}\");\n\n\t\tvar number = value.GetDouble();\n\t\tvar rounded = Math.Truncate(number);\n\t\tif (number != rounded)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a integer, found {value.ValueKind}\");\n\n\t\tvar max = (long)rounded;\n\t\tif (max < 0)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be non-negative, found {max}\");\n\n\t\treturn max;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.Array) return KeywordEvaluation.Ignore;\n\n\t\tvar instance = context.Instance.EnumerateArray().Count();\n\t\tvar max = (long)keyword.Value!;\n\n\t\tif (instance <= max)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetMaxItems(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", instance)\n\t\t\t\t.ReplaceToken(\"limit\", max)\n\t\t};\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `maxItems`.\n/// \n/// \n/// This keyword specifies the maximum number of items in an a" + }, + { + "title": "src/JsonSchema/Keywords/MaxLengthKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/MaxLengthKeyword.cs#L1-L94", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/MaxLengthKeyword.cs", + "startLine": 1, + "endLine": 94, + "content": "using System;\nusing System.Globalization;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `maxLength`.\n/// \n/// \n/// This keyword specifies the maximum length of a string.\n/// \npublic class MaxLengthKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static MaxLengthKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"maxLength\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected MaxLengthKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a number, found {value.ValueKind}\");\n\n\t\tvar number = value.GetDouble();\n\t\tvar rounded = Math.Truncate(number);\n\t\tif (number != rounded)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a integer, found {value.ValueKind}\");\n\n\t\tvar max = (long)rounded;\n\t\tif (max < 0)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be non-negative, found {max}\");\n\n\t\treturn max;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.String) return KeywordEvaluation.Ignore;\n\n\t\tvar str = context.Instance.GetString();\n\t\tvar length = new StringInfo(str!).LengthInTextElements;\n\t\tvar max = (long)keyword.Value!;\n\n\t\tif (length <= max)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetMaxLength(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", length)\n\t\t\t\t.ReplaceToken(\"limit\", max)\n\t\t};\n\t}\n}", + "snippet": "using System;\nusing System.Globalization;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `maxLength`.\n/// \n/// \n/// This keyword specifies the maximum length of a s" + }, + { + "title": "src/JsonSchema/Keywords/MaxPropertiesKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/MaxPropertiesKeyword.cs#L1-L92", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/MaxPropertiesKeyword.cs", + "startLine": 1, + "endLine": 92, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `maxProperties`.\n/// \n/// \n/// This keyword specifies the maximum number of properties in an object.\n/// \npublic class MaxPropertiesKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static MaxPropertiesKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"maxProperties\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected MaxPropertiesKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a number, found {value.ValueKind}\");\n\n\t\tvar number = value.GetDouble();\n\t\tvar rounded = Math.Truncate(number);\n\t\tif (number != rounded)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a integer, found {value.ValueKind}\");\n\n\t\tvar max = (long)rounded;\n\t\tif (max < 0)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be non-negative, found {max}\");\n\n\t\treturn max;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.Object) return KeywordEvaluation.Ignore;\n\n\t\tvar instance = context.Instance.GetPropertyCount();\n\t\tvar max = (long)keyword.Value!;\n\n\t\tif (instance <= max)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetMaxProperties(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", instance)\n\t\t\t\t.ReplaceToken(\"limit\", max)\n\t\t};\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `maxProperties`.\n/// \n/// \n/// This keyword specifies the maximum number of properties in an object.\n//" + }, + { + "title": "src/JsonSchema/Keywords/MinContainsKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/MinContainsKeyword.cs#L1-L72", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/MinContainsKeyword.cs", + "startLine": 1, + "endLine": 72, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `minContains`.\n/// \n/// \n/// This keyword specifies the minimum number of items in an array that must be valid against the `contains` schema.\n/// \npublic class MinContainsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static MinContainsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"minContains\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected MinContainsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a number, found {value.ValueKind}\");\n\n\t\tvar number = value.GetDouble();\n\t\tvar rounded = Math.Truncate(number);\n\t\tif (number != rounded)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a integer, found {value.ValueKind}\");\n\n\t\tvar min = (long)rounded;\n\t\tif (min < 0)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be non-negative, found {min}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn KeywordEvaluation.Ignore;\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `minContains`.\n/// \n/// \n/// This keyword specifies the minimum number of items in an array that must b" + }, + { + "title": "src/JsonSchema/Keywords/MinimumKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/MinimumKeyword.cs#L1-L80", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/MinimumKeyword.cs", + "startLine": 1, + "endLine": 80, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `minimum`.\n/// \n/// \n/// This keyword specifies that a numeric instance must be greater than or equal to the value of the keyword.\n/// \npublic class MinimumKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static MinimumKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"minimum\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected MinimumKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a number, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.Number) return KeywordEvaluation.Ignore;\n\n\t\tvar comparison = JsonMath.NumberCompare(context.Instance, keyword.RawValue);\n\n\t\tif (comparison >= 0)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetMinimum(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", context.Instance)\n\t\t\t\t.ReplaceToken(\"limit\", keyword.RawValue)\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `minimum`.\n/// \n/// \n/// This keyword specifies that a numeric instance must be greater than or equal to the value of" + }, + { + "title": "src/JsonSchema/Keywords/MinItemsKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/MinItemsKeyword.cs#L1-L92", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/MinItemsKeyword.cs", + "startLine": 1, + "endLine": 92, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `minItems`.\n/// \n/// \n/// This keyword specifies the minimum number of items in an array.\n/// \npublic class MinItemsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static MinItemsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"minItems\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected MinItemsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a number, found {value.ValueKind}\");\n\n\t\tvar number = value.GetDouble();\n\t\tvar rounded = Math.Truncate(number);\n\t\tif (number != rounded)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a integer, found {value.ValueKind}\");\n\n\t\tvar min = (long)rounded;\n\t\tif (min < 0)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be non-negative, found {min}\");\n\n\t\treturn min;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.Array) return KeywordEvaluation.Ignore;\n\n\t\tvar instance = context.Instance.EnumerateArray().Count();\n\t\tvar min = (long)keyword.Value!;\n\n\t\tif (min <= instance)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetMinItems(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", instance)\n\t\t\t\t.ReplaceToken(\"limit\", min)\n\t\t};\n\t}\n}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `minItems`.\n/// \n/// \n/// This keyword specifies the minimum number of items in an a" + }, + { + "title": "src/JsonSchema/Keywords/MinLengthKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/MinLengthKeyword.cs#L1-L93", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/MinLengthKeyword.cs", + "startLine": 1, + "endLine": 93, + "content": "using System;\nusing System.Globalization;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `minLength`.\n/// \n/// \n/// This keyword specifies the minimum length of a string.\n/// \npublic class MinLengthKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static MinLengthKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"minLength\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected MinLengthKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a number, found {value.ValueKind}\");\n\n\t\tvar number = value.GetDouble();\n\t\tvar rounded = Math.Truncate(number);\n\t\tif (number != rounded)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a integer, found {value.ValueKind}\");\n\n\t\tvar min = (long)rounded;\n\t\tif (min < 0)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be non-negative, found {min}\");\n\n\t\treturn min;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.String) return KeywordEvaluation.Ignore;\n\n\t\tvar str = context.Instance.GetString();\n\t\tvar length = new StringInfo(str!).LengthInTextElements; \n\t\tvar min = (long)keyword.Value!;\n\n\t\tif (min <= length)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetMinLength(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", length)\n\t\t\t\t.ReplaceToken(\"limit\", min)\n\t\t};\n\t}\n}", + "snippet": "using System;\nusing System.Globalization;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `minLength`.\n/// \n/// \n/// This keyword specifies the minimum length of a s" + }, + { + "title": "src/JsonSchema/Keywords/MinPropertiesKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/MinPropertiesKeyword.cs#L1-L91", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/MinPropertiesKeyword.cs", + "startLine": 1, + "endLine": 91, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `minProperties`.\n/// \n/// \n/// This keyword specifies the minimum number of properties in an object.\n/// \npublic class MinPropertiesKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static MinPropertiesKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"minProperties\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected MinPropertiesKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a number, found {value.ValueKind}\");\n\n\t\tvar number = value.GetDouble();\n\t\tvar rounded = Math.Truncate(number);\n\t\tif (number != rounded)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a integer, found {value.ValueKind}\");\n\n\t\tvar min = (long)rounded;\n\t\tif (min < 0)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be non-negative, found {min}\");\n\n\t\treturn min;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.Object) return KeywordEvaluation.Ignore;\n\n\t\tvar instance = context.Instance.GetPropertyCount();\n\t\tvar min = (long)keyword.Value!;\n\n\t\tif (min <= instance)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetMinProperties(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", instance)\n\t\t\t\t.ReplaceToken(\"limit\", min)\n\t\t};\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `minProperties`.\n/// \n/// \n/// This keyword specifies the minimum number of properties in an object.\n//" + }, + { + "title": "src/JsonSchema/Keywords/MultipleOfKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/MultipleOfKeyword.cs#L1-L79", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/MultipleOfKeyword.cs", + "startLine": 1, + "endLine": 79, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `multipleOf`.\n/// \n/// \n/// This keyword specifies that a numeric instance must be a multiple of the value of the keyword.\n/// \npublic class MultipleOfKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static MultipleOfKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"multipleOf\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected MultipleOfKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Number)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a number, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.Number) return KeywordEvaluation.Ignore;\n\n\t\tif (JsonMath.Divides(context.Instance, keyword.RawValue))\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetMultipleOf(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"received\", context.Instance)\n\t\t\t\t.ReplaceToken(\"divisor\", keyword.RawValue)\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `multipleOf`.\n/// \n/// \n/// This keyword specifies that a numeric instance must be a multiple of the value of the key" + }, + { + "title": "src/JsonSchema/Keywords/NotKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/NotKeyword.cs#L1-L81", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/NotKeyword.cs", + "startLine": 1, + "endLine": 81, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `not`.\n/// \n/// \n/// This keyword specifies that an instance must not be valid against the subschema.\n/// \npublic class NotKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static NotKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"not\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected NotKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' values must be valid schemas.\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Subschemas = [node];\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar subschema = keyword.Subschemas[0];\n\t\tvar oneOfContext = context with\n\t\t{\n\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t};\n\t\tvar result = subschema.Evaluate(oneOfContext);\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = !result.IsValid,\n\t\t\tDetails = [result]\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `not`.\n/// \n/// \n/// This keyword specifies that an instance must not be valid against the subschema.\n/// \n" + }, + { + "title": "src/JsonSchema/Keywords/OneOfKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/OneOfKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/OneOfKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `oneOf`.\n/// \n/// \n/// This keyword specifies that an instance must be valid against exactly one of the subschemas.\n/// \npublic class OneOfKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static OneOfKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"oneOf\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected OneOfKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Array)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an array, found {value.ValueKind}.\");\n\n\t\tvar count = 0;\n\t\tforeach (var x in value.EnumerateArray())\n\t\t{\n\t\t\tif (x.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' values must be valid schemas.\");\n\t\t\tcount++;\n\t\t}\n\n\t\tif (count == 0)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' requires at least one subschema.\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar subschemas = new List();\n\t\tvar index = 0;\n\t\tforeach (var definition in keyword.RawValue.EnumerateArray())\n\t\t{\n\t\t\tvar defContext = context with\n\t\t\t{\n\t\t\t\tLocalSchema = definition,\n\t\t\t\tRelativePath = JsonPointer.Create(index)\n\t\t\t};\n\t\t\tsubschemas.Add(JsonSchema.BuildNode(defContext));\n\t\t\tindex++;\n\t\t}\n\n\t\tkeyword.Subschemas = subschemas.ToArray();\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar subschemaEvaluations = new List();\n\n\t\tvar i = 0;\n\t\tvar validCount = 0;\n\t\tforeach (var subschema in keyword.Subschemas)\n\t\t{\n\t\t\tvar itemContext = context with\n\t\t\t{\n\t\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name, i)\n\t\t\t};\n\n\t\t\tvar local = subschema.Evaluate(itemContext);\n\t\t\tsubschemaEvaluations.Add(local);\n\t\t\tif (local.IsValid)\n\t\t\t\tvalidCount++;\n\n\t\t\tif (context.CanOptimize && validCount > 1)\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false\n\t\t\t\t};\n\n\t\t\ti++;\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count(x => x.IsValid) == 1,\n\t\t\tDetails = subschemaEvaluations.ToArray()\n\t\t\t// TODO: add error message\n\t\t};", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `oneOf`.\n/// \n/// \n/// This keyword specifie" + }, + { + "title": "src/JsonSchema/Keywords/OneOfKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/OneOfKeyword.cs#L121-L123", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/OneOfKeyword.cs", + "startLine": 121, + "endLine": 123, + "content": "}\n}", + "snippet": "}\n}" + }, + { + "title": "src/JsonSchema/Keywords/PatternKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/PatternKeyword.cs#L1-L84", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/PatternKeyword.cs", + "startLine": 1, + "endLine": 84, + "content": "using System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `pattern`.\n/// \n/// \n/// This keyword validates that a string instance matches a regular expression.\n/// \npublic class PatternKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static PatternKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"pattern\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected PatternKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.String)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\tvar regex = RegexOrPattern.CreateRegex(value.GetString()!, true);\n\n\t\treturn regex;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.String) return KeywordEvaluation.Ignore;\n\n\t\tvar regex = (Regex)keyword.Value!;\n\t\tvar str = context.Instance.GetString()!;\n\n\t\tif (regex.IsMatch(str))\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetPattern(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"pattern\", regex.ToString())\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `pattern`.\n/// \n/// \n/// This keyword validates that a string instance matches " + }, + { + "title": "src/JsonSchema/Keywords/PatternPropertiesKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/PatternPropertiesKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/PatternPropertiesKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.RegularExpressions;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `patternProperties`.\n/// \n/// \n/// This keyword validates properties that match a regular expression against a subschema. A property whose name matches a\n/// regular expression key must have a value that validates against that regular expression's subschema. A given property may match\n/// multiple regular expressions and may also be validated by the `properties` keyword.\n/// \npublic class PatternPropertiesKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static PatternPropertiesKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"patternProperties\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected PatternPropertiesKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}\");\n\n\t\tvar regexes = new Dictionary();\n\n\t\tforeach (var x in value.EnumerateObject())\n\t\t{\n\t\t\tif (x.Value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\t\tthrow new JsonSchemaException(\"Values must be valid schemas\");\n\n\t\t\tregexes.Add(x.Name, RegexOrPattern.CreateRegex(x.Name, true));\n\t\t}\n\n\t\treturn regexes;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar subschemas = new List();\n\t\tforeach (var definition in keyword.RawValue.EnumerateObject())\n\t\t{\n\t\t\tvar defContext = context with\n\t\t\t{\n\t\t\t\tLocalSchema = definition.Value,\n\t\t\t\tRelativePath = JsonPointer.Create(definition.Name)\n\t\t\t};\n\t\t\tsubschemas.Add(JsonSchema.BuildNode(defContext));\n\t\t}\n\n\t\tkeyword.Subschemas = subschemas.ToArray();\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Object) return KeywordEvaluation.Ignore;\n\n\t\tvar regexes = (Dictionary)keyword.Value!;\n\t\tvar subschemaEvaluations = new List();\n\t\tvar propertyNames = new HashSet();\n\n\t\tvar properties = context.Instance.EnumerateObject().ToArray();\n\n\t\tforeach (var subschema in keyword.Subschemas)\n\t\t{\n\t\t\tvar pattern = subschema.RelativePath[subschema.RelativePath.SegmentCount - 1].ToString();\n\t\t\tvar regex = regexes[pattern];\n\n\t\t\tvar evaluationPath = context.EvaluationPath.Combine(Name, pattern);\n\n\t\t\tforeach (var property in properties)\n\t\t\t{\n\t\t\t\tif (!regex.IsMatch(property.Name)) continue;\n\n\t\t\t\tpropertyNames.Add(property.Name);\n\n\t\t\t\tvar propContext = context with\n\t\t\t\t{\n\t\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(property.Name),\n\t\t\t\t\tInstance = property.Value,\n\t\t\t\t\tEvaluationPath = evaluationPath\n\t\t\t\t};\n\n\t\t\t\tvar local = subschema.Evaluate(propContext);\n\t\t\t\tsubschemaEvaluations.Add(local);\n\n\t\t\t\tif (context.CanOptimize && !local.IsValid)", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.RegularExpressions;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `patternPro" + }, + { + "title": "src/JsonSchema/Keywords/PatternPropertiesKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/PatternPropertiesKeyword.cs#L121-L138", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/PatternPropertiesKeyword.cs", + "startLine": 121, + "endLine": 138, + "content": "return new KeywordEvaluation\n\t\t\t\t\t{\n\t\t\t\t\t\tKeyword = Name,\n\t\t\t\t\t\tIsValid = false\n\t\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray(),\n\t\t\tAnnotation = JsonSerializer.SerializeToElement(propertyNames, JsonSchemaSerializerContext.Default.HashSetString)\n\t\t};\n\t}\n}", + "snippet": "return new KeywordEvaluation\n\t\t\t\t\t{\n\t\t\t\t\t\tKeyword = Name,\n\t\t\t\t\t\tIsValid = false\n\t\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations" + }, + { + "title": "src/JsonSchema/Keywords/PrefixItemsKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/PrefixItemsKeyword.cs#L1-L118", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/PrefixItemsKeyword.cs", + "startLine": 1, + "endLine": 118, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `prefixItems`.\n/// \n/// \n/// This keyword validates that the first _n_ items of an array are valid against the first _n_ subschemas by index-matching.\n/// \npublic class PrefixItemsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static PrefixItemsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"prefixItems\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected PrefixItemsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Array)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an array, found {value.ValueKind}\");\n\n\t\tif (value.EnumerateArray().Any(x => x.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False)))\n\t\t\tthrow new JsonSchemaException(\"Values must be valid schemas\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar subschemas = new List();\n\t\tvar index = 0;\n\t\tforeach (var definition in keyword.RawValue.EnumerateArray())\n\t\t{\n\t\t\tvar defContext = context with\n\t\t\t{\n\t\t\t\tLocalSchema = definition,\n\t\t\t\tRelativePath = JsonPointer.Create(index)\n\t\t\t};\n\t\t\tsubschemas.Add(JsonSchema.BuildNode(defContext));\n\t\t\tindex++;\n\t\t}\n\n\t\tkeyword.Subschemas = subschemas.ToArray();\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Array) return KeywordEvaluation.Ignore;\n\n\t\tvar subschemaEvaluations = new List();\n\t\tvar pairs = keyword.Subschemas.Zip(context.Instance.EnumerateArray(), (s, i) => (s, i));\n\n\t\tvar i = 0;\n\t\tforeach (var (subschema, instance) in pairs)\n\t\t{\n\t\t\tvar itemContext = context with\n\t\t\t{\n\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(i),\n\t\t\t\tInstance = instance,\n\t\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name, i)\n\t\t\t};\n\n\t\t\tvar local = subschema.Evaluate(itemContext);\n\t\t\tsubschemaEvaluations.Add(local);\n\n\t\t\tif (context.CanOptimize && !local.IsValid)\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false\n\t\t\t\t};\n\n\t\t\ti++;\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray(),\n\t\t\tAnnotation = (subschemaEvaluations.Count - 1).AsJsonElement()\n\t\t};\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `prefixItems`.\n/// \n/// \n//" + }, + { + "title": "src/JsonSchema/Keywords/PropertiesKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/PropertiesKeyword.cs#L1-L117", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/PropertiesKeyword.cs", + "startLine": 1, + "endLine": 117, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `properties`.\n/// \n/// \n/// This keyword validates properties against subschemas.\n/// \npublic class PropertiesKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static PropertiesKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"properties\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected PropertiesKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}\");\n\n\t\tif (value.EnumerateObject().Any(x => x.Value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False)))\n\t\t\tthrow new JsonSchemaException(\"Values must be valid schemas\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar subschemas = new List();\n\t\tforeach (var property in keyword.RawValue.EnumerateObject())\n\t\t{\n\t\t\tvar defContext = context with\n\t\t\t{\n\t\t\t\tLocalSchema = property.Value,\n\t\t\t\tRelativePath = JsonPointer.Create(property.Name)\n\t\t\t};\n\t\t\tsubschemas.Add(JsonSchema.BuildNode(defContext));\n\t\t}\n\n\t\tkeyword.Subschemas = subschemas.ToArray();\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Object) return KeywordEvaluation.Ignore;\n\n\t\tvar subschemaEvaluations = new List();\n\t\tvar propertyNames = new HashSet();\n\n\t\tforeach (var subschema in keyword.Subschemas)\n\t\t{\n\t\t\tvar instance = subschema.RelativePath.Evaluate(context.Instance);\n\t\t\tif (!instance.HasValue) continue;\n\n\t\t\tvar propertyName = subschema.RelativePath[0].ToString();\n\t\t\tpropertyNames.Add(propertyName);\n\n\t\t\tvar propContext = context with\n\t\t\t{\n\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(subschema.RelativePath),\n\t\t\t\tInstance = instance.Value,\n\t\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name, propertyName)\n\t\t\t};\n\n\t\t\tvar local = subschema.Evaluate(propContext);\n\t\t\tsubschemaEvaluations.Add(local);\n\n\t\t\tif (context.CanOptimize && !local.IsValid)\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false\n\t\t\t\t};\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray(),\n\t\t\tAnnotation = JsonSerializer.SerializeToElement(propertyNames, JsonSchemaSerializerContext.Default.HashSetString)\n\t\t};\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `properties`.\n/// \n/// \n/// This keyword val" + }, + { + "title": "src/JsonSchema/Keywords/PropertyDependenciesKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/PropertyDependenciesKeyword.cs#L1-L100", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/PropertyDependenciesKeyword.cs", + "startLine": 1, + "endLine": 100, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles 'propertyDependencies'.\n/// \npublic class PropertyDependenciesKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"propertyDependencies\";\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.Object)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an object, found {value.ValueKind}\");\n\n\t\tforeach (var property in value.EnumerateObject())\n\t\t{\n\t\t\tif (property.Value.ValueKind != JsonValueKind.Object)\n\t\t\t\tthrow new JsonSchemaException($\"'{Name}' values must be objects with keys representing property values, found {value.ValueKind} under property {property.Name}\");\n\n\t\t\tif (property.Value.EnumerateObject().Any(x => x.Value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False)))\n\t\t\t\tthrow new JsonSchemaException($\"Values inside property values of {Name} must be valid schemas\");\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar subschemas = new List();\n\t\tforeach (var property in keyword.RawValue.EnumerateObject())\n\t\t{\n\t\t\tforeach (var value in property.Value.EnumerateObject())\n\t\t\t{\n\t\t\t\tvar defContext = context with\n\t\t\t\t{\n\t\t\t\t\tLocalSchema = value.Value,\n\t\t\t\t\tRelativePath = JsonPointer.Create(property.Name, value.Name)\n\t\t\t\t};\n\t\t\t\tsubschemas.Add(JsonSchema.BuildNode(defContext));\n\t\t\t}\n\t\t}\n\n\t\tkeyword.Subschemas = subschemas.ToArray();\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Object) return KeywordEvaluation.Ignore;\n\n\t\tvar propertyNames = (HashSet)keyword.Value!;\n\t\tvar subschemaEvaluations = new List();\n\n\t\tforeach (var property in context.Instance.EnumerateObject())\n\t\t{\n\t\t\tif (!propertyNames.Contains(property.Name)) continue;\n\n\t\t\tvar schemaIndex = Array.FindIndex(keyword.Subschemas, s => s.RelativePath[0].ToString() == property.Name);\n\t\t\tif (schemaIndex == -1) continue;\n\n\t\t\tvar propContext = context with\n\t\t\t{\n\t\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name, property.Name)\n\t\t\t};\n\n\t\t\tsubschemaEvaluations.Add(keyword.Subschemas[schemaIndex].Evaluate(propContext));\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray()\n\t\t};\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles 'propertyDependencies'.\n/// \npublic cla" + }, + { + "title": "src/JsonSchema/Keywords/PropertyNamesKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/PropertyNamesKeyword.cs#L1-L104", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/PropertyNamesKeyword.cs", + "startLine": 1, + "endLine": 104, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `propertyNames`.\n/// \n/// \n/// This keyword validates property names against a subschema.\n/// \npublic class PropertyNamesKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static PropertyNamesKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"propertyNames\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected PropertyNamesKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a valid schema, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Subschemas = [node];\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Object) return KeywordEvaluation.Ignore;\n\n\t\tvar subschemaEvaluations = new List();\n\t\tvar subschema = keyword.Subschemas[0];\n\n\t\tvar evaluationPath = context.EvaluationPath.Combine(Name);\n\t\tforeach (var instance in context.Instance.EnumerateObject())\n\t\t{\n\t\t\tvar itemContext = context with\n\t\t\t{\n\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(instance.Name),\n\t\t\t\tInstance = instance.Name.AsJsonElement(),\n\t\t\t\tEvaluationPath = evaluationPath\n\t\t\t};\n\n\t\t\tvar local = subschema.Evaluate(itemContext);\n\t\t\tsubschemaEvaluations.Add(local);\n\n\t\t\tif (context.CanOptimize && !local.IsValid)\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false\n\t\t\t\t};\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray()\n\t\t};\n\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `propertyNames`.\n/// \n/// \n/// This keyword val" + }, + { + "title": "src/JsonSchema/Keywords/ReadOnlyKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ReadOnlyKeyword.cs#L1-L67", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ReadOnlyKeyword.cs", + "startLine": 1, + "endLine": 67, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `readOnly`.\n/// \n/// \n/// This keyword is used to indicate that a property is read-only. It does not affect validation, but it does produce an annotation.\n/// \npublic class ReadOnlyKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ReadOnlyKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"readOnly\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ReadOnlyKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a boolean, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `readOnly`.\n/// \n/// \n/// This keyword is used to indicate that a property is read-only. It does not affect validati" + }, + { + "title": "src/JsonSchema/Keywords/RefKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/RefKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/RefKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$ref`.\n/// \n/// \n/// This keyword is used to reference another schema.\n/// \npublic class RefKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static RefKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic virtual string Name => \"$ref\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected RefKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.String)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\tif (!Uri.TryCreate(value.GetString(), UriKind.RelativeOrAbsolute, out var uri))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a valid URI\");\n\n\t\treturn uri;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar reference = (Uri)keyword.Value!;\n\t\tvar newUri = context.BaseUri.Resolve(reference);\n\n\t\tkeyword.Value = newUri;\n\t}\n\n\tinternal virtual bool TryResolve(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar newUri = (Uri?)keyword.Value;\n\t\tif (newUri is null) return false;\n\n\t\tvar fragment = newUri.Fragment;\n\n\t\tJsonSchemaNode? targetSchema;\n\t\tif (JsonPointer.TryParse(fragment, out var pointerFragment))\n\t\t{\n\t\t\tvar targetBase = context.Options.SchemaRegistry.Get(newUri);\n\n\t\t\tvar newContext = context with\n\t\t\t{\n\t\t\t\tBaseUri = newUri\n\t\t\t};\n\t\t\ttargetSchema = targetBase?.FindSubschema(pointerFragment, newContext);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar anchorFragment = fragment[1..]; // drop #\n\t\t\ttargetSchema = context.Options.SchemaRegistry.Get(newUri, anchorFragment);\n\t\t}\n\n\t\tif (targetSchema is not null)\n\t\t{\n\t\t\tkeyword.Subschemas = [targetSchema];\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar newUri = (Uri)keyword.Value!;\n\t\tvar subschema = keyword.Subschemas.FirstOrDefault();\n\t\tif (subschema is null)\n\t\t\tthrow new RefResolutionException(newUri);\n\n\t\tvar refContext = context with\n\t\t{\n\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t};\n\n\t\tvar subschemaEvaluation = subschema.Evaluate(refContext);\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluation.IsValid,\n\t\t\tDetails = [subschemaEvaluation]\n\t\t};\n\t}", + "snippet": "using System;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Pointer;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$ref`.\n/// \n/// \n/// This keyword is used to reference another " + }, + { + "title": "src/JsonSchema/Keywords/RefKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/RefKeyword.cs#L121-L122", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/RefKeyword.cs", + "startLine": 121, + "endLine": 122, + "content": "}", + "snippet": "}" + }, + { + "title": "src/JsonSchema/Keywords/RequiredKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/RequiredKeyword.cs#L1-L102", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/RequiredKeyword.cs", + "startLine": 1, + "endLine": 102, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Schema.Keywords.Draft06;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `required`.\n/// \n/// \n/// This keyword specifies which properties are required on an object.\n/// \npublic class RequiredKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static RequiredKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"required\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected RequiredKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not JsonValueKind.Array)\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an array, found {value.ValueKind}.\");\n\n\t\tif (!value.EnumerateArray().All(x => x.ValueKind is JsonValueKind.String))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be an array of strings.\");\n\n\t\treturn value.EnumerateArray().Select(x => x.GetString()!).ToArray();\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind is not JsonValueKind.Object) return KeywordEvaluation.Ignore;\n\n\t\tHashSet? missing = null;\n\n\t\tvar required = (string[])keyword.Value!;\n\t\tforeach (var requiredProperty in required)\n\t\t{\n\t\t\tif (context.Instance.TryGetProperty(requiredProperty, out _)) continue;\n\n\t\t\tif (context.CanOptimize)\n\t\t\t\treturn new KeywordEvaluation\n\t\t\t\t{\n\t\t\t\t\tKeyword = Name,\n\t\t\t\t\tIsValid = false\n\t\t\t\t};\n\n\t\t\tmissing ??= [];\n\t\t\tmissing.Add(requiredProperty);\n\t\t}\n\n\t\tif (missing is null or { Count: 0 })\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetRequired(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"missing\", missing, JsonSchemaSerializerContext.Default.HashSetString)\n\t\t};\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.Schema.Keywords.Draft06;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `required`.\n/// \n/// \n/// Th" + }, + { + "title": "src/JsonSchema/Keywords/SchemaKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/SchemaKeyword.cs#L1-L66", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/SchemaKeyword.cs", + "startLine": 1, + "endLine": 66, + "content": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$schema`.\n/// \n/// \n/// This keyword specifies the dialect of JSON Schema that the schema is written in. It will override the dialect specified\n/// in the build options.\n/// \npublic class SchemaKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static SchemaKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"$schema\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected SchemaKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind != JsonValueKind.String ||\n\t\t !Uri.TryCreate(value.GetString(), UriKind.Absolute, out var uri))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' requires a string in the format of an absolute URI.\");\n\n\t\treturn uri;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn KeywordEvaluation.Ignore;\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `$schema`.\n/// \n/// \n/// This keyword specifies the dialect of JSON Schema that the schema is written i" + }, + { + "title": "src/JsonSchema/Keywords/ThenKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/ThenKeyword.cs#L1-L88", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/ThenKeyword.cs", + "startLine": 1, + "endLine": 88, + "content": "using System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `then`.\n/// \n/// \n/// This keyword is used in conjunction with `if`. If `if` passes, then this keyword is evaluated.\n/// It is ignored if there is no `if` keyword or if the `if` keyword's subschema fails validation.\n/// \n[DependsOnAnnotationsFrom(typeof(IfKeyword))]\npublic class ThenKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static ThenKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"then\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected ThenKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' values must be valid schemas.\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Subschemas = [node];\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar ifEvaluation = context.EvaluatedKeywords?\n\t\t\t.SingleOrDefault(x => x.Keyword == \"if\");\n\t\tif (ifEvaluation?.Keyword is null || !ifEvaluation.Value.IsValid) return KeywordEvaluation.Ignore;\n\n\t\tvar subschema = keyword.Subschemas[0];\n\t\tvar oneOfContext = context with\n\t\t{\n\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t};\n\t\tvar result = subschema.Evaluate(oneOfContext);\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = result.IsValid,\n\t\t\tDetails = [result]\n\t\t};\n\t}\n}", + "snippet": "using System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `then`.\n/// \n/// \n/// This keyword is used in conjunction with `if`. If `if` passes, then this ke" + }, + { + "title": "src/JsonSchema/Keywords/TitleKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/TitleKeyword.cs#L1-L67", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/TitleKeyword.cs", + "startLine": 1, + "endLine": 67, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `title`.\n/// \n/// \n/// This keyword is used to provide a title for a schema. It has no validation effect but produces an annotation.\n/// \npublic class TitleKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static TitleKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"title\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected TitleKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.String))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a string, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `title`.\n/// \n/// \n/// This keyword is used to provide a title for a schema. It has no validation effect but produces" + }, + { + "title": "src/JsonSchema/Keywords/TypeKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/TypeKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/TypeKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `type`.\n/// \n/// \n/// This keyword validates the type of the instance.\n/// \npublic class TypeKeyword : IKeywordHandler\n{\n\tprivate static readonly ImmutableDictionary _types =\n\t\tnew Dictionary\n\t\t{\n\t\t\t{ \"array\", SchemaValueType.Array },\n\t\t\t{ \"object\", SchemaValueType.Object },\n\t\t\t{ \"string\", SchemaValueType.String },\n\t\t\t{ \"number\", SchemaValueType.Number },\n\t\t\t{ \"integer\", SchemaValueType.Integer },\n\t\t\t{ \"boolean\", SchemaValueType.Boolean },\n\t\t\t{ \"null\", SchemaValueType.Null }\n\t\t}.ToImmutableDictionary();\n\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static TypeKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"type\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected TypeKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind == JsonValueKind.String)\n\t\t{\n\t\t\tvar typeName = value.GetString();\n\t\t\tif (!_types.TryGetValue(typeName!, out var valueType))\n\t\t\t\tthrow new JsonSchemaException($\"'{typeName}' is not a valid JSON Schema value type\");\n\n\t\t\treturn valueType;\n\t\t}\n\n\t\tif (value.ValueKind == JsonValueKind.Array)\n\t\t{\n\t\t\tSchemaValueType finalType = 0;\n\t\t\tforeach (var typeElement in value.EnumerateArray())\n\t\t\t{\n\t\t\t\tif (typeElement.ValueKind != JsonValueKind.String)\n\t\t\t\t\tthrow new JsonSchemaException($\"A '{Name}' array may only contain strings\");\n\n\t\t\t\tvar type = typeElement.GetString()!;\n\t\t\t\tif (!_types.TryGetValue(type, out var valueType))\n\t\t\t\t\tthrow new JsonSchemaException($\"'{type}' is not a valid JSON Schema value type\");\n\n\t\t\t\tfinalType |= valueType;\n\t\t\t}\n\n\t\t\treturn finalType;\n\t\t}\n\n\t\tthrow new JsonSchemaException($\"'{Name}' must be either a string or an array of strings\");\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tvar instanceType = context.Instance.GetSchemaValueType();\n\t\tvar expectedType = (SchemaValueType)keyword.Value!;\n\t\tif (expectedType.HasFlag(instanceType))\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\tif (instanceType == SchemaValueType.Integer && expectedType.HasFlag(SchemaValueType.Number))\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true\n\t\t\t};\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = false,\n\t\t\tError = ErrorMessages.GetType(context.Options.Culture).\n\t\t\t\tReplaceToken(\"received\", instanceType, JsonSchemaSerializerContext.Default.SchemaValueType).\n\t\t\t\tReplaceToken(\"expected\", expectedType.ToString().ToLower())", + "snippet": "using System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `type`.\n/// \n/// \n/// This keyword validates th" + }, + { + "title": "src/JsonSchema/Keywords/TypeKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/TypeKeyword.cs#L121-L124", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/TypeKeyword.cs", + "startLine": 121, + "endLine": 124, + "content": "};\n\t}\n}", + "snippet": "};\n\t}\n}" + }, + { + "title": "src/JsonSchema/Keywords/UnevaluatedItemsKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/UnevaluatedItemsKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/UnevaluatedItemsKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `unevaluatedItems`.\n/// \n/// \n/// This keyword validates items in an array that are not evaluated by `prefixItems`, `items`, or other `unevaluatedItems`\n/// keywords that are found either in the local subschema directly or in subschemas of the local schema which produce a true\n/// validation result.\n/// \npublic class UnevaluatedItemsKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static UnevaluatedItemsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"unevaluatedItems\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected UnevaluatedItemsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a valid schema, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Subschemas = [node];\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Array) return KeywordEvaluation.Ignore;\n\n\t\tvar (all, lastIndex, others) = GetLastEvaluatedIndex(context);\n\t\tif (all)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true,\n\t\t\t\tAnnotation = JsonElementExtensions.True\n\t\t\t};\n\n\t\tvar subschemaEvaluations = new List();\n\t\tvar subschema = keyword.Subschemas[0];\n\n\t\tvar i = lastIndex + 1;\n\t\tforeach (var instance in context.Instance.EnumerateArray().Skip(lastIndex + 1))\n\t\t{\n\t\t\tif (!others.Contains(i))\n\t\t\t{\n\t\t\t\tvar itemContext = context with\n\t\t\t\t{\n\t\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(i),\n\t\t\t\t\tInstance = instance,\n\t\t\t\t\tEvaluationPath = context.EvaluationPath.Combine(Name)\n\t\t\t\t};\n\n\t\t\t\tsubschemaEvaluations.Add(subschema.Evaluate(itemContext));\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray(),\n\t\t\tAnnotation = JsonElementExtensions.True\n\t\t};\n\t}\n\n\tprivate static (bool All, int Some, HashSet Additional) GetLastEvaluatedIndex(EvaluationContext context)\n\t{\n\t\tif (context.EvaluatedKeywords?.Any(x => x.Keyword == \"items\") ?? false)\n\t\t\treturn (true, 0, []);\n\n\t\tvar index = context.EvaluatedKeywords?\n\t\t\t.SingleOrDefault(x => x.Keyword == \"prefixItems\")\n\t\t\t.Annotation?.GetInt32() ?? -1;", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `unevaluatedItems`.\n/// \n/// \n/// This keyword val" + }, + { + "title": "src/JsonSchema/Keywords/UnevaluatedItemsKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/UnevaluatedItemsKeyword.cs#L121-L175", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/UnevaluatedItemsKeyword.cs", + "startLine": 121, + "endLine": 175, + "content": "HashSet additional =\n\t\t[\n\t\t\t..context.EvaluatedKeywords?\n\t\t\t\t.SingleOrDefault(x => x.Keyword == \"contains\")\n\t\t\t\t.Annotation?.EnumerateArray().Select(x => x.GetInt32()) ?? []\n\t\t];\n\n\t\tvar details = context.EvaluatedKeywords?\n\t\t\t.SelectMany(x => x.Details ?? [])\n\t\t\t.Where(x => x.IsValid && x.InstanceLocation == context.InstanceLocation) ?? [];\n\n\t\tvar all = false;\n\t\tforeach (var detail in details)\n\t\t{\n\t\t\tall |= GetNestedEvaluatedProperties(detail, ref index, additional);\n\t\t\tif (all) break;\n\t\t}\n\n\t\treturn (all, index, additional);\n\t}\n\n\tprivate static bool GetNestedEvaluatedProperties(EvaluationResults results, ref int index, HashSet additional)\n\t{\n\t\tif (results.Annotations is not null)\n\t\t{\n\t\t\tif (results.Annotations.ContainsKey(\"items\") || \n\t\t\t results.Annotations.ContainsKey(\"unevaluatedItems\")) return true;\n\n\t\t\tif (results.Annotations.TryGetValue(\"prefixItems\", out var prefixItemsAnnotation))\n\t\t\t{\n\t\t\t\tindex = Math.Max(index, prefixItemsAnnotation.GetInt32());\n\t\t\t}\n\n\t\t\tif (results.Annotations.TryGetValue(\"contains\", out var containsAnnotation))\n\t\t\t{\n\t\t\t\tforeach (var i in containsAnnotation.EnumerateArray())\n\t\t\t\t{\n\t\t\t\t\tadditional.Add(i.GetInt32());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar details = results.Details?\n\t\t\t.Where(x => x.IsValid && x.InstanceLocation == results.InstanceLocation) ?? [];\n\n\t\tvar all = false;\n\t\tforeach (var detail in details)\n\t\t{\n\t\t\tall |= GetNestedEvaluatedProperties(detail, ref index, additional);\n\t\t\tif (all) break;\n\t\t}\n\n\t\treturn all;\n\t}\n}", + "snippet": "HashSet additional =\n\t\t[\n\t\t\t..context.EvaluatedKeywords?\n\t\t\t\t.SingleOrDefault(x => x.Keyword == \"contains\")\n\t\t\t\t.Annotation?.EnumerateArray().Select(x => x.GetInt32()) ?? []\n\t\t];\n\n\t\tvar details = context.EvaluatedKe" + }, + { + "title": "src/JsonSchema/Keywords/UnevaluatedPropertiesKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/UnevaluatedPropertiesKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/UnevaluatedPropertiesKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `unevaluatedProperties`.\n/// \n/// \n/// This keyword validates property values in an object that are not evaluated by `properties`, `patternProperties`,\n/// `additionalProperties`, or other `unevaluatedProperties` keywords that are found either in the local subschema\n/// directly or in subschemas of the local schema which produce a true validation result.\n/// \n[DependsOnAnnotationsFrom(typeof(PropertiesKeyword))]\n[DependsOnAnnotationsFrom(typeof(PatternPropertiesKeyword))]\n[DependsOnAnnotationsFrom(typeof(UnevaluatedPropertiesKeyword))]\npublic class UnevaluatedPropertiesKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static UnevaluatedPropertiesKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"unevaluatedProperties\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected UnevaluatedPropertiesKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.Object or JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a valid schema, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t\tvar defContext = context with\n\t\t{\n\t\t\tLocalSchema = keyword.RawValue\n\t\t};\n\n\t\tvar node = JsonSchema.BuildNode(defContext);\n\t\tkeyword.Subschemas = [node];\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Object) return KeywordEvaluation.Ignore;\n\n\t\tvar (all, evaluatedProperties) = GetEvaluatedProperties(context);\n\t\tif (all)\n\t\t\treturn new KeywordEvaluation\n\t\t\t{\n\t\t\t\tKeyword = Name,\n\t\t\t\tIsValid = true,\n\t\t\t\tAnnotation = JsonElementExtensions.True\n\t\t\t};\n\n\t\tvar subschemaEvaluations = new List();\n\t\tvar subschema = keyword.Subschemas[0];\n\n\t\tvar evaluationPath = context.EvaluationPath.Combine(Name);\n\t\tforeach (var instance in context.Instance.EnumerateObject())\n\t\t{\n\t\t\tif (evaluatedProperties!.Contains(instance.Name)) continue;\n\n\t\t\tvar itemContext = context with\n\t\t\t{\n\t\t\t\tInstanceLocation = context.InstanceLocation.Combine(instance.Name),\n\t\t\t\tInstance = instance.Value,\n\t\t\t\tEvaluationPath = evaluationPath\n\t\t\t};\n\n\t\t\tsubschemaEvaluations.Add(subschema.Evaluate(itemContext));\n\t\t}\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = subschemaEvaluations.Count == 0 || subschemaEvaluations.All(x => x.IsValid),\n\t\t\tDetails = subschemaEvaluations.ToArray(),\n\t\t\tAnnotation = JsonElementExtensions.True\n\t\t};\n\t}\n\n\tprivate static (bool All, HashSet? Some) GetEvaluatedProperties(EvaluationContext context)\n\t{\n\t\tif (context.EvaluatedKeywords?.Any(x => x.Keyword == \"additionalProperties\") ?? false)\n\t\t\treturn (true, null);\n\n\t\tvar properties = new HashSet();\n\t\tvar propertiesKeys = context.EvaluatedKeywords?\n\t\t\t.SingleOrDefault(x => x.Keyword == \"properties\")\n\t\t\t.Annotation?.EnumerateArray().Select(p => p.GetString()!) ?? [];", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `unevaluatedProperties`.\n/// \n/// \n/// This keyword validates pr" + }, + { + "title": "src/JsonSchema/Keywords/UnevaluatedPropertiesKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/UnevaluatedPropertiesKeyword.cs#L121-L181", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/UnevaluatedPropertiesKeyword.cs", + "startLine": 121, + "endLine": 181, + "content": "var patternPropertiesKeys = context.EvaluatedKeywords?\n\t\t\t.SingleOrDefault(x => x.Keyword == \"patternProperties\")\n\t\t\t.Annotation?.EnumerateArray().Select(p => p.GetString()!) ?? [];\n\n\t\tforeach (var property in propertiesKeys.Union(patternPropertiesKeys))\n\t\t{\n\t\t\tproperties.Add(property);\n\t\t}\n\n\t\tvar details = context.EvaluatedKeywords?\n\t\t\t.SelectMany(x => x.Details ?? [])\n\t\t\t.Where(x => x.IsValid && x.InstanceLocation == context.InstanceLocation) ?? [];\n\n\t\tvar all = false;\n\t\tforeach (var detail in details)\n\t\t{\n\t\t\tall |= GetNestedEvaluatedProperties(detail, properties);\n\t\t\tif (all) break;\n\t\t}\n\n\t\treturn (all, properties);\n\t}\n\n\tprivate static bool GetNestedEvaluatedProperties(EvaluationResults results, HashSet properties)\n\t{\n\t\tif (results.Annotations is not null)\n\t\t{\n\t\t\tif (results.Annotations.ContainsKey(\"additionalProperties\") ||\n\t\t\t results.Annotations.ContainsKey(\"unevaluatedProperties\"))\n\t\t\t\treturn true;\n\t\t\tif (results.Annotations.TryGetValue(\"properties\", out var propertiesAnnotation))\n\t\t\t{\n\t\t\t\tvar propertiesKeys = propertiesAnnotation.EnumerateArray().Select(x => x.GetString()!);\n\t\t\t\tforeach (var key in propertiesKeys)\n\t\t\t\t{\n\t\t\t\t\tproperties.Add(key);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (results.Annotations.TryGetValue(\"patternProperties\", out var patternPropertiesAnnotation))\n\t\t\t{\n\t\t\t\tvar patternPropertiesKeys = patternPropertiesAnnotation.EnumerateArray().Select(x => x.GetString()!);\n\t\t\t\tforeach (var key in patternPropertiesKeys)\n\t\t\t\t{\n\t\t\t\t\tproperties.Add(key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar details = results.Details?\n\t\t\t.Where(x => x.IsValid && x.InstanceLocation == results.InstanceLocation) ?? [];\n\n\t\tvar all = false;\n\t\tforeach (var detail in details)\n\t\t{\n\t\t\tall |= GetNestedEvaluatedProperties(detail, properties);\n\t\t\tif (all) break;\n\t\t}\n\n\t\treturn all;\n\t}\n}", + "snippet": "var patternPropertiesKeys = context.EvaluatedKeywords?\n\t\t\t.SingleOrDefault(x => x.Keyword == \"patternProperties\")\n\t\t\t.Annotation?.EnumerateArray().Select(p => p.GetString()!) ?? [];\n\n\t\tforeach (var property in properties" + }, + { + "title": "src/JsonSchema/Keywords/UniqueItemsKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/UniqueItemsKeyword.cs#L1-L116", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/UniqueItemsKeyword.cs", + "startLine": 1, + "endLine": 116, + "content": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `uniqueItems`.\n/// \n/// \n/// This keyword validates that all items in an array are unique.\n/// \npublic class UniqueItemsKeyword : IKeywordHandler\n{\n\tprivate class JsonElementEquivalenceComparer : IEqualityComparer\n\t{\n\t\tpublic bool Equals(JsonElement x, JsonElement y)\n\t\t{\n\t\t\treturn x.IsEquivalentTo(y);\n\t\t}\n\n\t\tpublic int GetHashCode(JsonElement obj)\n\t\t{\n\t\t\t// For numbers, use decimal value for hash to ensure 1, 1.0, 1.00 hash the same\n\t\t\tif (obj.ValueKind == JsonValueKind.Number)\n\t\t\t\treturn obj.GetDecimal().GetHashCode();\n\t\t\t\n\t\t\treturn obj.GetEquivalenceHashCode();\n\t\t}\n\t}\n\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static UniqueItemsKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"uniqueItems\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected UniqueItemsKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\treturn value.ValueKind switch\n\t\t{\n\t\t\tJsonValueKind.True => true,\n\t\t\tJsonValueKind.False => false,\n\t\t\t_ => throw new JsonSchemaException($\"'{Name}' value must be a boolean, found {value.ValueKind}\")\n\t\t};\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\tif (context.Instance.ValueKind != JsonValueKind.Array) return KeywordEvaluation.Ignore;\n\t\tif (keyword.RawValue.ValueKind == JsonValueKind.False) return KeywordEvaluation.Ignore;\n\n\t\tvar seen = new Dictionary(new JsonElementEquivalenceComparer());\n\t\tList? matches = null;\n\t\t\n\t\tvar i = 0;\n\t\tforeach (var item in context.Instance.EnumerateArray())\n\t\t{\n\t\t\tif (seen.TryGetValue(item, out var firstIndex))\n\t\t\t{\n\t\t\t\tmatches ??= [];\n\t\t\t\tmatches.Add($\"({firstIndex},{i})\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tseen[item] = i;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t\tvar valid = matches is null;\n\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = valid,\n\t\t\tError = valid\n\t\t\t\t? null\n\t\t\t\t: ErrorMessages.GetUniqueItems(context.Options.Culture)\n\t\t\t\t\t.ReplaceToken(\"duplicates\", matches!.ToArray())\n\t\t};\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Json.More;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `uniqueItems`.\n/// \n/// \n/// This keyword valid" + }, + { + "title": "src/JsonSchema/Keywords/WriteOnlyKeyword.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Keywords/WriteOnlyKeyword.cs#L1-L67", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Keywords/WriteOnlyKeyword.cs", + "startLine": 1, + "endLine": 67, + "content": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `writeOnly`.\n/// \n/// \n/// This keyword is used to indicate that a property is write-only. It does not affect validation, but it does produce an annotation.\n/// \npublic class WriteOnlyKeyword : IKeywordHandler\n{\n\t/// \n\t/// Gets the singleton instance of the .\n\t/// \n\tpublic static WriteOnlyKeyword Instance { get; } = new();\n\n\t/// \n\t/// Gets the name of the handled keyword.\n\t/// \n\tpublic string Name => \"writeOnly\";\n\n\t/// \n\t/// Initializes a new instance of the class.\n\t/// \n\tprotected WriteOnlyKeyword()\n\t{\n\t}\n\n\t/// \n\t/// Validates the specified JSON element as a keyword value and optionally returns a value to be shared across the other methods.\n\t/// \n\t/// The JSON element to validate and convert. Represents the value to be checked for keyword compliance.\n\t/// An object that is shared with the other methods. This object is saved to .\n\tpublic virtual object? ValidateKeywordValue(JsonElement value)\n\t{\n\t\tif (value.ValueKind is not (JsonValueKind.True or JsonValueKind.False))\n\t\t\tthrow new JsonSchemaException($\"'{Name}' value must be a boolean, found {value.ValueKind}\");\n\n\t\treturn null;\n\t}\n\n\t/// \n\t/// Builds and registers subschemas based on the specified keyword data within the provided build context.\n\t/// \n\t/// The keyword data used to determine which subschemas to build. Cannot be null.\n\t/// The context in which subschemas are constructed and registered. Cannot be null.\n\tpublic virtual void BuildSubschemas(KeywordData keyword, BuildContext context)\n\t{\n\t}\n\n\t/// \n\t/// Evaluates the specified keyword using the provided evaluation context and returns the result of the evaluation.\n\t/// \n\t/// The keyword data to be evaluated. Cannot be null.\n\t/// The context in which the keyword evaluation is performed. Cannot be null.\n\t/// A KeywordEvaluation object containing the results of the evaluation.\n\tpublic virtual KeywordEvaluation Evaluate(KeywordData keyword, EvaluationContext context)\n\t{\n\t\treturn new KeywordEvaluation\n\t\t{\n\t\t\tKeyword = Name,\n\t\t\tIsValid = true,\n\t\t\tAnnotation = keyword.RawValue\n\t\t};\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema.Keywords;\n\n/// \n/// Handles `writeOnly`.\n/// \n/// \n/// This keyword is used to indicate that a property is write-only. It does not affect valida" + }, + { + "title": "src/JsonSchema/MetaSchemas.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/MetaSchemas.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/MetaSchemas.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\n// ReSharper disable InconsistentNaming\n#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.\n\nnamespace Json.Schema;\n\n/// \n/// Provides access to well-known JSON Schema meta-schemas and their identifiers for supported specification drafts.\n/// \n/// This class exposes static properties representing the canonical URIs and parsed schema objects for\n/// various JSON Schema drafts, including Draft-06, Draft-07, Draft 2019-09, Draft 2020-12, the v1 releases.\npublic static class MetaSchemas\n{\n\t/// \n\t/// Gets the canonical URI identifying the JSON Schema Draft 6 specification.\n\t/// \n\tpublic static Uri Draft6Id { get; } = new(\"http://json-schema.org/draft-06/schema#\");\n\t/// \n\t/// Gets the meta-schema for the JSON Schema Draft 6 specification.\n\t/// \n\tpublic static JsonSchema Draft6 { get; internal set; }\n\n\t/// \n\t/// Gets the canonical URI identifying the JSON Schema Draft 7 specification.\n\t/// \n\tpublic static Uri Draft7Id { get; } = new(\"http://json-schema.org/draft-07/schema#\");\n\t/// \n\t/// Gets the meta-schema for the JSON Schema Draft 7 specification.\n\t/// \n\tpublic static JsonSchema Draft7 { get; internal set; }\n\n\t/// \n\t/// Gets the canonical URI identifying the JSON Schema Draft 2019-09 meta-schema.\n\t/// \n\tpublic static Uri Draft201909Id { get; } = new(\"https://json-schema.org/draft/2019-09/schema\");\n\t/// \n\t/// Gets the meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static JsonSchema Draft201909 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Applicator meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static Uri Applicator201909Id { get; } = new(\"https://json-schema.org/draft/2019-09/meta/applicator\");\n\t/// \n\t/// Gets the Applicator meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static JsonSchema Applicator201909 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Content meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static Uri Content201909Id { get; } = new(\"https://json-schema.org/draft/2019-09/meta/content\");\n\t/// \n\t/// Gets the Content meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static JsonSchema Content201909 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Core meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static Uri Core201909Id { get; } = new(\"https://json-schema.org/draft/2019-09/meta/core\");\n\t/// \n\t/// Gets the Core meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static JsonSchema Core201909 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Format meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static Uri Format201909Id { get; } = new(\"https://json-schema.org/draft/2019-09/meta/format\");\n\t/// \n\t/// Gets the Format meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static JsonSchema Format201909 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Meta-Data meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static Uri Metadata201909Id { get; } = new(\"https://json-schema.org/draft/2019-09/meta/meta-data\");\n\t/// \n\t/// Gets the Meta-Data meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static JsonSchema Metadata201909 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Validation meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static Uri Validation201909Id { get; } = new(\"https://json-schema.org/draft/2019-09/meta/validation\");\n\t/// \n\t/// Gets the Validation meta-schema for the JSON Schema Draft 2019-09 specification.\n\t/// \n\tpublic static JsonSchema Validation201909 { get; internal set; }\n\n\t/// \n\t/// Gets the canonical URI identifying the JSON Schema Draft 2020-12 meta-schema.\n\t/// \n\tpublic static Uri Draft202012Id { get; } = new(\"https://json-schema.org/draft/2020-12/schema\");\n\t/// \n\t/// Gets the meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static JsonSchema Draft202012 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Applicator meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static Uri Applicator202012Id { get; } = new(\"https://json-schema.org/draft/2020-12/meta/applicator\");\n\t/// \n\t/// Gets the Applicator meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static JsonSchema Applicator202012 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Content meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static Uri Content202012Id { get; } = new(\"https://json-schema.org/draft/2020-12/meta/content\");\n\t/// \n\t/// Gets the Content meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static JsonSchema Content202012 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Core meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static Uri Core202012Id { get; } = new(\"https://json-schema.org/draft/2020-12/meta/core\");\n\t/// \n\t/// Gets the Core meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static JsonSchema Core202012 { get; internal set; }", + "snippet": "using System;\n// ReSharper disable InconsistentNaming\n#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as n" + }, + { + "title": "src/JsonSchema/MetaSchemas.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/MetaSchemas.cs#L121-L174", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/MetaSchemas.cs", + "startLine": 121, + "endLine": 174, + "content": "/// \n\t/// Gets the canonical URI identifying the Format-Annotation meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static Uri FormatAnnotation202012Id { get; } = new(\"https://json-schema.org/draft/2020-12/meta/format-annotation\");\n\t/// \n\t/// Gets the Format-Annotation meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static JsonSchema FormatAnnotation202012 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Format-Assertion meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static Uri FormatAssertion202012Id { get; } = new(\"https://json-schema.org/draft/2020-12/meta/format-assertion\");\n\t/// \n\t/// Gets the Format-Assertion meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static JsonSchema FormatAssertion202012 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Meta-Data meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static Uri Metadata202012Id { get; } = new(\"https://json-schema.org/draft/2020-12/meta/meta-data\");\n\t/// \n\t/// Gets the Meta-Data meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static JsonSchema Metadata202012 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Unevaluated meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static Uri Unevaluated202012Id { get; } = new(\"https://json-schema.org/draft/2020-12/meta/unevaluated\");\n\t/// \n\t/// Gets the Unevaluated meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static JsonSchema Unevaluated202012 { get; internal set; }\n\t/// \n\t/// Gets the canonical URI identifying the Validation meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static Uri Validation202012Id { get; } = new(\"https://json-schema.org/draft/2020-12/meta/validation\");\n\t/// \n\t/// Gets the Validation meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static JsonSchema Validation202012 { get; internal set; }\n\n\t/// \n\t/// Gets the URI that identifies version 1 of the JSON Schema specification.\n\t/// \n\tpublic static Uri V1Id { get; } = new(\"https://json-schema.org/v1\");\n\t/// \n\t/// Gets the canonical URI identifying the JSON Schema version v1, release 2026 specification.\n\t/// \n\tpublic static Uri V1_2026Id { get; } = new(\"https://json-schema.org/v1/2026\");\n\t/// \n\t/// Gets the meta-schema for the JSON Schema version 1, release 2026 specification.\n\t/// \n\tpublic static JsonSchema V1_2026 { get; internal set; }\n}", + "snippet": "/// \n\t/// Gets the canonical URI identifying the Format-Annotation meta-schema for the JSON Schema Draft 2020-12 specification.\n\t/// \n\tpublic static Uri FormatAnnotation202012Id { get; } = new(\"https:/" + }, + { + "title": "src/JsonSchema/MultiLookupConcurrentDictionary.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/MultiLookupConcurrentDictionary.cs#L1-L50", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/MultiLookupConcurrentDictionary.cs", + "startLine": 1, + "endLine": 50, + "content": "using System;\nusing System.Collections;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Schema;\n\ninternal class MultiLookupConcurrentDictionary : IEnumerable>\n{\n\tprivate readonly ConcurrentDictionary _lookup = new();\n\tprivate readonly List> _keyFunctions = [];\n\n\tpublic TValue this[object key]\n\t{\n\t\tget => _lookup[key];\n\t\tset => _lookup[key] = value;\n\t}\n\n\tpublic void AddLookup(Func lookup)\n\t{\n\t\t_keyFunctions.Add(lookup);\n\t}\n\n\tpublic void Add(TValue value)\n\t{\n\t\tforeach (var lookup in _keyFunctions)\n\t\t{\n\t\t\tvar key = lookup(value);\n\t\t\t_lookup.AddOrUpdate(key, value, (_, _) => value);\n\t\t}\n\t}\n\n\tpublic void Remove(TValue value)\n\t{\n\t\tforeach (var lookup in _keyFunctions)\n\t\t{\n\t\t\tvar key = lookup(value);\n\t\t\t_lookup.TryRemove(key, out _);\n\t\t}\n\t}\n\n\tpublic bool TryGetValue(object key, [UnscopedRef, NotNullWhen(true)] out TValue? value) => _lookup.TryGetValue(key, out value!);\n\n\tpublic TValue? GetValueOrDefault(object key) => _lookup.GetValueOrDefault(key);\n\n\tpublic IEnumerator> GetEnumerator() => _lookup.GetEnumerator();\n\n\tIEnumerator IEnumerable.GetEnumerator() => GetEnumerator();\n}", + "snippet": "using System;\nusing System.Collections;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Json.Schema;\n\ninternal class MultiLookupConcurrentDictionar" + }, + { + "title": "src/JsonSchema/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema/obj/Debug/net10.0/JsonSchema.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Debug/net10.0/JsonSchema.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Debug/net10.0/JsonSchema.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.2.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.2.2+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema/obj/Debug/net8.0/JsonSchema.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Debug/net8.0/JsonSchema.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Debug/net8.0/JsonSchema.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.2.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.2.2+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema/obj/Debug/net9.0/JsonSchema.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Debug/net9.0/JsonSchema.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Debug/net9.0/JsonSchema.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.2.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.2.2+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema/obj/Debug/netstandard2.0/JsonSchema.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Debug/netstandard2.0/JsonSchema.AssemblyInfo.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Debug/netstandard2.0/JsonSchema.AssemblyInfo.cs", + "startLine": 1, + "endLine": 25, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Debug\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.2.2\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.2.2+e35aa41a465d469aee02e2328ae9190368f13792\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs#L1-L4", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs", + "startLine": 1, + "endLine": 4, + "content": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.IsExternalInit))]", + "snippet": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.IsExternalInit))]" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.RequiresLocationAttribute.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.RequiresLocationAttribute.g.cs#L1-L4", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.RequiresLocationAttribute.g.cs", + "startLine": 1, + "endLine": 4, + "content": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.RequiresLocationAttribute))]", + "snippet": "// \n#pragma warning disable\n\n[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.RequiresLocationAttribute))]" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Boolean.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Boolean.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Boolean.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Boolean;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Boolean\n #nullable enable annotations\n {\n get => _Boolean ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(bool));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Boolean(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.BooleanConverter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.BuildOptions.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.BuildOptions.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.BuildOptions.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _BuildOptions;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo BuildOptions\n #nullable enable annotations\n {\n get => _BuildOptions ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.BuildOptions));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_BuildOptions(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.BuildOptions(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => BuildOptionsPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.BuildOptions).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = BuildOptionsSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] BuildOptionsPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[4];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.BuildOptions),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.BuildOptions)obj).SchemaRegistry,\n Setter = static (obj, value) => ((global::Json.Schema.BuildOptions)obj).SchemaRegistry = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"SchemaRegistry\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.BuildOptions).GetProperty(\"SchemaRegistry\", InstanceMemberBindingFlags, null, typeof(global::Json.Schema.SchemaRegistry), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n properties[0].IsGetNullable = false;\n properties[0].IsSetNullable = false;\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.BuildOptions),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.BuildOptions)obj).VocabularyRegistry,\n Setter = static (obj, value) => ((global::Json.Schema.BuildOptions)obj).VocabularyRegistry = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"VocabularyRegistry\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.BuildOptions).GetProperty(\"VocabularyRegistry\", InstanceMemberBindingFlags, null, typeof(global::Json.Schema.VocabularyRegistry), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n properties[1].IsGetNullable = false;\n properties[1].IsSetNullable = false;\n\n var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.BuildOptions),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.BuildOptions)obj).DialectRegistry,\n Setter = static (obj, value) => ((global::Json.Schema.BuildOptions)obj).DialectRegistry = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"DialectRegistry\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.BuildOptions).GetProperty(\"DialectRegistry\", InstanceMemberBindingFlags, null, typeof(global::Json.Schema.DialectRegistry), global::System.Array.Empty(), null),\n };\n \n properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info2);\n properties[2].IsGetNullable = false;\n properties[2].IsSetNullable = false;\n\n var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.BuildOptions.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.BuildOptions.g.cs#L121-L167", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.BuildOptions.g.cs", + "startLine": 121, + "endLine": 167, + "content": "IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.BuildOptions),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.BuildOptions)obj).Dialect,\n Setter = static (obj, value) => ((global::Json.Schema.BuildOptions)obj).Dialect = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Dialect\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.BuildOptions).GetProperty(\"Dialect\", InstanceMemberBindingFlags, null, typeof(global::Json.Schema.Dialect), global::System.Array.Empty(), null),\n };\n \n properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info3);\n properties[3].IsGetNullable = false;\n properties[3].IsSetNullable = false;\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void BuildOptionsSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.BuildOptions? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WritePropertyName(PropName_SchemaRegistry);\n SchemaRegistrySerializeHandler(writer, ((global::Json.Schema.BuildOptions)value).SchemaRegistry);\n writer.WritePropertyName(PropName_VocabularyRegistry);\n VocabularyRegistrySerializeHandler(writer, ((global::Json.Schema.BuildOptions)value).VocabularyRegistry);\n writer.WritePropertyName(PropName_DialectRegistry);\n DialectRegistrySerializeHandler(writer, ((global::Json.Schema.BuildOptions)value).DialectRegistry);\n writer.WritePropertyName(PropName_Dialect);\n DialectSerializeHandler(writer, ((global::Json.Schema.BuildOptions)value).Dialect);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.BuildOptions),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.BuildOptions)obj).Dialect,\n " + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Decimal.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Decimal.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Decimal.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Decimal;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Decimal\n #nullable enable annotations\n {\n get => _Decimal ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(decimal));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Decimal(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.DecimalConverter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Dialect.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Dialect.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Dialect.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Dialect;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Dialect\n #nullable enable annotations\n {\n get => _Dialect ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.Dialect));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Dialect(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = null,\n ObjectWithParameterizedConstructorCreator = static args => new global::Json.Schema.Dialect((global::System.Collections.Generic.IEnumerable)args[0]){ RefIgnoresSiblingKeywords = (bool)args[1], AllowUnknownKeywords = (bool)args[2], Id = (global::System.Uri)args[3] },\n PropertyMetadataInitializer = _ => DialectPropInit(options),\n ConstructorParameterMetadataInitializer = DialectCtorParamInit,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.Dialect).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(global::System.Collections.Generic.IEnumerable)}, modifiers: null),\n SerializeHandler = DialectSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] DialectPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Dialect),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Dialect)obj).RefIgnoresSiblingKeywords,\n Setter = static (obj, value) => throw new global::System.InvalidOperationException(\"Setting init-only properties is not supported in source generation mode.\"),\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"RefIgnoresSiblingKeywords\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Dialect).GetProperty(\"RefIgnoresSiblingKeywords\", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n\n var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Dialect),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Dialect)obj).AllowUnknownKeywords,\n Setter = static (obj, value) => throw new global::System.InvalidOperationException(\"Setting init-only properties is not supported in source generation mode.\"),\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"AllowUnknownKeywords\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Dialect).GetProperty(\"AllowUnknownKeywords\", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty(), null),\n };\n \n properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info1);\n\n var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.Dialect),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.Dialect)obj).Id,\n Setter = static (obj, value) => throw new global::System.InvalidOperationException(\"Setting init-only properties is not supported in source generation mode.\"),\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Id\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.Dialect).GetProperty(\"Id\", InstanceMemberBindingFlags, null, typeof(global::System.Uri), global::System.Array.Empty(), null),\n };\n \n properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info2);\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void DialectSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.Dialect? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Dialect.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Dialect.g.cs#L121-L175", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Dialect.g.cs", + "startLine": 121, + "endLine": 175, + "content": "return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteBoolean(PropName_RefIgnoresSiblingKeywords, ((global::Json.Schema.Dialect)value).RefIgnoresSiblingKeywords);\n writer.WriteBoolean(PropName_AllowUnknownKeywords, ((global::Json.Schema.Dialect)value).AllowUnknownKeywords);\n writer.WritePropertyName(PropName_Id);\n global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::Json.Schema.Dialect)value).Id, Uri);\n\n writer.WriteEndObject();\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] DialectCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]\n {\n new()\n {\n Name = \"keywords\",\n ParameterType = typeof(global::System.Collections.Generic.IEnumerable),\n Position = 0,\n HasDefaultValue = false,\n DefaultValue = null,\n IsNullable = false,\n },\n\n new()\n {\n Name = \"RefIgnoresSiblingKeywords\",\n ParameterType = typeof(bool),\n Position = 1,\n IsNullable = false,\n IsMemberInitializer = true,\n },\n\n new()\n {\n Name = \"AllowUnknownKeywords\",\n ParameterType = typeof(bool),\n Position = 2,\n IsNullable = false,\n IsMemberInitializer = true,\n },\n\n new()\n {\n Name = \"Id\",\n ParameterType = typeof(global::System.Uri),\n Position = 3,\n IsNullable = true,\n IsMemberInitializer = true,\n },\n };\n }\n}", + "snippet": "return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteBoolean(PropName_RefIgnoresSiblingKeywords, ((global::Json.Schema.Dialect)value).RefIgnoresSiblingKeywords);\n " + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.DialectRegistry.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.DialectRegistry.g.cs#L1-L71", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.DialectRegistry.g.cs", + "startLine": 1, + "endLine": 71, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _DialectRegistry;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo DialectRegistry\n #nullable enable annotations\n {\n get => _DialectRegistry ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.DialectRegistry));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_DialectRegistry(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.DialectRegistry(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => DialectRegistryPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.DialectRegistry).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = DialectRegistrySerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] DialectRegistryPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[0];\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void DialectRegistrySerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.DialectRegistry? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.DictionaryStringStringArray.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.DictionaryStringStringArray.g.cs#L1-L65", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.DictionaryStringStringArray.g.cs", + "startLine": 1, + "endLine": 65, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo>? _DictionaryStringStringArray;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> DictionaryStringStringArray\n #nullable enable annotations\n {\n get => _DictionaryStringStringArray ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo>)Options.GetTypeInfo(typeof(global::System.Collections.Generic.Dictionary));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> Create_DictionaryStringStringArray(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> jsonTypeInfo))\n {\n var info = new global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues>\n {\n ObjectCreator = () => new global::System.Collections.Generic.Dictionary(),\n SerializeHandler = DictionaryStringStringArraySerializeHandler\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateDictionaryInfo, string, string[]>(options, info);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void DictionaryStringStringArraySerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::System.Collections.Generic.Dictionary? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n foreach (global::System.Collections.Generic.KeyValuePair entry in value)\n {\n writer.WritePropertyName(entry.Key);\n StringArraySerializeHandler(writer, entry.Value);\n }\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Double.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Double.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Double.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Double;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Double\n #nullable enable annotations\n {\n get => _Double ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(double));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Double(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.DoubleConverter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.EvaluationResults.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.EvaluationResults.g.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.EvaluationResults.g.cs", + "startLine": 1, + "endLine": 38, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _EvaluationResults;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo EvaluationResults\n #nullable enable annotations\n {\n get => _EvaluationResults ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.EvaluationResults));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_EvaluationResults(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n global::System.Text.Json.Serialization.JsonConverter converter = ExpandConverter(typeof(global::Json.Schema.EvaluationResults), new global::Json.Schema.EvaluationResultsJsonConverter(), options);\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo (options, converter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.FuncUriSchemaRegistryIBaseDocument.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.FuncUriSchemaRegistryIBaseDocument.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.FuncUriSchemaRegistryIBaseDocument.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo>? _FuncUriSchemaRegistryIBaseDocument;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> FuncUriSchemaRegistryIBaseDocument\n #nullable enable annotations\n {\n get => _FuncUriSchemaRegistryIBaseDocument ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo>)Options.GetTypeInfo(typeof(global::System.Func));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> Create_FuncUriSchemaRegistryIBaseDocument(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo>(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.GetUnsupportedTypeConverter>());\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.g.cs#L1-L88", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.g.cs", + "startLine": 1, + "endLine": 88, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Text.Json.SourceGeneration\", \"9.0.14.11910\")]\n internal partial class JsonSchemaSerializerContext\n {\n private readonly static global::System.Text.Json.JsonSerializerOptions s_defaultOptions = new();\n \n private const global::System.Reflection.BindingFlags InstanceMemberBindingFlags =\n global::System.Reflection.BindingFlags.Instance |\n global::System.Reflection.BindingFlags.Public |\n global::System.Reflection.BindingFlags.NonPublic;\n \n /// \n /// The default associated with a default instance.\n /// \n public static global::Json.Schema.JsonSchemaSerializerContext Default { get; } = new global::Json.Schema.JsonSchemaSerializerContext(new global::System.Text.Json.JsonSerializerOptions(s_defaultOptions));\n \n /// \n /// The source-generated options associated with this context.\n /// \n protected override global::System.Text.Json.JsonSerializerOptions? GeneratedSerializerOptions { get; } = s_defaultOptions;\n \n /// \n public JsonSchemaSerializerContext() : base(null)\n {\n }\n \n /// \n public JsonSchemaSerializerContext(global::System.Text.Json.JsonSerializerOptions options) : base(options)\n {\n }\n\n private static bool TryGetTypeInfoForRuntimeCustomConverter(global::System.Text.Json.JsonSerializerOptions options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo)\n {\n global::System.Text.Json.Serialization.JsonConverter? converter = GetRuntimeConverterForType(typeof(TJsonMetadataType), options);\n if (converter != null)\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, converter);\n return true;\n }\n \n jsonTypeInfo = null;\n return false;\n }\n \n private static global::System.Text.Json.Serialization.JsonConverter? GetRuntimeConverterForType(global::System.Type type, global::System.Text.Json.JsonSerializerOptions options)\n {\n for (int i = 0; i < options.Converters.Count; i++)\n {\n global::System.Text.Json.Serialization.JsonConverter? converter = options.Converters[i];\n if (converter?.CanConvert(type) == true)\n {\n return ExpandConverter(type, converter, options, validateCanConvert: false);\n }\n }\n \n return null;\n }\n \n private static global::System.Text.Json.Serialization.JsonConverter ExpandConverter(global::System.Type type, global::System.Text.Json.Serialization.JsonConverter converter, global::System.Text.Json.JsonSerializerOptions options, bool validateCanConvert = true)\n {\n if (validateCanConvert && !converter.CanConvert(type))\n {\n throw new global::System.InvalidOperationException(string.Format(\"The converter '{0}' is not compatible with the type '{1}'.\", converter.GetType(), type));\n }\n \n if (converter is global::System.Text.Json.Serialization.JsonConverterFactory factory)\n {\n converter = factory.CreateConverter(type, options);\n if (converter is null || converter is global::System.Text.Json.Serialization.JsonConverterFactory)\n {\n throw new global::System.InvalidOperationException(string.Format(\"The converter '{0}' cannot return null or a JsonConverterFactory instance.\", factory.GetType()));\n }\n }\n \n return converter;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n [gl" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.GetJsonTypeInfo.g.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.GetJsonTypeInfo.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.GetJsonTypeInfo.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext : global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver\n {\n /// \n public override global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo(global::System.Type type)\n {\n Options.TryGetTypeInfo(type, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? typeInfo);\n return typeInfo;\n }\n\n global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver.GetTypeInfo(global::System.Type type, global::System.Text.Json.JsonSerializerOptions options)\n {\n if (type == typeof(bool))\n {\n return Create_Boolean(options);\n }\n if (type == typeof(decimal))\n {\n return Create_Decimal(options);\n }\n if (type == typeof(double))\n {\n return Create_Double(options);\n }\n if (type == typeof(global::Json.Pointer.JsonPointer))\n {\n return Create_JsonPointer(options);\n }\n if (type == typeof(global::Json.Schema.BuildOptions))\n {\n return Create_BuildOptions(options);\n }\n if (type == typeof(global::Json.Schema.Dialect))\n {\n return Create_Dialect(options);\n }\n if (type == typeof(global::Json.Schema.DialectRegistry))\n {\n return Create_DialectRegistry(options);\n }\n if (type == typeof(global::Json.Schema.EvaluationResults))\n {\n return Create_EvaluationResults(options);\n }\n if (type == typeof(global::Json.Schema.IKeywordHandler))\n {\n return Create_IKeywordHandler(options);\n }\n if (type == typeof(global::Json.Schema.JsonSchema))\n {\n return Create_JsonSchema(options);\n }\n if (type == typeof(global::Json.Schema.JsonSchemaBuilder))\n {\n return Create_JsonSchemaBuilder(options);\n }\n if (type == typeof(global::Json.Schema.SchemaRegistry))\n {\n return Create_SchemaRegistry(options);\n }\n if (type == typeof(global::Json.Schema.SchemaValueType))\n {\n return Create_SchemaValueType(options);\n }\n if (type == typeof(global::Json.Schema.VocabularyRegistry))\n {\n return Create_VocabularyRegistry(options);\n }\n if (type == typeof(global::System.Collections.Generic.Dictionary))\n {\n return Create_DictionaryStringStringArray(options);\n }\n if (type == typeof(global::System.Collections.Generic.HashSet))\n {\n return Create_HashSetString(options);\n }\n if (type == typeof(global::System.Collections.Generic.IEnumerable))\n {\n return Create_IEnumerableIKeywordHandler(options);\n }\n if (type == typeof(global::System.Func))\n {\n return Create_FuncUriSchemaRegistryIBaseDocument(options);\n }\n if (type == typeof(global::System.Text.Json.JsonElement))\n {\n return Create_JsonElement(options);\n }\n if (type == typeof(global::System.Text.Json.Nodes.JsonNode))\n {\n return Create_JsonNode(options);\n }\n if (type == typeof(global::System.Uri))\n {\n return Create_Uri(options);\n }\n if (type == typeof(int))\n {\n return Create_Int32(options);\n }\n if (type == typeof(int[]))\n {\n return Create_Int32Array(options);\n }\n if (type == typeof(long))\n {\n return Create_Int64(options);\n }\n if (type == typeof(string))\n {\n return Create_String(options);", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.GetJsonTypeInfo.g.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.GetJsonTypeInfo.g.cs#L121-L130", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.GetJsonTypeInfo.g.cs", + "startLine": 121, + "endLine": 130, + "content": "}\n if (type == typeof(string[]))\n {\n return Create_StringArray(options);\n }\n return null;\n }\n }\n}", + "snippet": "}\n if (type == typeof(string[]))\n {\n return Create_StringArray(options);\n }\n return null;\n }\n }\n}" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.HashSetString.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.HashSetString.g.cs#L1-L64", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.HashSetString.g.cs", + "startLine": 1, + "endLine": 64, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo>? _HashSetString;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> HashSetString\n #nullable enable annotations\n {\n get => _HashSetString ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo>)Options.GetTypeInfo(typeof(global::System.Collections.Generic.HashSet));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> Create_HashSetString(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> jsonTypeInfo))\n {\n var info = new global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues>\n {\n ObjectCreator = () => new global::System.Collections.Generic.HashSet(),\n SerializeHandler = HashSetStringSerializeHandler\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateISetInfo, string>(options, info);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void HashSetStringSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::System.Collections.Generic.HashSet? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartArray();\n\n foreach (string element in value)\n {\n writer.WriteStringValue(element);\n }\n\n writer.WriteEndArray();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.IEnumerableIKeywordHandler.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.IEnumerableIKeywordHandler.g.cs#L1-L64", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.IEnumerableIKeywordHandler.g.cs", + "startLine": 1, + "endLine": 64, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo>? _IEnumerableIKeywordHandler;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> IEnumerableIKeywordHandler\n #nullable enable annotations\n {\n get => _IEnumerableIKeywordHandler ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo>)Options.GetTypeInfo(typeof(global::System.Collections.Generic.IEnumerable));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> Create_IEnumerableIKeywordHandler(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> jsonTypeInfo))\n {\n var info = new global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues>\n {\n ObjectCreator = null,\n SerializeHandler = IEnumerableIKeywordHandlerSerializeHandler\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateIEnumerableInfo, global::Json.Schema.IKeywordHandler>(options, info);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void IEnumerableIKeywordHandlerSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::System.Collections.Generic.IEnumerable? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartArray();\n\n foreach (global::Json.Schema.IKeywordHandler element in value)\n {\n IKeywordHandlerSerializeHandler(writer, element);\n }\n\n writer.WriteEndArray();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.IKeywordHandler.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.IKeywordHandler.g.cs#L1-L93", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.IKeywordHandler.g.cs", + "startLine": 1, + "endLine": 93, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _IKeywordHandler;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo IKeywordHandler\n #nullable enable annotations\n {\n get => _IKeywordHandler ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.IKeywordHandler));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_IKeywordHandler(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = null,\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => IKeywordHandlerPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = null,\n SerializeHandler = IKeywordHandlerSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] IKeywordHandlerPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[1];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = true,\n DeclaringType = typeof(global::Json.Schema.IKeywordHandler),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.IKeywordHandler)obj).Name,\n Setter = null,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Name\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.IKeywordHandler).GetProperty(\"Name\", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo(options, info0);\n properties[0].IsGetNullable = false;\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void IKeywordHandlerSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.IKeywordHandler? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WriteString(PropName_Name, ((global::Json.Schema.IKeywordHandler)value).Name);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Int32.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Int32.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Int32.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Int32;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Int32\n #nullable enable annotations\n {\n get => _Int32 ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(int));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Int32(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.Int32Converter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Int32Array.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Int32Array.g.cs#L1-L64", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Int32Array.g.cs", + "startLine": 1, + "endLine": 64, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Int32Array;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Int32Array\n #nullable enable annotations\n {\n get => _Int32Array ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(int[]));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Int32Array(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var info = new global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues\n {\n ObjectCreator = null,\n SerializeHandler = Int32ArraySerializeHandler\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateArrayInfo(options, info);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void Int32ArraySerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, int[]? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartArray();\n\n for (int i = 0; i < value.Length; i++)\n {\n writer.WriteNumberValue(value[i]);\n }\n\n writer.WriteEndArray();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Int64.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Int64.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Int64.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Int64;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Int64\n #nullable enable annotations\n {\n get => _Int64 ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(long));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Int64(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.Int64Converter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonElement.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonElement.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonElement.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _JsonElement;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo JsonElement\n #nullable enable annotations\n {\n get => _JsonElement ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::System.Text.Json.JsonElement));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_JsonElement(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.JsonElementConverter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonNode.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonNode.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonNode.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _JsonNode;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo JsonNode\n #nullable enable annotations\n {\n get => _JsonNode ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::System.Text.Json.Nodes.JsonNode));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_JsonNode(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.JsonNodeConverter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonPointer.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonPointer.g.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonPointer.g.cs", + "startLine": 1, + "endLine": 38, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _JsonPointer;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo JsonPointer\n #nullable enable annotations\n {\n get => _JsonPointer ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Pointer.JsonPointer));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_JsonPointer(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n global::System.Text.Json.Serialization.JsonConverter converter = ExpandConverter(typeof(global::Json.Pointer.JsonPointer), new global::Json.Pointer.JsonPointerJsonConverter(), options);\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo (options, converter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonSchema.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonSchema.g.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonSchema.g.cs", + "startLine": 1, + "endLine": 38, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _JsonSchema;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo JsonSchema\n #nullable enable annotations\n {\n get => _JsonSchema ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.JsonSchema));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_JsonSchema(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n global::System.Text.Json.Serialization.JsonConverter converter = ExpandConverter(typeof(global::Json.Schema.JsonSchema), new global::Json.Schema.JsonSchemaJsonConverter(), options);\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo (options, converter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonSchemaBuilder.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonSchemaBuilder.g.cs#L1-L84", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.JsonSchemaBuilder.g.cs", + "startLine": 1, + "endLine": 84, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _JsonSchemaBuilder;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo JsonSchemaBuilder\n #nullable enable annotations\n {\n get => _JsonSchemaBuilder ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.JsonSchemaBuilder));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_JsonSchemaBuilder(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = null,\n ObjectWithParameterizedConstructorCreator = static args => new global::Json.Schema.JsonSchemaBuilder((global::Json.Schema.BuildOptions)args[0]),\n PropertyMetadataInitializer = _ => JsonSchemaBuilderPropInit(options),\n ConstructorParameterMetadataInitializer = JsonSchemaBuilderCtorParamInit,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.JsonSchemaBuilder).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(global::Json.Schema.BuildOptions)}, modifiers: null),\n SerializeHandler = JsonSchemaBuilderSerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] JsonSchemaBuilderPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[0];\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void JsonSchemaBuilderSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.JsonSchemaBuilder? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n\n writer.WriteEndObject();\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] JsonSchemaBuilderCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]\n {\n new()\n {\n Name = \"buildOptions\",\n ParameterType = typeof(global::Json.Schema.BuildOptions),\n Position = 0,\n HasDefaultValue = true,\n DefaultValue = default(global::Json.Schema.BuildOptions),\n IsNullable = true,\n },\n };\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.PropertyNames.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.PropertyNames.g.cs#L1-L24", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.PropertyNames.g.cs", + "startLine": 1, + "endLine": 24, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private static readonly global::System.Text.Json.JsonEncodedText PropName_SchemaRegistry = global::System.Text.Json.JsonEncodedText.Encode(\"SchemaRegistry\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_VocabularyRegistry = global::System.Text.Json.JsonEncodedText.Encode(\"VocabularyRegistry\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_DialectRegistry = global::System.Text.Json.JsonEncodedText.Encode(\"DialectRegistry\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Dialect = global::System.Text.Json.JsonEncodedText.Encode(\"Dialect\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_RefIgnoresSiblingKeywords = global::System.Text.Json.JsonEncodedText.Encode(\"RefIgnoresSiblingKeywords\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_AllowUnknownKeywords = global::System.Text.Json.JsonEncodedText.Encode(\"AllowUnknownKeywords\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Id = global::System.Text.Json.JsonEncodedText.Encode(\"Id\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Name = global::System.Text.Json.JsonEncodedText.Encode(\"Name\");\n private static readonly global::System.Text.Json.JsonEncodedText PropName_Fetch = global::System.Text.Json.JsonEncodedText.Encode(\"Fetch\");\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.SchemaRegistry.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.SchemaRegistry.g.cs#L1-L95", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.SchemaRegistry.g.cs", + "startLine": 1, + "endLine": 95, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _SchemaRegistry;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo SchemaRegistry\n #nullable enable annotations\n {\n get => _SchemaRegistry ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.SchemaRegistry));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_SchemaRegistry(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.SchemaRegistry(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => SchemaRegistryPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.SchemaRegistry).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = SchemaRegistrySerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] SchemaRegistryPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[1];\n\n var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues>\n {\n IsProperty = true,\n IsPublic = true,\n IsVirtual = false,\n DeclaringType = typeof(global::Json.Schema.SchemaRegistry),\n Converter = null,\n Getter = static obj => ((global::Json.Schema.SchemaRegistry)obj).Fetch,\n Setter = static (obj, value) => ((global::Json.Schema.SchemaRegistry)obj).Fetch = value!,\n IgnoreCondition = null,\n HasJsonInclude = false,\n IsExtensionData = false,\n NumberHandling = null,\n PropertyName = \"Fetch\",\n JsonPropertyName = null,\n AttributeProviderFactory = static () => typeof(global::Json.Schema.SchemaRegistry).GetProperty(\"Fetch\", InstanceMemberBindingFlags, null, typeof(global::System.Func), global::System.Array.Empty(), null),\n };\n \n properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo>(options, info0);\n properties[0].IsGetNullable = false;\n properties[0].IsSetNullable = false;\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void SchemaRegistrySerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.SchemaRegistry? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n writer.WritePropertyName(PropName_Fetch);\n global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::Json.Schema.SchemaRegistry)value).Fetch, FuncUriSchemaRegistryIBaseDocument);\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.SchemaValueType.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.SchemaValueType.g.cs#L1-L38", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.SchemaValueType.g.cs", + "startLine": 1, + "endLine": 38, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _SchemaValueType;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo SchemaValueType\n #nullable enable annotations\n {\n get => _SchemaValueType ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.SchemaValueType));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_SchemaValueType(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n global::System.Text.Json.Serialization.JsonConverter converter = ExpandConverter(typeof(global::Json.Schema.SchemaValueType), new global::Json.More.EnumStringConverter(), options);\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo (options, converter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.String.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.String.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.String.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _String;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo String\n #nullable enable annotations\n {\n get => _String ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(string));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_String(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.StringConverter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.StringArray.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.StringArray.g.cs#L1-L64", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.StringArray.g.cs", + "startLine": 1, + "endLine": 64, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _StringArray;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo StringArray\n #nullable enable annotations\n {\n get => _StringArray ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(string[]));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_StringArray(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var info = new global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues\n {\n ObjectCreator = null,\n SerializeHandler = StringArraySerializeHandler\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateArrayInfo(options, info);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void StringArraySerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, string[]? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartArray();\n\n for (int i = 0; i < value.Length; i++)\n {\n writer.WriteStringValue(value[i]);\n }\n\n writer.WriteEndArray();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Uri.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Uri.g.cs#L1-L37", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.Uri.g.cs", + "startLine": 1, + "endLine": 37, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _Uri;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Uri\n #nullable enable annotations\n {\n get => _Uri ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::System.Uri));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_Uri(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateValueInfo(options, global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.UriConverter);\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.VocabularyRegistry.g.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.VocabularyRegistry.g.cs#L1-L71", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.Json.SourceGeneration/System.Text.Json.SourceGeneration.JsonSourceGenerator/JsonSchemaSerializerContext.VocabularyRegistry.g.cs", + "startLine": 1, + "endLine": 71, + "content": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n internal partial class JsonSchemaSerializerContext\n {\n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? _VocabularyRegistry;\n \n /// \n /// Defines the source generated JSON serialization contract metadata for a given type.\n /// \n #nullable disable annotations // Marking the property type as nullable-oblivious.\n public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo VocabularyRegistry\n #nullable enable annotations\n {\n get => _VocabularyRegistry ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo)Options.GetTypeInfo(typeof(global::Json.Schema.VocabularyRegistry));\n }\n \n private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo Create_VocabularyRegistry(global::System.Text.Json.JsonSerializerOptions options)\n {\n if (!TryGetTypeInfoForRuntimeCustomConverter(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo))\n {\n var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues\n {\n ObjectCreator = () => new global::Json.Schema.VocabularyRegistry(),\n ObjectWithParameterizedConstructorCreator = null,\n PropertyMetadataInitializer = _ => VocabularyRegistryPropInit(options),\n ConstructorParameterMetadataInitializer = null,\n ConstructorAttributeProviderFactory = static () => typeof(global::Json.Schema.VocabularyRegistry).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty(), modifiers: null),\n SerializeHandler = VocabularyRegistrySerializeHandler,\n };\n \n jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(options, objectInfo);\n jsonTypeInfo.NumberHandling = null;\n }\n \n jsonTypeInfo.OriginatingResolver = this;\n return jsonTypeInfo;\n }\n\n private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] VocabularyRegistryPropInit(global::System.Text.Json.JsonSerializerOptions options)\n {\n var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[0];\n\n return properties;\n }\n\n // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance\n // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.\n private void VocabularyRegistrySerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Json.Schema.VocabularyRegistry? value)\n {\n if (value is null)\n {\n writer.WriteNullValue();\n return;\n }\n \n writer.WriteStartObject();\n\n\n writer.WriteEndObject();\n }\n }\n}", + "snippet": "// \n\n#nullable enable annotations\n#nullable disable warnings\n\n// Suppress warnings about [Obsolete] member usage in generated code.\n#pragma warning disable CS0612, CS0618\n\nnamespace Json.Schema\n{\n int" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (1/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 1, + "endLine": 120, + "content": "// \n#nullable enable\n#pragma warning disable CS0162 // Unreachable code\n#pragma warning disable CS0164 // Unreferenced label\n#pragma warning disable CS0219 // Variable assigned but never used\n\nnamespace Json.Schema\n{\n partial class Formats\n {\n /// \n /// Pattern:
\n /// ^((?:([0-9]{4}-[0-9]{2}-[0-9]{2})([Tt_]| )([0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\\\.[0-9]+)?))([Zz]|[\\\\+-][0-9]{2}:[0-9]{2}))$
\n /// Options:
\n /// RegexOptions.Compiled
\n /// Explanation:
\n /// \n /// ○ Match if at the beginning of the string.
\n /// ○ 1st capture group.
\n /// ○ 2nd capture group.
\n /// ○ Match a character in the set [0-9] exactly 4 times.
\n /// ○ Match '-'.
\n /// ○ Match a character in the set [0-9] exactly 2 times.
\n /// ○ Match '-'.
\n /// ○ Match a character in the set [0-9] exactly 2 times.
\n /// ○ 3rd capture group.
\n /// ○ Match a character in the set [ T_t].
\n /// ○ 4th capture group.
\n /// ○ Match a character in the set [0-9] exactly 2 times.
\n /// ○ Match ':'.
\n /// ○ Match a character in the set [0-9] exactly 2 times.
\n /// ○ Match ':'.
\n /// ○ Match a character in the set [0-9] exactly 2 times.
\n /// ○ Optional (greedy).
\n /// ○ Match '.'.
\n /// ○ Match a character in the set [0-9] atomically at least once.
\n /// ○ 5th capture group.
\n /// ○ Match with 2 alternative expressions.
\n /// ○ Match a character in the set [Zz].
\n /// ○ Match a sequence of expressions.
\n /// ○ Match an empty string.
\n /// ○ Match a character in the set [0-9] exactly 2 times.
\n /// ○ Match ':'.
\n /// ○ Match a character in the set [0-9] exactly 2 times.
\n /// ○ Match if at the end of the string or if before an ending newline.
\n ///
\n ///
\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n private static partial global::System.Text.RegularExpressions.Regex DateTimeRegex() => global::System.Text.RegularExpressions.Generated.DateTimeRegex_0.Instance;\n }\n}\n\nnamespace Json.Schema\n{\n partial class Formats\n {\n /// \n /// Pattern:
\n /// ^[a-zA-Z0-9]([a-zA-Z0-9\\\\-]{0,61}[a-zA-Z0-9])?(\\\\.[a-zA-Z0-9]([a-zA-Z0-9\\\\-]{0,61}[a-zA-Z0-9])?)*$
\n /// Options:
\n /// RegexOptions.Compiled
\n /// Explanation:
\n /// \n /// ○ Match if at the beginning of the string.
\n /// ○ Match a character in the set [0-9A-Za-z].
\n /// ○ Optional (greedy).
\n /// ○ 1st capture group.
\n /// ○ Match a character in the set [-0-9A-Za-z] greedily at most 61 times.
\n /// ○ Match a character in the set [0-9A-Za-z].
\n /// ○ Loop greedily any number of times.
\n /// ○ 2nd capture group.
\n /// ○ Match '.'.
\n /// ○ Match a character in the set [0-9A-Za-z].
\n /// ○ Optional (greedy).
\n /// ○ 3rd capture group.
\n /// ○ Match a character in the set [-0-9A-Za-z] greedily at most 61 times.
\n /// ○ Match a character in the set [0-9A-Za-z].
\n /// ○ Match if at the end of the string or if before an ending newline.
\n ///
\n ///
\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n private static partial global::System.Text.RegularExpressions.Regex HostnameRegex() => global::System.Text.RegularExpressions.Generated.HostnameRegex_1.Instance;\n }\n}\n\nnamespace Json.Schema\n{\n partial class Formats\n {\n /// \n /// Pattern:
\n /// (@)(.+)$
\n /// Options:
\n /// RegexOptions.Compiled
\n /// Explanation:
\n /// \n /// ○ 1st capture group.
\n /// ○ Match '@'.
\n /// ○ 2nd capture group.
\n /// ○ Match a character other than '\\n' greedily at least once.
\n /// ○ Match if at the end of the string or if before an ending newline.
\n ///
\n ///
\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n private static partial global::System.Text.RegularExpressions.Regex NormalizeDomainRegex() => global::System.Text.RegularExpressions.Generated.NormalizeDomainRegex_2.Instance;\n }\n}\n\nnamespace Json.Schema\n{\n partial class Formats\n {\n /// \n /// Pattern:
\n /// ^(?(\")(\".+?(?<!\\\\\\\\)\"@)|([-!#$%&'*+/=?^`{}|~A-Za-z0-9_]+(\\\\.((?!\\\\.)[-!#$%&'*+/=?^`{}|~A-Za-z0-9_]+))*@))(\\\\[([0-9]{1,3}\\\\.[0-9]{1,3}\\\\.[0-9]{1,3}\\\\.[0-9]{1,3}|(?i:IPv6:)[0-9A-Fa-f:.]+)\\\\]|([A-Za-z0-9]([A-Za-z0-9\\\\-]{0,61}[A-Za-z0-9])?\\\\.)+[A-Za-z]{2,63})$
\n /// Options:
\n /// RegexOptions.Compiled
\n /// Explanation:
\n /// \n /// ○ Match if at the beginning of the string.
", + "snippet": "// \n#nullable enable\n#pragma warning disable CS0162 // Unreachable code\n#pragma warning disable CS0164 // Unreferenced label\n#pragma warning disable CS0219 // Variable assigned but never used\n\nnamespace " + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (2/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 121, + "endLine": 240, + "content": "/// ○ Conditionally match one of two expressions depending on whether an initial expression matches.
\n /// ○ Condition: Match '\"'.
\n /// ○ Matched: 1st capture group.
\n /// ○ Match '\"'.
\n /// ○ Match a character other than '\\n' lazily at least once.
\n /// ○ Zero-width negative lookbehind.
\n /// ○ Match '\\\\' right-to-left.
\n /// ○ Match the string \"\\\"@\".
\n /// ○ Not Matched: 2nd capture group.
\n /// ○ Match a character in the set [!#-'*+-/-9=?A-Z^-~] greedily at least once.
\n /// ○ Loop greedily any number of times.
\n /// ○ 3rd capture group.
\n /// ○ Match '.'.
\n /// ○ 4th capture group.
\n /// ○ Zero-width negative lookahead.
\n /// ○ Match '.'.
\n /// ○ Match a character in the set [!#-'*+-/-9=?A-Z^-~] greedily at least once.
\n /// ○ Match '@'.
\n /// ○ 5th capture group.
\n /// ○ Match with 2 alternative expressions.
\n /// ○ Match a sequence of expressions.
\n /// ○ Match '['.
\n /// ○ 6th capture group.
\n /// ○ Match with 2 alternative expressions.
\n /// ○ Match a sequence of expressions.
\n /// ○ Match a character in the set [0-9] atomically at least 1 and at most 3 times.
\n /// ○ Match '.'.
\n /// ○ Match a character in the set [0-9] atomically at least 1 and at most 3 times.
\n /// ○ Match '.'.
\n /// ○ Match a character in the set [0-9] atomically at least 1 and at most 3 times.
\n /// ○ Match '.'.
\n /// ○ Match a character in the set [0-9] atomically at least 1 and at most 3 times.
\n /// ○ Match a sequence of expressions.
\n /// ○ Match an empty string.
\n /// ○ Match a character in the set [Pp].
\n /// ○ Match a character in the set [Vv].
\n /// ○ Match the string \"6:\".
\n /// ○ Match a character in the set [.0-:A-Fa-f] atomically at least once.
\n /// ○ Match ']'.
\n /// ○ Match a sequence of expressions.
\n /// ○ Loop greedily at least once.
\n /// ○ 7th capture group.
\n /// ○ Match a character in the set [0-9A-Za-z].
\n /// ○ Optional (greedy).
\n /// ○ 8th capture group.
\n /// ○ Match a character in the set [-0-9A-Za-z] greedily at most 61 times.
\n /// ○ Match a character in the set [0-9A-Za-z].
\n /// ○ Match '.'.
\n /// ○ Match a character in the set [A-Za-z] atomically at least 2 and at most 63 times.
\n /// ○ Match if at the end of the string or if before an ending newline.
\n ///
\n ///
\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n private static partial global::System.Text.RegularExpressions.Regex EmailFormatRegex() => global::System.Text.RegularExpressions.Generated.EmailFormatRegex_3.Instance;\n }\n}\n\nnamespace Json.Schema.Keywords\n{\n partial class AnchorKeyword\n {\n /// \n /// Pattern:
\n /// ^[A-Za-z_][-A-Za-z0-9._]*$
\n /// Options:
\n /// RegexOptions.Compiled
\n /// Explanation:
\n /// \n /// ○ Match if at the beginning of the string.
\n /// ○ Match a character in the set [A-Z_a-z].
\n /// ○ Match a character in the set [-.0-9A-Z_a-z] atomically any number of times.
\n /// ○ Match if at the end of the string or if before an ending newline.
\n ///
\n ///
\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n private static partial global::System.Text.RegularExpressions.Regex GetAnchorPatternRegex() => global::System.Text.RegularExpressions.Generated.GetAnchorPatternRegex_4.Instance;\n }\n}\n\nnamespace Json.Schema.Keywords.Draft06\n{\n partial class IdKeyword\n {\n /// \n /// Pattern:
\n /// ^[A-Za-z][-A-Za-z0-9.:_]*$
\n /// Options:
\n /// RegexOptions.Compiled
\n /// Explanation:
\n /// \n /// ○ Match if at the beginning of the string.
\n /// ○ Match a character in the set [A-Za-z].
\n /// ○ Match a character in the set [-.0-:A-Z_a-z] atomically any number of times.
\n /// ○ Match if at the end of the string or if before an ending newline.
\n ///
\n ///
\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n private static partial global::System.Text.RegularExpressions.Regex GetAnchorPatternRegex() => global::System.Text.RegularExpressions.Generated.GetAnchorPatternRegex_5.Instance;\n }\n}\n\nnamespace Json.Schema.Keywords.Draft201909\n{\n partial class AnchorKeyword\n {\n /// \n /// Pattern:
\n /// ^[A-Za-z][-A-Za-z0-9.:_]*$
\n /// Options:
\n /// RegexOptions.Compiled
\n /// Explanation:
\n /// \n /// ○ Match if at the beginning of the string.
\n /// ○ Match a character in the set [A-Za-z].
\n /// ○ Match a character in the set [-.0-:A-Z_a-z] atomically any number of times.
\n /// ○ Match if at the end of the string or if before an ending newline.
\n ///
\n ///
\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n private static partial global::System.Text.RegularExpressions.Regex GetAnchorPatternRegex() => global::System.Text.RegularExpressions.Generated.GetAnchorPatternRegex_5.Instance;", + "snippet": "/// ○ Conditionally match one of two expressions depending on whether an initial expression matches.
\n /// ○ Condition: Match '\"'.
\n /// ○ Matched: 1st capture group.
\n /// " + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (3/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L241-L360", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 241, + "endLine": 360, + "content": "}\n}\n\nnamespace Json.Schema.Keywords\n{\n partial class DynamicAnchorKeyword\n {\n /// \n /// Pattern:
\n /// ^[A-Za-z_][-A-Za-z0-9._]*$
\n /// Options:
\n /// RegexOptions.Compiled
\n /// Explanation:
\n /// \n /// ○ Match if at the beginning of the string.
\n /// ○ Match a character in the set [A-Z_a-z].
\n /// ○ Match a character in the set [-.0-9A-Z_a-z] atomically any number of times.
\n /// ○ Match if at the end of the string or if before an ending newline.
\n ///
\n ///
\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n private static partial global::System.Text.RegularExpressions.Regex GetAnchorPatternRegex() => global::System.Text.RegularExpressions.Generated.GetAnchorPatternRegex_4.Instance;\n }\n}\n\nnamespace Json.Schema.Keywords\n{\n partial class DynamicRefKeyword\n {\n /// \n /// Pattern:
\n /// ^#[A-Za-z_][-A-Za-z0-9._]*$
\n /// Options:
\n /// RegexOptions.Compiled
\n /// Explanation:
\n /// \n /// ○ Match if at the beginning of the string.
\n /// ○ Match '#'.
\n /// ○ Match a character in the set [A-Z_a-z].
\n /// ○ Match a character in the set [-.0-9A-Z_a-z] atomically any number of times.
\n /// ○ Match if at the end of the string or if before an ending newline.
\n ///
\n ///
\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n private static partial global::System.Text.RegularExpressions.Regex GetAnchorPatternRegex() => global::System.Text.RegularExpressions.Generated.GetAnchorPatternRegex_6.Instance;\n }\n}\n\nnamespace System.Text.RegularExpressions.Generated\n{\n using System;\n using System.Buffers;\n using System.CodeDom.Compiler;\n using System.Collections;\n using System.ComponentModel;\n using System.Globalization;\n using System.Runtime.CompilerServices;\n using System.Text.RegularExpressions;\n using System.Threading;\n\n /// Custom -derived type for the DateTimeRegex method.\n [GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n file sealed class DateTimeRegex_0 : Regex\n {\n /// Cached, thread-safe singleton instance.\n internal static readonly DateTimeRegex_0 Instance = new();\n \n /// Initializes the instance.\n private DateTimeRegex_0()\n {\n base.pattern = \"^((?:([0-9]{4}-[0-9]{2}-[0-9]{2})([Tt_]| )([0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\\\.[0-9]+)?))([Zz]|[\\\\+-][0-9]{2}:[0-9]{2}))$\";\n base.roptions = RegexOptions.Compiled;\n base.internalMatchTimeout = TimeSpan.FromMilliseconds(250);\n base.factory = new RunnerFactory();\n base.capsize = 6;\n }\n \n /// Provides a factory for creating instances to be used by methods on .\n private sealed class RunnerFactory : RegexRunnerFactory\n {\n /// Creates an instance of a used by methods on .\n protected override RegexRunner CreateInstance() => new Runner();\n \n /// Provides the runner that contains the custom logic implementing the specified regular expression.\n private sealed class Runner : RegexRunner\n {\n /// Scan the starting from base.runtextstart for the next match.\n /// The text being scanned by the regular expression.\n protected override void Scan(ReadOnlySpan inputSpan)\n {\n // The pattern is anchored. Validate the current position and try to match at it only.\n if (TryFindNextPossibleStartingPosition(inputSpan) && !TryMatchAtCurrentPosition(inputSpan))\n {\n base.runtextpos = inputSpan.Length;\n }\n }\n \n /// Search starting from base.runtextpos for the next location a match could possibly start.\n /// The text being scanned by the regular expression.\n /// true if a possible match was found; false if no more matches are possible.\n private bool TryFindNextPossibleStartingPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n \n // Any possible match is at least 20 characters.\n if (pos <= inputSpan.Length - 20)\n {\n // The pattern leads with a beginning (\\A) anchor.\n if (pos == 0)\n {\n return true;\n }\n }\n \n // No match found.\n base.runtextpos = inputSpan.Length;\n return false;\n }\n \n /// Determine whether at base.runtextpos is a match for the regular expression.", + "snippet": "}\n}\n\nnamespace Json.Schema.Keywords\n{\n partial class DynamicAnchorKeyword\n {\n /// \n /// Pattern:
\n /// ^[A-Za-z_][-A-Za-z0-9._]*$
\n /// Options:
\n " + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (4/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L361-L480", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 361, + "endLine": 480, + "content": "/// The text being scanned by the regular expression.\n /// true if the regular expression matches at the current position; otherwise, false.\n private bool TryMatchAtCurrentPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n int matchStart = pos;\n char ch;\n int capture_starting_pos = 0;\n int capture_starting_pos1 = 0;\n int capture_starting_pos2 = 0;\n int capture_starting_pos3 = 0;\n int capture_starting_pos4 = 0;\n int loop_iteration = 0;\n int stackpos = 0;\n ReadOnlySpan slice = inputSpan.Slice(pos);\n \n // Match if at the beginning of the string.\n if (pos != 0)\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n \n // 1st capture group.\n //{\n capture_starting_pos = pos;\n \n // 2nd capture group.\n {\n capture_starting_pos1 = pos;\n \n if ((uint)slice.Length < 10 ||\n !char.IsAsciiDigit(slice[0]) || // Match a character in the set [0-9] exactly 4 times.\n !char.IsAsciiDigit(slice[1]) ||\n !char.IsAsciiDigit(slice[2]) ||\n !char.IsAsciiDigit(slice[3]) ||\n slice[4] != '-' || // Match '-'.\n !char.IsAsciiDigit(slice[5]) || // Match a character in the set [0-9] exactly 2 times.\n !char.IsAsciiDigit(slice[6]) ||\n slice[7] != '-' || // Match '-'.\n !char.IsAsciiDigit(slice[8]) || // Match a character in the set [0-9] exactly 2 times.\n !char.IsAsciiDigit(slice[9]))\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n \n pos += 10;\n slice = inputSpan.Slice(pos);\n base.Capture(2, capture_starting_pos1, pos);\n }\n \n // 3rd capture group.\n {\n capture_starting_pos2 = pos;\n \n // Match a character in the set [ T_t].\n if (slice.IsEmpty || ((ch = slice[0]) >= 'u' || (\"\\0\\0\\u0001\\0\\0耐\\0\\u0010\"[ch >> 4] & (1 << (ch & 0xF))) == 0))\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n \n pos++;\n slice = inputSpan.Slice(pos);\n base.Capture(3, capture_starting_pos2, pos);\n }\n \n // 4th capture group.\n //{\n capture_starting_pos3 = pos;\n \n if ((uint)slice.Length < 8 ||\n !char.IsAsciiDigit(slice[0]) || // Match a character in the set [0-9] exactly 2 times.\n !char.IsAsciiDigit(slice[1]) ||\n slice[2] != ':' || // Match ':'.\n !char.IsAsciiDigit(slice[3]) || // Match a character in the set [0-9] exactly 2 times.\n !char.IsAsciiDigit(slice[4]) ||\n slice[5] != ':' || // Match ':'.\n !char.IsAsciiDigit(slice[6]) || // Match a character in the set [0-9] exactly 2 times.\n !char.IsAsciiDigit(slice[7]))\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n \n // Optional (greedy).\n //{\n pos += 8;\n slice = inputSpan.Slice(pos);\n loop_iteration = 0;\n \n LoopBody:\n Utilities.StackPush(ref base.runstack!, ref stackpos, base.Crawlpos(), pos);\n \n loop_iteration++;\n \n // Match '.'.\n if (slice.IsEmpty || slice[0] != '.')\n {\n goto LoopIterationNoMatch;\n }\n \n // Match a character in the set [0-9] atomically at least once.\n {\n int iteration = slice.Slice(1).IndexOfAnyExceptInRange('0', '9');\n if (iteration < 0)\n {\n iteration = slice.Length - 1;\n }\n \n if (iteration == 0)\n {\n goto LoopIterationNoMatch;\n }\n \n slice = slice.Slice(iteration);\n pos += iteration;\n }", + "snippet": "/// The text being scanned by the regular expression.\n /// true if the regular expression matches at the current position; otherwise, false.\n " + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (5/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L481-L600", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 481, + "endLine": 600, + "content": "pos++;\n slice = inputSpan.Slice(pos);\n \n // The loop has an upper bound of 1. Continue iterating greedily if it hasn't yet been reached.\n if (loop_iteration == 0)\n {\n goto LoopBody;\n }\n goto LoopEnd;\n \n // The loop iteration failed. Put state back to the way it was before the iteration.\n LoopIterationNoMatch:\n if (--loop_iteration < 0)\n {\n // Unable to match the remainder of the expression after exhausting the loop.\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n pos = base.runstack![--stackpos];\n UncaptureUntil(base.runstack![--stackpos]);\n slice = inputSpan.Slice(pos);\n LoopEnd:;\n //}\n \n base.Capture(4, capture_starting_pos3, pos);\n \n goto CaptureSkipBacktrack;\n \n CaptureBacktrack:\n goto LoopIterationNoMatch;\n \n CaptureSkipBacktrack:;\n //}\n \n // 5th capture group.\n //{\n capture_starting_pos4 = pos;\n \n // Match with 2 alternative expressions.\n //{\n if (slice.IsEmpty)\n {\n goto CaptureBacktrack;\n }\n \n switch (slice[0])\n {\n case 'Z' or 'z':\n pos++;\n slice = inputSpan.Slice(pos);\n break;\n \n case '+' or '-':\n \n if ((uint)slice.Length < 6 ||\n !char.IsAsciiDigit(slice[1]) || // Match a character in the set [0-9] exactly 2 times.\n !char.IsAsciiDigit(slice[2]) ||\n slice[3] != ':' || // Match ':'.\n !char.IsAsciiDigit(slice[4]) || // Match a character in the set [0-9] exactly 2 times.\n !char.IsAsciiDigit(slice[5]))\n {\n goto CaptureBacktrack;\n }\n \n pos += 6;\n slice = inputSpan.Slice(pos);\n break;\n \n default:\n goto CaptureBacktrack;\n }\n //}\n \n base.Capture(5, capture_starting_pos4, pos);\n //}\n \n base.Capture(1, capture_starting_pos, pos);\n \n goto CaptureSkipBacktrack1;\n \n CaptureBacktrack1:\n goto CaptureBacktrack;\n \n CaptureSkipBacktrack1:;\n //}\n \n // Match if at the end of the string or if before an ending newline.\n if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\\n'))\n {\n goto CaptureBacktrack1;\n }\n \n // The input matched.\n base.runtextpos = pos;\n base.Capture(0, matchStart, pos);\n return true;\n \n // Undo captures until it reaches the specified capture position.\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void UncaptureUntil(int capturePosition)\n {\n while (base.Crawlpos() > capturePosition)\n {\n base.Uncapture();\n }\n }\n }\n }\n }\n\n }\n \n /// Custom -derived type for the HostnameRegex method.\n [GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n file sealed class HostnameRegex_1 : Regex\n {\n /// Cached, thread-safe singleton instance.\n internal static readonly HostnameRegex_1 Instance = new();\n \n /// Initializes the instance.", + "snippet": "pos++;\n slice = inputSpan.Slice(pos);\n \n // The loop has an upper bound of 1. Continue iterating greedily if it hasn't yet been" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (6/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L601-L720", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 601, + "endLine": 720, + "content": "private HostnameRegex_1()\n {\n base.pattern = \"^[a-zA-Z0-9]([a-zA-Z0-9\\\\-]{0,61}[a-zA-Z0-9])?(\\\\.[a-zA-Z0-9]([a-zA-Z0-9\\\\-]{0,61}[a-zA-Z0-9])?)*$\";\n base.roptions = RegexOptions.Compiled;\n base.internalMatchTimeout = TimeSpan.FromMilliseconds(250);\n base.factory = new RunnerFactory();\n base.capsize = 4;\n }\n \n /// Provides a factory for creating instances to be used by methods on .\n private sealed class RunnerFactory : RegexRunnerFactory\n {\n /// Creates an instance of a used by methods on .\n protected override RegexRunner CreateInstance() => new Runner();\n \n /// Provides the runner that contains the custom logic implementing the specified regular expression.\n private sealed class Runner : RegexRunner\n {\n /// Scan the starting from base.runtextstart for the next match.\n /// The text being scanned by the regular expression.\n protected override void Scan(ReadOnlySpan inputSpan)\n {\n // The pattern is anchored. Validate the current position and try to match at it only.\n if (TryFindNextPossibleStartingPosition(inputSpan) && !TryMatchAtCurrentPosition(inputSpan))\n {\n base.runtextpos = inputSpan.Length;\n }\n }\n \n /// Search starting from base.runtextpos for the next location a match could possibly start.\n /// The text being scanned by the regular expression.\n /// true if a possible match was found; false if no more matches are possible.\n private bool TryFindNextPossibleStartingPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n \n // Empty matches aren't possible.\n if ((uint)pos < (uint)inputSpan.Length)\n {\n // The pattern leads with a beginning (\\A) anchor.\n if (pos == 0)\n {\n return true;\n }\n }\n \n // No match found.\n base.runtextpos = inputSpan.Length;\n return false;\n }\n \n /// Determine whether at base.runtextpos is a match for the regular expression.\n /// The text being scanned by the regular expression.\n /// true if the regular expression matches at the current position; otherwise, false.\n private bool TryMatchAtCurrentPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n int matchStart = pos;\n char ch;\n int charloop_starting_pos = 0, charloop_ending_pos = 0;\n int charloop_starting_pos1 = 0, charloop_ending_pos1 = 0;\n int loop_iteration = 0;\n int loop_iteration1 = 0;\n int loop_iteration2 = 0;\n int stackpos = 0;\n ReadOnlySpan slice = inputSpan.Slice(pos);\n \n // Match if at the beginning of the string.\n if (pos != 0)\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n \n // Match a character in the set [0-9A-Za-z].\n if (slice.IsEmpty || !char.IsAsciiLetterOrDigit(slice[0]))\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n \n // Optional (greedy).\n //{\n pos++;\n slice = inputSpan.Slice(pos);\n loop_iteration = 0;\n \n LoopBody:\n Utilities.StackPush(ref base.runstack!, ref stackpos, base.Crawlpos(), pos);\n \n loop_iteration++;\n \n // 1st capture group.\n //{\n int capture_starting_pos = pos;\n \n // Match a character in the set [-0-9A-Za-z] greedily at most 61 times.\n //{\n charloop_starting_pos = pos;\n \n int iteration = 0;\n while (iteration < 61 && (uint)iteration < (uint)slice.Length && ((ch = slice[iteration]) < '{' && (\"\\0\\0 Ͽ\\ufffe߿\\ufffe߿\"[ch >> 4] & (1 << (ch & 0xF))) != 0))\n {\n iteration++;\n }\n \n slice = slice.Slice(iteration);\n pos += iteration;\n \n charloop_ending_pos = pos;\n goto CharLoopEnd;\n \n CharLoopBacktrack:\n UncaptureUntil(base.runstack![--stackpos]);\n Utilities.StackPop(base.runstack!, ref stackpos, out charloop_ending_pos, out charloop_starting_pos);\n \n base.CheckTimeout();\n \n if (charloop_starting_pos >= charloop_ending_pos ||\n (charloop_ending_pos = inputSpan.Slice(charloop_starting_pos, charloop_ending_pos - charloop_starting_pos).LastIndexOfAny(Utilities.s_asciiLettersAndDigits)) < 0)", + "snippet": "private HostnameRegex_1()\n {\n base.pattern = \"^[a-zA-Z0-9]([a-zA-Z0-9\\\\-]{0,61}[a-zA-Z0-9])?(\\\\.[a-zA-Z0-9]([a-zA-Z0-9\\\\-]{0,61}[a-zA-Z0-9])?)*$\";\n base.roptions = RegexOptions.Compiled;\n " + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (7/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L721-L840", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 721, + "endLine": 840, + "content": "{\n goto LoopIterationNoMatch;\n }\n charloop_ending_pos += charloop_starting_pos;\n pos = charloop_ending_pos;\n slice = inputSpan.Slice(pos);\n \n CharLoopEnd:\n Utilities.StackPush(ref base.runstack!, ref stackpos, charloop_starting_pos, charloop_ending_pos, base.Crawlpos());\n //}\n \n // Match a character in the set [0-9A-Za-z].\n if (slice.IsEmpty || !char.IsAsciiLetterOrDigit(slice[0]))\n {\n goto CharLoopBacktrack;\n }\n \n pos++;\n slice = inputSpan.Slice(pos);\n base.Capture(1, capture_starting_pos, pos);\n \n Utilities.StackPush(ref base.runstack!, ref stackpos, capture_starting_pos);\n goto CaptureSkipBacktrack;\n \n CaptureBacktrack:\n capture_starting_pos = base.runstack![--stackpos];\n goto CharLoopBacktrack;\n \n CaptureSkipBacktrack:;\n //}\n \n \n // The loop has an upper bound of 1. Continue iterating greedily if it hasn't yet been reached.\n if (loop_iteration == 0)\n {\n goto LoopBody;\n }\n goto LoopEnd;\n \n // The loop iteration failed. Put state back to the way it was before the iteration.\n LoopIterationNoMatch:\n if (--loop_iteration < 0)\n {\n // Unable to match the remainder of the expression after exhausting the loop.\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n pos = base.runstack![--stackpos];\n UncaptureUntil(base.runstack![--stackpos]);\n slice = inputSpan.Slice(pos);\n goto LoopEnd;\n \n LoopBacktrack:\n base.CheckTimeout();\n \n if (loop_iteration == 0)\n {\n // No iterations of the loop remain to backtrack into. Fail the loop.\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n goto CaptureBacktrack;\n LoopEnd:;\n //}\n \n // Loop greedily any number of times.\n //{\n loop_iteration1 = 0;\n \n LoopBody1:\n Utilities.StackPush(ref base.runstack!, ref stackpos, base.Crawlpos(), pos);\n \n loop_iteration1++;\n \n // 2nd capture group.\n //{\n int capture_starting_pos1 = pos;\n \n if ((uint)slice.Length < 2 ||\n slice[0] != '.' || // Match '.'.\n !char.IsAsciiLetterOrDigit(slice[1])) // Match a character in the set [0-9A-Za-z].\n {\n goto LoopIterationNoMatch1;\n }\n \n // Optional (greedy).\n //{\n pos += 2;\n slice = inputSpan.Slice(pos);\n loop_iteration2 = 0;\n \n LoopBody2:\n Utilities.StackPush(ref base.runstack!, ref stackpos, base.Crawlpos(), pos);\n \n loop_iteration2++;\n \n // 3rd capture group.\n //{\n int capture_starting_pos2 = pos;\n \n // Match a character in the set [-0-9A-Za-z] greedily at most 61 times.\n //{\n charloop_starting_pos1 = pos;\n \n int iteration1 = 0;\n while (iteration1 < 61 && (uint)iteration1 < (uint)slice.Length && ((ch = slice[iteration1]) < '{' && (\"\\0\\0 Ͽ\\ufffe߿\\ufffe߿\"[ch >> 4] & (1 << (ch & 0xF))) != 0))\n {\n iteration1++;\n }\n \n slice = slice.Slice(iteration1);\n pos += iteration1;\n \n charloop_ending_pos1 = pos;\n goto CharLoopEnd1;\n \n CharLoopBacktrack1:\n UncaptureUntil(base.runstack![--stackpos]);\n Utilities.StackPop(base.runstack!, ref stackpos, out charloop_ending_pos1, out charloop_starting_pos1);", + "snippet": "{\n goto LoopIterationNoMatch;\n }\n charloop_ending_pos += charloop_starting_pos;\n pos = charl" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (8/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L841-L960", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 841, + "endLine": 960, + "content": "base.CheckTimeout();\n \n if (charloop_starting_pos1 >= charloop_ending_pos1 ||\n (charloop_ending_pos1 = inputSpan.Slice(charloop_starting_pos1, charloop_ending_pos1 - charloop_starting_pos1).LastIndexOfAny(Utilities.s_asciiLettersAndDigits)) < 0)\n {\n goto LoopIterationNoMatch2;\n }\n charloop_ending_pos1 += charloop_starting_pos1;\n pos = charloop_ending_pos1;\n slice = inputSpan.Slice(pos);\n \n CharLoopEnd1:\n Utilities.StackPush(ref base.runstack!, ref stackpos, charloop_starting_pos1, charloop_ending_pos1, base.Crawlpos());\n //}\n \n // Match a character in the set [0-9A-Za-z].\n if (slice.IsEmpty || !char.IsAsciiLetterOrDigit(slice[0]))\n {\n goto CharLoopBacktrack1;\n }\n \n pos++;\n slice = inputSpan.Slice(pos);\n base.Capture(3, capture_starting_pos2, pos);\n \n Utilities.StackPush(ref base.runstack!, ref stackpos, capture_starting_pos2);\n goto CaptureSkipBacktrack1;\n \n CaptureBacktrack1:\n capture_starting_pos2 = base.runstack![--stackpos];\n goto CharLoopBacktrack1;\n \n CaptureSkipBacktrack1:;\n //}\n \n \n // The loop has an upper bound of 1. Continue iterating greedily if it hasn't yet been reached.\n if (loop_iteration2 == 0)\n {\n goto LoopBody2;\n }\n goto LoopEnd2;\n \n // The loop iteration failed. Put state back to the way it was before the iteration.\n LoopIterationNoMatch2:\n if (--loop_iteration2 < 0)\n {\n // Unable to match the remainder of the expression after exhausting the loop.\n goto LoopIterationNoMatch1;\n }\n pos = base.runstack![--stackpos];\n UncaptureUntil(base.runstack![--stackpos]);\n slice = inputSpan.Slice(pos);\n goto LoopEnd2;\n \n LoopBacktrack1:\n base.CheckTimeout();\n \n if (loop_iteration2 == 0)\n {\n // No iterations of the loop remain to backtrack into. Fail the loop.\n goto LoopIterationNoMatch1;\n }\n goto CaptureBacktrack1;\n LoopEnd2:\n \n Utilities.StackPush(ref base.runstack!, ref stackpos, loop_iteration2);\n goto LoopSkipBacktrack;\n \n LoopBacktrack2:\n loop_iteration2 = base.runstack![--stackpos];\n base.CheckTimeout();\n \n goto LoopBacktrack1;\n \n LoopSkipBacktrack:;\n //}\n \n base.Capture(2, capture_starting_pos1, pos);\n \n Utilities.StackPush(ref base.runstack!, ref stackpos, capture_starting_pos1);\n goto CaptureSkipBacktrack2;\n \n CaptureBacktrack2:\n capture_starting_pos1 = base.runstack![--stackpos];\n goto LoopBacktrack2;\n \n CaptureSkipBacktrack2:;\n //}\n \n \n // The loop has no upper bound. Continue iterating greedily.\n goto LoopBody1;\n \n // The loop iteration failed. Put state back to the way it was before the iteration.\n LoopIterationNoMatch1:\n if (--loop_iteration1 < 0)\n {\n // Unable to match the remainder of the expression after exhausting the loop.\n goto LoopBacktrack;\n }\n pos = base.runstack![--stackpos];\n UncaptureUntil(base.runstack![--stackpos]);\n slice = inputSpan.Slice(pos);\n goto LoopEnd1;\n \n LoopBacktrack3:\n base.CheckTimeout();\n \n if (loop_iteration1 == 0)\n {\n // No iterations of the loop remain to backtrack into. Fail the loop.\n goto LoopBacktrack;\n }\n goto CaptureBacktrack2;\n LoopEnd1:;\n //}\n \n // Match if at the end of the string or if before an ending newline.\n if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\\n'))", + "snippet": "base.CheckTimeout();\n \n if (charloop_starting_pos1 >= charloop_ending_pos1 ||\n (charloop_ending_pos" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (9/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L961-L1080", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 961, + "endLine": 1080, + "content": "{\n goto LoopBacktrack3;\n }\n \n // The input matched.\n base.runtextpos = pos;\n base.Capture(0, matchStart, pos);\n return true;\n \n // Undo captures until it reaches the specified capture position.\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void UncaptureUntil(int capturePosition)\n {\n while (base.Crawlpos() > capturePosition)\n {\n base.Uncapture();\n }\n }\n }\n }\n }\n\n }\n \n /// Custom -derived type for the NormalizeDomainRegex method.\n [GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n file sealed class NormalizeDomainRegex_2 : Regex\n {\n /// Cached, thread-safe singleton instance.\n internal static readonly NormalizeDomainRegex_2 Instance = new();\n \n /// Initializes the instance.\n private NormalizeDomainRegex_2()\n {\n base.pattern = \"(@)(.+)$\";\n base.roptions = RegexOptions.Compiled;\n base.internalMatchTimeout = TimeSpan.FromMilliseconds(250);\n base.factory = new RunnerFactory();\n base.capsize = 3;\n }\n \n /// Provides a factory for creating instances to be used by methods on .\n private sealed class RunnerFactory : RegexRunnerFactory\n {\n /// Creates an instance of a used by methods on .\n protected override RegexRunner CreateInstance() => new Runner();\n \n /// Provides the runner that contains the custom logic implementing the specified regular expression.\n private sealed class Runner : RegexRunner\n {\n /// Scan the starting from base.runtextstart for the next match.\n /// The text being scanned by the regular expression.\n protected override void Scan(ReadOnlySpan inputSpan)\n {\n // Search until we can't find a valid starting position, we find a match, or we reach the end of the input.\n while (TryFindNextPossibleStartingPosition(inputSpan) &&\n !TryMatchAtCurrentPosition(inputSpan) &&\n base.runtextpos != inputSpan.Length)\n {\n base.runtextpos++;\n base.CheckTimeout();\n }\n }\n \n /// Search starting from base.runtextpos for the next location a match could possibly start.\n /// The text being scanned by the regular expression.\n /// true if a possible match was found; false if no more matches are possible.\n private bool TryFindNextPossibleStartingPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n \n // Any possible match is at least 2 characters.\n if (pos <= inputSpan.Length - 2)\n {\n // The pattern begins with a character in the set @.\n // Find the next occurrence. If it can't be found, there's no match.\n int i = inputSpan.Slice(pos).IndexOf('@');\n if (i >= 0)\n {\n base.runtextpos = pos + i;\n return true;\n }\n }\n \n // No match found.\n base.runtextpos = inputSpan.Length;\n return false;\n }\n \n /// Determine whether at base.runtextpos is a match for the regular expression.\n /// The text being scanned by the regular expression.\n /// true if the regular expression matches at the current position; otherwise, false.\n private bool TryMatchAtCurrentPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n int matchStart = pos;\n int capture_starting_pos = 0;\n int capture_starting_pos1 = 0;\n int charloop_capture_pos = 0;\n int charloop_starting_pos = 0, charloop_ending_pos = 0;\n ReadOnlySpan slice = inputSpan.Slice(pos);\n \n // 1st capture group.\n {\n capture_starting_pos = pos;\n \n // Match '@'.\n if (slice.IsEmpty || slice[0] != '@')\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n \n pos++;\n slice = inputSpan.Slice(pos);\n base.Capture(1, capture_starting_pos, pos);\n }\n \n // 2nd capture group.\n //{", + "snippet": "{\n goto LoopBacktrack3;\n }\n \n // The input matched.\n base.runtextpos = pos;\n base.Capture(0, matchStar" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (10/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L1081-L1200", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 1081, + "endLine": 1200, + "content": "capture_starting_pos1 = pos;\n \n // Match a character other than '\\n' greedily at least once.\n //{\n charloop_starting_pos = pos;\n \n int iteration = slice.IndexOf('\\n');\n if (iteration < 0)\n {\n iteration = slice.Length;\n }\n \n if (iteration == 0)\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n \n slice = slice.Slice(iteration);\n pos += iteration;\n \n charloop_ending_pos = pos;\n charloop_starting_pos++;\n goto CharLoopEnd;\n \n CharLoopBacktrack:\n UncaptureUntil(charloop_capture_pos);\n \n base.CheckTimeout();\n \n if (charloop_starting_pos >= charloop_ending_pos)\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n pos = --charloop_ending_pos;\n slice = inputSpan.Slice(pos);\n \n CharLoopEnd:\n charloop_capture_pos = base.Crawlpos();\n //}\n \n base.Capture(2, capture_starting_pos1, pos);\n \n goto CaptureSkipBacktrack;\n \n CaptureBacktrack:\n goto CharLoopBacktrack;\n \n CaptureSkipBacktrack:;\n //}\n \n // Match if at the end of the string or if before an ending newline.\n if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\\n'))\n {\n goto CaptureBacktrack;\n }\n \n // The input matched.\n base.runtextpos = pos;\n base.Capture(0, matchStart, pos);\n return true;\n \n // Undo captures until it reaches the specified capture position.\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void UncaptureUntil(int capturePosition)\n {\n while (base.Crawlpos() > capturePosition)\n {\n base.Uncapture();\n }\n }\n }\n }\n }\n\n }\n \n /// Custom -derived type for the EmailFormatRegex method.\n [GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n file sealed class EmailFormatRegex_3 : Regex\n {\n /// Cached, thread-safe singleton instance.\n internal static readonly EmailFormatRegex_3 Instance = new();\n \n /// Initializes the instance.\n private EmailFormatRegex_3()\n {\n base.pattern = \"^(?(\\\")(\\\".+?(?Provides a factory for creating instances to be used by methods on .
\n private sealed class RunnerFactory : RegexRunnerFactory\n {\n /// Creates an instance of a used by methods on .\n protected override RegexRunner CreateInstance() => new Runner();\n \n /// Provides the runner that contains the custom logic implementing the specified regular expression.\n private sealed class Runner : RegexRunner\n {\n /// Scan the starting from base.runtextstart for the next match.\n /// The text being scanned by the regular expression.\n protected override void Scan(ReadOnlySpan inputSpan)\n {\n // The pattern is anchored. Validate the current position and try to match at it only.\n if (TryFindNextPossibleStartingPosition(inputSpan) && !TryMatchAtCurrentPosition(inputSpan))\n {\n base.runtextpos = inputSpan.Length;\n }\n }\n \n /// Search starting from base.runtextpos for the next location a match could possibly start.\n /// The text being scanned by the regular expression.\n /// true if a possible match was found; false if no more matches are possible.\n private bool TryFindNextPossibleStartingPosition(ReadOnlySpan inputSpan)\n {", + "snippet": "capture_starting_pos1 = pos;\n \n // Match a character other than '\\n' greedily at least once.\n //{\n charloop_starting_pos = p" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (11/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L1201-L1320", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 1201, + "endLine": 1320, + "content": "int pos = base.runtextpos;\n \n // Any possible match is at least 6 characters.\n if (pos <= inputSpan.Length - 6)\n {\n // The pattern leads with a beginning (\\A) anchor.\n if (pos == 0)\n {\n return true;\n }\n }\n \n // No match found.\n base.runtextpos = inputSpan.Length;\n return false;\n }\n \n /// Determine whether at base.runtextpos is a match for the regular expression.\n /// The text being scanned by the regular expression.\n /// true if the regular expression matches at the current position; otherwise, false.\n private bool TryMatchAtCurrentPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n int matchStart = pos;\n char ch;\n int alternation_branch = 0;\n int alternation_starting_capturepos = 0;\n int alternation_starting_pos = 0;\n int capture_starting_pos = 0;\n int capture_starting_pos1 = 0;\n int capture_starting_pos4 = 0;\n int capture_starting_pos5 = 0;\n int charloop_capture_pos = 0;\n int charloop_starting_pos = 0, charloop_ending_pos = 0;\n int charloop_starting_pos1 = 0, charloop_ending_pos1 = 0;\n int charloop_starting_pos2 = 0, charloop_ending_pos2 = 0;\n int conditionalexpression_branch = 0;\n int lazyloop_capturepos = 0;\n int lazyloop_pos = 0;\n int loop_iteration = 0;\n int loop_iteration1 = 0;\n int loop_iteration2 = 0;\n int stackpos = 0;\n ReadOnlySpan slice = inputSpan.Slice(pos);\n \n // Match if at the beginning of the string.\n if (pos != 0)\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n \n // Conditionally match one of two expressions depending on whether an initial expression matches.\n //{\n int conditionalexpression_starting_pos = pos;\n \n // Condition:\n // Match '\"'.\n if (slice.IsEmpty || slice[0] != '\"')\n {\n goto ConditionalExpressionNotMatched;\n }\n \n // Condition matched:\n pos = conditionalexpression_starting_pos;\n slice = inputSpan.Slice(pos);\n \n // 1st capture group.\n //{\n capture_starting_pos = pos;\n \n // Match '\"'.\n if (slice.IsEmpty || slice[0] != '\"')\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n \n // Match a character other than '\\n' lazily at least once.\n //{\n if ((uint)slice.Length < 2 || slice[1] == '\\n')\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n \n pos += 2;\n slice = inputSpan.Slice(pos);\n lazyloop_pos = pos;\n goto LazyLoopEnd;\n \n LazyLoopBacktrack:\n UncaptureUntil(lazyloop_capturepos);\n base.CheckTimeout();\n \n pos = lazyloop_pos;\n slice = inputSpan.Slice(pos);\n if (slice.IsEmpty || slice[0] == '\\n')\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n pos++;\n slice = inputSpan.Slice(pos);\n lazyloop_pos = pos;\n \n LazyLoopEnd:\n lazyloop_capturepos = base.Crawlpos();\n //}\n \n // Zero-width negative lookbehind.\n {\n slice = inputSpan.Slice(pos);\n int negativelookbehind__starting_pos = pos;\n base.CheckTimeout();\n \n // Match '\\\\' right-to-left.\n if ((uint)(pos - 1) >= inputSpan.Length || inputSpan[pos - 1] != '\\\\')\n {\n goto NegativeLookaroundMatch;", + "snippet": "int pos = base.runtextpos;\n \n // Any possible match is at least 6 characters.\n if (pos <= inputSpan.Length - 6)\n {\n // Th" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (12/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L1321-L1440", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 1321, + "endLine": 1440, + "content": "}\n pos--;\n \n goto LazyLoopBacktrack;\n \n NegativeLookaroundMatch:\n pos = negativelookbehind__starting_pos;\n slice = inputSpan.Slice(pos);\n }\n \n // Match the string \"\\\"@\".\n if (!slice.StartsWith(\"\\\"@\"))\n {\n goto LazyLoopBacktrack;\n }\n \n pos += 2;\n slice = inputSpan.Slice(pos);\n base.Capture(1, capture_starting_pos, pos);\n \n goto CaptureSkipBacktrack;\n \n CaptureBacktrack:\n goto LazyLoopBacktrack;\n \n CaptureSkipBacktrack:;\n //}\n \n conditionalexpression_branch = 0;\n goto ConditionalExpressionEnd;\n \n // Condition did not match:\n ConditionalExpressionNotMatched:\n pos = conditionalexpression_starting_pos;\n slice = inputSpan.Slice(pos);\n \n // 2nd capture group.\n //{\n capture_starting_pos1 = pos;\n \n // Match a character in the set [!#-'*+-/-9=?A-Z^-~] greedily at least once.\n //{\n charloop_starting_pos = pos;\n \n int iteration = slice.IndexOfAnyExcept(Utilities.s_ascii_FAACFFA3FEFFFFC7FFFFFF7F);\n if (iteration < 0)\n {\n iteration = slice.Length;\n }\n \n if (iteration == 0)\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n \n slice = slice.Slice(iteration);\n pos += iteration;\n \n charloop_ending_pos = pos;\n charloop_starting_pos++;\n goto CharLoopEnd;\n \n CharLoopBacktrack:\n UncaptureUntil(charloop_capture_pos);\n \n base.CheckTimeout();\n \n if (charloop_starting_pos >= charloop_ending_pos)\n {\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n pos = --charloop_ending_pos;\n slice = inputSpan.Slice(pos);\n \n CharLoopEnd:\n charloop_capture_pos = base.Crawlpos();\n //}\n \n // Loop greedily any number of times.\n //{\n loop_iteration = 0;\n \n LoopBody:\n Utilities.StackPush(ref base.runstack!, ref stackpos, base.Crawlpos(), pos);\n \n loop_iteration++;\n \n // 3rd capture group.\n //{\n int capture_starting_pos2 = pos;\n \n // Match '.'.\n if (slice.IsEmpty || slice[0] != '.')\n {\n goto LoopIterationNoMatch;\n }\n \n // 4th capture group.\n //{\n pos++;\n slice = inputSpan.Slice(pos);\n int capture_starting_pos3 = pos;\n \n // Zero-width negative lookahead.\n {\n slice = inputSpan.Slice(pos);\n int negativelookahead__starting_pos = pos;\n base.CheckTimeout();\n \n // Match '.'.\n if (slice.IsEmpty || slice[0] != '.')\n {\n goto NegativeLookaroundMatch1;\n }\n \n goto LoopIterationNoMatch;\n \n NegativeLookaroundMatch1:", + "snippet": "}\n pos--;\n \n goto LazyLoopBacktrack;\n \n NegativeLookaroundMatch:\n" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (13/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L1441-L1560", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 1441, + "endLine": 1560, + "content": "pos = negativelookahead__starting_pos;\n slice = inputSpan.Slice(pos);\n }\n \n // Match a character in the set [!#-'*+-/-9=?A-Z^-~] greedily at least once.\n //{\n charloop_starting_pos1 = pos;\n \n int iteration1 = slice.IndexOfAnyExcept(Utilities.s_ascii_FAACFFA3FEFFFFC7FFFFFF7F);\n if (iteration1 < 0)\n {\n iteration1 = slice.Length;\n }\n \n if (iteration1 == 0)\n {\n goto LoopIterationNoMatch;\n }\n \n slice = slice.Slice(iteration1);\n pos += iteration1;\n \n charloop_ending_pos1 = pos;\n charloop_starting_pos1++;\n goto CharLoopEnd1;\n \n CharLoopBacktrack1:\n UncaptureUntil(base.runstack![--stackpos]);\n Utilities.StackPop(base.runstack!, ref stackpos, out charloop_ending_pos1, out charloop_starting_pos1);\n \n base.CheckTimeout();\n \n if (charloop_starting_pos1 >= charloop_ending_pos1)\n {\n goto LoopIterationNoMatch;\n }\n pos = --charloop_ending_pos1;\n slice = inputSpan.Slice(pos);\n \n CharLoopEnd1:\n Utilities.StackPush(ref base.runstack!, ref stackpos, charloop_starting_pos1, charloop_ending_pos1, base.Crawlpos());\n //}\n \n base.Capture(4, capture_starting_pos3, pos);\n \n Utilities.StackPush(ref base.runstack!, ref stackpos, capture_starting_pos3);\n goto CaptureSkipBacktrack1;\n \n CaptureBacktrack1:\n capture_starting_pos3 = base.runstack![--stackpos];\n goto CharLoopBacktrack1;\n \n CaptureSkipBacktrack1:;\n //}\n \n base.Capture(3, capture_starting_pos2, pos);\n \n Utilities.StackPush(ref base.runstack!, ref stackpos, capture_starting_pos2);\n goto CaptureSkipBacktrack2;\n \n CaptureBacktrack2:\n capture_starting_pos2 = base.runstack![--stackpos];\n goto CaptureBacktrack1;\n \n CaptureSkipBacktrack2:;\n //}\n \n \n // The loop has no upper bound. Continue iterating greedily.\n goto LoopBody;\n \n // The loop iteration failed. Put state back to the way it was before the iteration.\n LoopIterationNoMatch:\n if (--loop_iteration < 0)\n {\n // Unable to match the remainder of the expression after exhausting the loop.\n goto CharLoopBacktrack;\n }\n pos = base.runstack![--stackpos];\n UncaptureUntil(base.runstack![--stackpos]);\n slice = inputSpan.Slice(pos);\n goto LoopEnd;\n \n LoopBacktrack:\n base.CheckTimeout();\n \n if (loop_iteration == 0)\n {\n // No iterations of the loop remain to backtrack into. Fail the loop.\n goto CharLoopBacktrack;\n }\n goto CaptureBacktrack2;\n LoopEnd:;\n //}\n \n // Match '@'.\n if (slice.IsEmpty || slice[0] != '@')\n {\n goto LoopBacktrack;\n }\n \n pos++;\n slice = inputSpan.Slice(pos);\n base.Capture(2, capture_starting_pos1, pos);\n \n goto CaptureSkipBacktrack3;\n \n CaptureBacktrack3:\n goto LoopBacktrack;\n \n CaptureSkipBacktrack3:;\n //}\n \n conditionalexpression_branch = 1;\n goto ConditionalExpressionEnd;\n \n ConditionalExpressionBacktrack:\n switch (conditionalexpression_branch)\n {\n case 0:", + "snippet": "pos = negativelookahead__starting_pos;\n slice = inputSpan.Slice(pos);\n }\n \n " + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (14/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L1561-L1680", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 1561, + "endLine": 1680, + "content": "goto CaptureBacktrack;\n case 1:\n goto CaptureBacktrack3;\n default:\n UncaptureUntil(0);\n return false; // The input didn't match.\n }\n ConditionalExpressionEnd:;\n //}\n \n // 5th capture group.\n //{\n capture_starting_pos4 = pos;\n \n // Match with 2 alternative expressions.\n //{\n alternation_starting_pos = pos;\n alternation_starting_capturepos = base.Crawlpos();\n \n // Branch 0\n //{\n // Match '['.\n if (slice.IsEmpty || slice[0] != '[')\n {\n goto AlternationBranch;\n }\n \n // 6th capture group.\n //{\n pos++;\n slice = inputSpan.Slice(pos);\n capture_starting_pos5 = pos;\n \n // Match with 2 alternative expressions.\n //{\n if (slice.IsEmpty)\n {\n goto AlternationBranch;\n }\n \n switch (slice[0])\n {\n case '0' or '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9':\n // Match a character in the set [0-9] atomically at least 1 and at most 3 times.\n {\n int iteration2 = 0;\n while (iteration2 < 3 && (uint)iteration2 < (uint)slice.Length && char.IsAsciiDigit(slice[iteration2]))\n {\n iteration2++;\n }\n \n if (iteration2 == 0)\n {\n goto AlternationBranch;\n }\n \n slice = slice.Slice(iteration2);\n pos += iteration2;\n }\n \n // Match '.'.\n if (slice.IsEmpty || slice[0] != '.')\n {\n goto AlternationBranch;\n }\n \n // Match a character in the set [0-9] atomically at least 1 and at most 3 times.\n {\n pos++;\n slice = inputSpan.Slice(pos);\n int iteration3 = 0;\n while (iteration3 < 3 && (uint)iteration3 < (uint)slice.Length && char.IsAsciiDigit(slice[iteration3]))\n {\n iteration3++;\n }\n \n if (iteration3 == 0)\n {\n goto AlternationBranch;\n }\n \n slice = slice.Slice(iteration3);\n pos += iteration3;\n }\n \n // Match '.'.\n if (slice.IsEmpty || slice[0] != '.')\n {\n goto AlternationBranch;\n }\n \n // Match a character in the set [0-9] atomically at least 1 and at most 3 times.\n {\n pos++;\n slice = inputSpan.Slice(pos);\n int iteration4 = 0;\n while (iteration4 < 3 && (uint)iteration4 < (uint)slice.Length && char.IsAsciiDigit(slice[iteration4]))\n {\n iteration4++;\n }\n \n if (iteration4 == 0)\n {\n goto AlternationBranch;\n }\n \n slice = slice.Slice(iteration4);\n pos += iteration4;\n }\n \n // Match '.'.\n if (slice.IsEmpty || slice[0] != '.')\n {\n goto AlternationBranch;\n }\n \n // Match a character in the set [0-9] atomically at least 1 and at most 3 times.\n {\n pos++;\n slice = inputSpan.Slice(pos);", + "snippet": "goto CaptureBacktrack;\n case 1:\n goto CaptureBacktrack3;\n default:\n UncaptureUntil(0);\n " + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (15/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L1681-L1800", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 1681, + "endLine": 1800, + "content": "int iteration5 = 0;\n while (iteration5 < 3 && (uint)iteration5 < (uint)slice.Length && char.IsAsciiDigit(slice[iteration5]))\n {\n iteration5++;\n }\n \n if (iteration5 == 0)\n {\n goto AlternationBranch;\n }\n \n slice = slice.Slice(iteration5);\n pos += iteration5;\n }\n \n break;\n \n case 'I' or 'i':\n \n if ((uint)slice.Length < 5 ||\n !slice.Slice(1).StartsWith(\"pv6:\", StringComparison.OrdinalIgnoreCase)) // Match the string \"pv6:\" (ordinal case-insensitive)\n {\n goto AlternationBranch;\n }\n \n // Match a character in the set [.0-:A-Fa-f] atomically at least once.\n {\n int iteration6 = slice.Slice(5).IndexOfAnyExcept(Utilities.s_ascii_40FF077E0000007E000000);\n if (iteration6 < 0)\n {\n iteration6 = slice.Length - 5;\n }\n \n if (iteration6 == 0)\n {\n goto AlternationBranch;\n }\n \n slice = slice.Slice(iteration6);\n pos += iteration6;\n }\n \n pos += 5;\n slice = inputSpan.Slice(pos);\n break;\n \n default:\n goto AlternationBranch;\n }\n //}\n \n base.Capture(6, capture_starting_pos5, pos);\n //}\n \n // Match ']'.\n if (slice.IsEmpty || slice[0] != ']')\n {\n goto AlternationBranch;\n }\n \n alternation_branch = 0;\n pos++;\n slice = inputSpan.Slice(pos);\n goto AlternationMatch;\n \n AlternationBranch:\n pos = alternation_starting_pos;\n slice = inputSpan.Slice(pos);\n UncaptureUntil(alternation_starting_capturepos);\n //}\n \n // Branch 1\n //{\n // Loop greedily at least once.\n //{\n loop_iteration1 = 0;\n \n LoopBody1:\n Utilities.StackPush(ref base.runstack!, ref stackpos, base.Crawlpos(), pos);\n \n loop_iteration1++;\n \n // 7th capture group.\n //{\n int capture_starting_pos6 = pos;\n \n // Match a character in the set [0-9A-Za-z].\n if (slice.IsEmpty || !char.IsAsciiLetterOrDigit(slice[0]))\n {\n goto LoopIterationNoMatch1;\n }\n \n // Optional (greedy).\n //{\n pos++;\n slice = inputSpan.Slice(pos);\n loop_iteration2 = 0;\n \n LoopBody2:\n Utilities.StackPush(ref base.runstack!, ref stackpos, base.Crawlpos(), pos);\n \n loop_iteration2++;\n \n // 8th capture group.\n //{\n int capture_starting_pos7 = pos;\n \n // Match a character in the set [-0-9A-Za-z] greedily at most 61 times.\n //{\n charloop_starting_pos2 = pos;\n \n int iteration7 = 0;\n while (iteration7 < 61 && (uint)iteration7 < (uint)slice.Length && ((ch = slice[iteration7]) < '{' && (\"\\0\\0 Ͽ\\ufffe߿\\ufffe߿\"[ch >> 4] & (1 << (ch & 0xF))) != 0))\n {\n iteration7++;\n }\n \n slice = slice.Slice(iteration7);\n pos += iteration7;", + "snippet": "int iteration5 = 0;\n while (iteration5 < 3 && (uint)iteration5 < (uint)slice.Length && char.IsAsciiDigit(slice[iteration5]))\n " + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (16/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L1801-L1920", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 1801, + "endLine": 1920, + "content": "charloop_ending_pos2 = pos;\n goto CharLoopEnd2;\n \n CharLoopBacktrack2:\n UncaptureUntil(base.runstack![--stackpos]);\n Utilities.StackPop(base.runstack!, ref stackpos, out charloop_ending_pos2, out charloop_starting_pos2);\n \n base.CheckTimeout();\n \n if (charloop_starting_pos2 >= charloop_ending_pos2 ||\n (charloop_ending_pos2 = inputSpan.Slice(charloop_starting_pos2, charloop_ending_pos2 - charloop_starting_pos2).LastIndexOfAny(Utilities.s_asciiLettersAndDigits)) < 0)\n {\n goto LoopIterationNoMatch2;\n }\n charloop_ending_pos2 += charloop_starting_pos2;\n pos = charloop_ending_pos2;\n slice = inputSpan.Slice(pos);\n \n CharLoopEnd2:\n Utilities.StackPush(ref base.runstack!, ref stackpos, charloop_starting_pos2, charloop_ending_pos2, base.Crawlpos());\n //}\n \n // Match a character in the set [0-9A-Za-z].\n if (slice.IsEmpty || !char.IsAsciiLetterOrDigit(slice[0]))\n {\n goto CharLoopBacktrack2;\n }\n \n pos++;\n slice = inputSpan.Slice(pos);\n base.Capture(8, capture_starting_pos7, pos);\n \n Utilities.StackPush(ref base.runstack!, ref stackpos, capture_starting_pos7);\n goto CaptureSkipBacktrack4;\n \n CaptureBacktrack4:\n capture_starting_pos7 = base.runstack![--stackpos];\n goto CharLoopBacktrack2;\n \n CaptureSkipBacktrack4:;\n //}\n \n \n // The loop has an upper bound of 1. Continue iterating greedily if it hasn't yet been reached.\n if (loop_iteration2 == 0)\n {\n goto LoopBody2;\n }\n goto LoopEnd2;\n \n // The loop iteration failed. Put state back to the way it was before the iteration.\n LoopIterationNoMatch2:\n if (--loop_iteration2 < 0)\n {\n // Unable to match the remainder of the expression after exhausting the loop.\n goto LoopIterationNoMatch1;\n }\n pos = base.runstack![--stackpos];\n UncaptureUntil(base.runstack![--stackpos]);\n slice = inputSpan.Slice(pos);\n goto LoopEnd2;\n \n LoopBacktrack1:\n base.CheckTimeout();\n \n if (loop_iteration2 == 0)\n {\n // No iterations of the loop remain to backtrack into. Fail the loop.\n goto LoopIterationNoMatch1;\n }\n goto CaptureBacktrack4;\n LoopEnd2:\n \n Utilities.StackPush(ref base.runstack!, ref stackpos, loop_iteration2);\n goto LoopSkipBacktrack;\n \n LoopBacktrack2:\n loop_iteration2 = base.runstack![--stackpos];\n base.CheckTimeout();\n \n goto LoopBacktrack1;\n \n LoopSkipBacktrack:;\n //}\n \n // Match '.'.\n if (slice.IsEmpty || slice[0] != '.')\n {\n goto LoopBacktrack2;\n }\n \n pos++;\n slice = inputSpan.Slice(pos);\n base.Capture(7, capture_starting_pos6, pos);\n \n Utilities.StackPush(ref base.runstack!, ref stackpos, capture_starting_pos6);\n goto CaptureSkipBacktrack5;\n \n CaptureBacktrack5:\n capture_starting_pos6 = base.runstack![--stackpos];\n goto LoopBacktrack2;\n \n CaptureSkipBacktrack5:;\n //}\n \n \n // The loop has no upper bound. Continue iterating greedily.\n goto LoopBody1;\n \n // The loop iteration failed. Put state back to the way it was before the iteration.\n LoopIterationNoMatch1:\n if (--loop_iteration1 < 0)\n {\n // Unable to match the remainder of the expression after exhausting the loop.\n goto ConditionalExpressionBacktrack;\n }\n pos = base.runstack![--stackpos];\n UncaptureUntil(base.runstack![--stackpos]);\n slice = inputSpan.Slice(pos);\n if (loop_iteration1 == 0)", + "snippet": "charloop_ending_pos2 = pos;\n goto CharLoopEnd2;\n \n CharLoopBacktrac" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (17/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L1921-L2040", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 1921, + "endLine": 2040, + "content": "{\n // No iterations have been matched to backtrack into. Fail the loop.\n goto ConditionalExpressionBacktrack;\n }\n \n goto LoopEnd1;\n \n LoopBacktrack3:\n base.CheckTimeout();\n \n if (loop_iteration1 == 0)\n {\n // No iterations of the loop remain to backtrack into. Fail the loop.\n goto ConditionalExpressionBacktrack;\n }\n goto CaptureBacktrack5;\n LoopEnd1:;\n //}\n \n // Match a character in the set [A-Za-z] atomically at least 2 and at most 63 times.\n {\n int iteration8 = 0;\n while (iteration8 < 63 && (uint)iteration8 < (uint)slice.Length && char.IsAsciiLetter(slice[iteration8]))\n {\n iteration8++;\n }\n \n if (iteration8 < 2)\n {\n goto LoopBacktrack3;\n }\n \n slice = slice.Slice(iteration8);\n pos += iteration8;\n }\n \n alternation_branch = 1;\n goto AlternationMatch;\n //}\n \n AlternationBacktrack:\n base.CheckTimeout();\n \n switch (alternation_branch)\n {\n case 0:\n goto AlternationBranch;\n case 1:\n goto LoopBacktrack3;\n }\n \n AlternationMatch:;\n //}\n \n base.Capture(5, capture_starting_pos4, pos);\n \n goto CaptureSkipBacktrack6;\n \n CaptureBacktrack6:\n goto AlternationBacktrack;\n \n CaptureSkipBacktrack6:;\n //}\n \n // Match if at the end of the string or if before an ending newline.\n if (pos < inputSpan.Length - 1 || ((uint)pos < (uint)inputSpan.Length && inputSpan[pos] != '\\n'))\n {\n goto CaptureBacktrack6;\n }\n \n // The input matched.\n base.runtextpos = pos;\n base.Capture(0, matchStart, pos);\n return true;\n \n // Undo captures until it reaches the specified capture position.\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void UncaptureUntil(int capturePosition)\n {\n while (base.Crawlpos() > capturePosition)\n {\n base.Uncapture();\n }\n }\n }\n }\n }\n\n }\n \n /// Custom -derived type for the GetAnchorPatternRegex method.\n [GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n file sealed class GetAnchorPatternRegex_4 : Regex\n {\n /// Cached, thread-safe singleton instance.\n internal static readonly GetAnchorPatternRegex_4 Instance = new();\n \n /// Initializes the instance.\n private GetAnchorPatternRegex_4()\n {\n base.pattern = \"^[A-Za-z_][-A-Za-z0-9._]*$\";\n base.roptions = RegexOptions.Compiled;\n ValidateMatchTimeout(Utilities.s_defaultTimeout);\n base.internalMatchTimeout = Utilities.s_defaultTimeout;\n base.factory = new RunnerFactory();\n base.capsize = 1;\n }\n \n /// Provides a factory for creating instances to be used by methods on .\n private sealed class RunnerFactory : RegexRunnerFactory\n {\n /// Creates an instance of a used by methods on .\n protected override RegexRunner CreateInstance() => new Runner();\n \n /// Provides the runner that contains the custom logic implementing the specified regular expression.\n private sealed class Runner : RegexRunner\n {\n /// Scan the starting from base.runtextstart for the next match.\n /// The text being scanned by the regular expression.\n protected override void Scan(ReadOnlySpan inputSpan)", + "snippet": "{\n // No iterations have been matched to backtrack into. Fail the loop.\n goto ConditionalExpressionBacktrack;\n " + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (18/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L2041-L2160", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 2041, + "endLine": 2160, + "content": "{\n // The pattern is anchored. Validate the current position and try to match at it only.\n if (TryFindNextPossibleStartingPosition(inputSpan) && !TryMatchAtCurrentPosition(inputSpan))\n {\n base.runtextpos = inputSpan.Length;\n }\n }\n \n /// Search starting from base.runtextpos for the next location a match could possibly start.\n /// The text being scanned by the regular expression.\n /// true if a possible match was found; false if no more matches are possible.\n private bool TryFindNextPossibleStartingPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n \n // Empty matches aren't possible.\n if ((uint)pos < (uint)inputSpan.Length)\n {\n // The pattern leads with a beginning (\\A) anchor.\n if (pos == 0)\n {\n return true;\n }\n }\n \n // No match found.\n base.runtextpos = inputSpan.Length;\n return false;\n }\n \n /// Determine whether at base.runtextpos is a match for the regular expression.\n /// The text being scanned by the regular expression.\n /// true if the regular expression matches at the current position; otherwise, false.\n private bool TryMatchAtCurrentPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n int matchStart = pos;\n ulong charMinusLowUInt64;\n ReadOnlySpan slice = inputSpan.Slice(pos);\n \n // Match if at the beginning of the string.\n if (pos != 0)\n {\n return false; // The input didn't match.\n }\n \n // Match a character in the set [A-Z_a-z].\n if (slice.IsEmpty || ((long)((0xFFFFFFC2FFFFFFC0UL << (int)(charMinusLowUInt64 = (uint)slice[0] - 'A')) & (charMinusLowUInt64 - 64)) >= 0))\n {\n return false; // The input didn't match.\n }\n \n // Match a character in the set [-.0-9A-Z_a-z] atomically any number of times.\n {\n int iteration = slice.Slice(1).IndexOfAnyExcept(Utilities.s_ascii_60FF03FEFFFF87FEFFFF07);\n if (iteration < 0)\n {\n iteration = slice.Length - 1;\n }\n \n slice = slice.Slice(iteration);\n pos += iteration;\n }\n \n // Match if at the end of the string or if before an ending newline.\n if (2 < slice.Length || (1 < slice.Length && slice[1] != '\\n'))\n {\n return false; // The input didn't match.\n }\n \n // The input matched.\n pos++;\n base.runtextpos = pos;\n base.Capture(0, matchStart, pos);\n return true;\n }\n }\n }\n\n }\n \n /// Custom -derived type for the GetAnchorPatternRegex method.\n [GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n file sealed class GetAnchorPatternRegex_5 : Regex\n {\n /// Cached, thread-safe singleton instance.\n internal static readonly GetAnchorPatternRegex_5 Instance = new();\n \n /// Initializes the instance.\n private GetAnchorPatternRegex_5()\n {\n base.pattern = \"^[A-Za-z][-A-Za-z0-9.:_]*$\";\n base.roptions = RegexOptions.Compiled;\n ValidateMatchTimeout(Utilities.s_defaultTimeout);\n base.internalMatchTimeout = Utilities.s_defaultTimeout;\n base.factory = new RunnerFactory();\n base.capsize = 1;\n }\n \n /// Provides a factory for creating instances to be used by methods on .\n private sealed class RunnerFactory : RegexRunnerFactory\n {\n /// Creates an instance of a used by methods on .\n protected override RegexRunner CreateInstance() => new Runner();\n \n /// Provides the runner that contains the custom logic implementing the specified regular expression.\n private sealed class Runner : RegexRunner\n {\n /// Scan the starting from base.runtextstart for the next match.\n /// The text being scanned by the regular expression.\n protected override void Scan(ReadOnlySpan inputSpan)\n {\n // The pattern is anchored. Validate the current position and try to match at it only.\n if (TryFindNextPossibleStartingPosition(inputSpan) && !TryMatchAtCurrentPosition(inputSpan))\n {\n base.runtextpos = inputSpan.Length;\n }\n }\n \n /// Search starting from base.runtextpos for the next location a match could possibly start.", + "snippet": "{\n // The pattern is anchored. Validate the current position and try to match at it only.\n if (TryFindNextPossibleStartingPosition(inputSpan) && !TryMatchAtCurrentPosition(inputSpan" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (19/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L2161-L2280", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 2161, + "endLine": 2280, + "content": "/// The text being scanned by the regular expression.\n /// true if a possible match was found; false if no more matches are possible.\n private bool TryFindNextPossibleStartingPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n \n // Empty matches aren't possible.\n if ((uint)pos < (uint)inputSpan.Length)\n {\n // The pattern leads with a beginning (\\A) anchor.\n if (pos == 0)\n {\n return true;\n }\n }\n \n // No match found.\n base.runtextpos = inputSpan.Length;\n return false;\n }\n \n /// Determine whether at base.runtextpos is a match for the regular expression.\n /// The text being scanned by the regular expression.\n /// true if the regular expression matches at the current position; otherwise, false.\n private bool TryMatchAtCurrentPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n int matchStart = pos;\n ReadOnlySpan slice = inputSpan.Slice(pos);\n \n // Match if at the beginning of the string.\n if (pos != 0)\n {\n return false; // The input didn't match.\n }\n \n // Match a character in the set [A-Za-z].\n if (slice.IsEmpty || !char.IsAsciiLetter(slice[0]))\n {\n return false; // The input didn't match.\n }\n \n // Match a character in the set [-.0-:A-Z_a-z] atomically any number of times.\n {\n int iteration = slice.Slice(1).IndexOfAnyExcept(Utilities.s_ascii_60FF07FEFFFF87FEFFFF07);\n if (iteration < 0)\n {\n iteration = slice.Length - 1;\n }\n \n slice = slice.Slice(iteration);\n pos += iteration;\n }\n \n // Match if at the end of the string or if before an ending newline.\n if (2 < slice.Length || (1 < slice.Length && slice[1] != '\\n'))\n {\n return false; // The input didn't match.\n }\n \n // The input matched.\n pos++;\n base.runtextpos = pos;\n base.Capture(0, matchStart, pos);\n return true;\n }\n }\n }\n\n }\n \n /// Custom -derived type for the GetAnchorPatternRegex method.\n [GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n file sealed class GetAnchorPatternRegex_6 : Regex\n {\n /// Cached, thread-safe singleton instance.\n internal static readonly GetAnchorPatternRegex_6 Instance = new();\n \n /// Initializes the instance.\n private GetAnchorPatternRegex_6()\n {\n base.pattern = \"^#[A-Za-z_][-A-Za-z0-9._]*$\";\n base.roptions = RegexOptions.Compiled;\n ValidateMatchTimeout(Utilities.s_defaultTimeout);\n base.internalMatchTimeout = Utilities.s_defaultTimeout;\n base.factory = new RunnerFactory();\n base.capsize = 1;\n }\n \n /// Provides a factory for creating instances to be used by methods on .\n private sealed class RunnerFactory : RegexRunnerFactory\n {\n /// Creates an instance of a used by methods on .\n protected override RegexRunner CreateInstance() => new Runner();\n \n /// Provides the runner that contains the custom logic implementing the specified regular expression.\n private sealed class Runner : RegexRunner\n {\n /// Scan the starting from base.runtextstart for the next match.\n /// The text being scanned by the regular expression.\n protected override void Scan(ReadOnlySpan inputSpan)\n {\n // The pattern is anchored. Validate the current position and try to match at it only.\n if (TryFindNextPossibleStartingPosition(inputSpan) && !TryMatchAtCurrentPosition(inputSpan))\n {\n base.runtextpos = inputSpan.Length;\n }\n }\n \n /// Search starting from base.runtextpos for the next location a match could possibly start.\n /// The text being scanned by the regular expression.\n /// true if a possible match was found; false if no more matches are possible.\n private bool TryFindNextPossibleStartingPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n \n // Any possible match is at least 2 characters.\n if (pos <= inputSpan.Length - 2)\n {\n // The pattern leads with a beginning (\\A) anchor.", + "snippet": "/// The text being scanned by the regular expression.\n /// true if a possible match was found; false if no more matches are possible.\n priv" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (20/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L2281-L2400", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 2281, + "endLine": 2400, + "content": "if (pos == 0)\n {\n return true;\n }\n }\n \n // No match found.\n base.runtextpos = inputSpan.Length;\n return false;\n }\n \n /// Determine whether at base.runtextpos is a match for the regular expression.\n /// The text being scanned by the regular expression.\n /// true if the regular expression matches at the current position; otherwise, false.\n private bool TryMatchAtCurrentPosition(ReadOnlySpan inputSpan)\n {\n int pos = base.runtextpos;\n int matchStart = pos;\n ulong charMinusLowUInt64;\n ReadOnlySpan slice = inputSpan.Slice(pos);\n \n // Match if at the beginning of the string.\n if (pos != 0)\n {\n return false; // The input didn't match.\n }\n \n if ((uint)slice.Length < 2 ||\n slice[0] != '#' || // Match '#'.\n ((long)((0xFFFFFFC2FFFFFFC0UL << (int)(charMinusLowUInt64 = (uint)slice[1] - 'A')) & (charMinusLowUInt64 - 64)) >= 0)) // Match a character in the set [A-Z_a-z].\n {\n return false; // The input didn't match.\n }\n \n // Match a character in the set [-.0-9A-Z_a-z] atomically any number of times.\n {\n int iteration = slice.Slice(2).IndexOfAnyExcept(Utilities.s_ascii_60FF03FEFFFF87FEFFFF07);\n if (iteration < 0)\n {\n iteration = slice.Length - 2;\n }\n \n slice = slice.Slice(iteration);\n pos += iteration;\n }\n \n // Match if at the end of the string or if before an ending newline.\n if (3 < slice.Length || (2 < slice.Length && slice[2] != '\\n'))\n {\n return false; // The input didn't match.\n }\n \n // The input matched.\n pos += 2;\n base.runtextpos = pos;\n base.Capture(0, matchStart, pos);\n return true;\n }\n }\n }\n\n }\n \n /// Helper methods used by generated -derived implementations.\n [GeneratedCodeAttribute(\"System.Text.RegularExpressions.Generator\", \"9.0.14.11910\")]\n file static class Utilities\n {\n /// Default timeout value set in , or if none was set.\n internal static readonly TimeSpan s_defaultTimeout = AppContext.GetData(\"REGEX_DEFAULT_MATCH_TIMEOUT\") is TimeSpan timeout ? timeout : Regex.InfiniteMatchTimeout;\n \n /// Whether is non-infinite.\n internal static readonly bool s_hasTimeout = s_defaultTimeout != Regex.InfiniteMatchTimeout;\n \n /// Pops 2 values from the backtracking stack.\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n internal static void StackPop(int[] stack, ref int pos, out int arg0, out int arg1)\n {\n arg0 = stack[--pos];\n arg1 = stack[--pos];\n }\n \n /// Pushes 1 value onto the backtracking stack.\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n internal static void StackPush(ref int[] stack, ref int pos, int arg0)\n {\n // If there's space available for the value, store it.\n int[] s = stack;\n int p = pos;\n if ((uint)p < (uint)s.Length)\n {\n s[p] = arg0;\n pos++;\n return;\n }\n \n // Otherwise, resize the stack to make room and try again.\n WithResize(ref stack, ref pos, arg0);\n \n // Resize the backtracking stack array and push 1 value onto the stack.\n [MethodImpl(MethodImplOptions.NoInlining)]\n static void WithResize(ref int[] stack, ref int pos, int arg0)\n {\n Array.Resize(ref stack, (pos + 0) * 2);\n StackPush(ref stack, ref pos, arg0);\n }\n }\n \n /// Pushes 2 values onto the backtracking stack.\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n internal static void StackPush(ref int[] stack, ref int pos, int arg0, int arg1)\n {\n // If there's space available for all 2 values, store them.\n int[] s = stack;\n int p = pos;\n if ((uint)(p + 1) < (uint)s.Length)\n {\n s[p] = arg0;\n s[p + 1] = arg1;\n pos += 2;\n return;", + "snippet": "if (pos == 0)\n {\n return true;\n }\n }\n \n // No match found.\n base.runtex" + }, + { + "title": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs (21/21)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs#L2401-L2459", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/GeneratedFiles/System.Text.RegularExpressions.Generator/System.Text.RegularExpressions.Generator.RegexGenerator/RegexGenerator.g.cs", + "startLine": 2401, + "endLine": 2459, + "content": "}\n \n // Otherwise, resize the stack to make room and try again.\n WithResize(ref stack, ref pos, arg0, arg1);\n \n // Resize the backtracking stack array and push 2 values onto the stack.\n [MethodImpl(MethodImplOptions.NoInlining)]\n static void WithResize(ref int[] stack, ref int pos, int arg0, int arg1)\n {\n Array.Resize(ref stack, (pos + 1) * 2);\n StackPush(ref stack, ref pos, arg0, arg1);\n }\n }\n \n /// Pushes 3 values onto the backtracking stack.\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n internal static void StackPush(ref int[] stack, ref int pos, int arg0, int arg1, int arg2)\n {\n // If there's space available for all 3 values, store them.\n int[] s = stack;\n int p = pos;\n if ((uint)(p + 2) < (uint)s.Length)\n {\n s[p] = arg0;\n s[p + 1] = arg1;\n s[p + 2] = arg2;\n pos += 3;\n return;\n }\n \n // Otherwise, resize the stack to make room and try again.\n WithResize(ref stack, ref pos, arg0, arg1, arg2);\n \n // Resize the backtracking stack array and push 3 values onto the stack.\n [MethodImpl(MethodImplOptions.NoInlining)]\n static void WithResize(ref int[] stack, ref int pos, int arg0, int arg1, int arg2)\n {\n Array.Resize(ref stack, (pos + 2) * 2);\n StackPush(ref stack, ref pos, arg0, arg1, arg2);\n }\n }\n \n /// Supports searching for characters in or not in \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\".\n internal static readonly SearchValues s_asciiLettersAndDigits = SearchValues.Create(\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\");\n \n /// Supports searching for characters in or not in \".0123456789:ABCDEFabcdef\".\n internal static readonly SearchValues s_ascii_40FF077E0000007E000000 = SearchValues.Create(\".0123456789:ABCDEFabcdef\");\n \n /// Supports searching for characters in or not in \"-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\".\n internal static readonly SearchValues s_ascii_60FF03FEFFFF87FEFFFF07 = SearchValues.Create(\"-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\");\n \n /// Supports searching for characters in or not in \"-.0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\".\n internal static readonly SearchValues s_ascii_60FF07FEFFFF87FEFFFF07 = SearchValues.Create(\"-.0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz\");\n \n /// Supports searching for characters in or not in \"!#$%&'*+-/0123456789=?ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz{|}~\".\n internal static readonly SearchValues s_ascii_FAACFFA3FEFFFFC7FFFFFF7F = SearchValues.Create(\"!#$%&'*+-/0123456789=?ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz{|}~\");\n }\n}", + "snippet": "}\n \n // Otherwise, resize the stack to make room and try again.\n WithResize(ref stack, ref pos, arg0, arg1);\n \n // Resize the backtracking stack array and push 2 va" + }, + { + "title": "src/JsonSchema/obj/Localization/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Localization/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Localization/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema/obj/Localization/net10.0/JsonSchema.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Localization/net10.0/JsonSchema.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Localization/net10.0/JsonSchema.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Localization\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"8.0.3\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"8.0.3\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"8.0.3.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema/obj/Localization/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Localization/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Localization/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema/obj/Localization/net8.0/JsonSchema.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Localization/net8.0/JsonSchema.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Localization/net8.0/JsonSchema.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Localization\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"8.0.3\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"8.0.3\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"8.0.3.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema/obj/Localization/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Localization/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Localization/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema/obj/Localization/net9.0/JsonSchema.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Localization/net9.0/JsonSchema.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Localization/net9.0/JsonSchema.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Localization\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"8.0.3\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"8.0.3\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"8.0.3.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema/obj/Localization/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Localization/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Localization/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema/obj/Localization/netstandard2.0/JsonSchema.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Localization/netstandard2.0/JsonSchema.AssemblyInfo.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Localization/netstandard2.0/JsonSchema.AssemblyInfo.cs", + "startLine": 1, + "endLine": 25, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Localization\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"8.0.3\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"8.0.3\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"8.0.3.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName = \".NET 10.0\")]" + }, + { + "title": "src/JsonSchema/obj/Release/net10.0/JsonSchema.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Release/net10.0/JsonSchema.AssemblyInfo.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Release/net10.0/JsonSchema.AssemblyInfo.cs", + "startLine": 1, + "endLine": 27, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyMetadata(\"IsAotCompatible\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.2.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.2.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName = \".NET 8.0\")]" + }, + { + "title": "src/JsonSchema/obj/Release/net8.0/JsonSchema.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Release/net8.0/JsonSchema.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Release/net8.0/JsonSchema.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.2.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.2.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName = \".NET 9.0\")]" + }, + { + "title": "src/JsonSchema/obj/Release/net9.0/JsonSchema.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Release/net9.0/JsonSchema.AssemblyInfo.cs#L1-L26", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Release/net9.0/JsonSchema.AssemblyInfo.cs", + "startLine": 1, + "endLine": 26, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyMetadata(\"IsTrimmable\", \"True\")]\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.2.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.2.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs#L1-L5", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs", + "startLine": 1, + "endLine": 5, + "content": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]", + "snippet": "// \nusing System;\nusing System.Reflection;\n[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(\".NETStandard,Version=v2.0\", FrameworkDisplayName = \".NET Standard 2.0\")]" + }, + { + "title": "src/JsonSchema/obj/Release/netstandard2.0/JsonSchema.AssemblyInfo.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/obj/Release/netstandard2.0/JsonSchema.AssemblyInfo.cs#L1-L25", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/obj/Release/netstandard2.0/JsonSchema.AssemblyInfo.cs", + "startLine": 1, + "endLine": 25, + "content": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n// \n//------------------------------------------------------------------------------\n\nusing System;\nusing System.Reflection;\n\n[assembly: System.Reflection.AssemblyCompanyAttribute(\"Greg Dennis\")]\n[assembly: System.Reflection.AssemblyConfigurationAttribute(\"Release\")]\n[assembly: System.Reflection.AssemblyFileVersionAttribute(\"9.2.0\")]\n[assembly: System.Reflection.AssemblyInformationalVersionAttribute(\"9.2.0+112013e3ea98e10d791fa6db51ab9a18846665f6\")]\n[assembly: System.Reflection.AssemblyProductAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyTitleAttribute(\"JsonSchema.Net\")]\n[assembly: System.Reflection.AssemblyVersionAttribute(\"9.0.0.0\")]\n[assembly: System.Reflection.AssemblyMetadataAttribute(\"RepositoryUrl\", \"https://github.com/json-everything/json-everything\")]\n\n// Generated by the MSBuild WriteCodeFragment class.", + "snippet": "//------------------------------------------------------------------------------\n// \n// This code was generated by a tool.\n// Runtime Version:4.0.30319.42000\n//\n// Changes to this file may cau" + }, + { + "title": "src/JsonSchema/OutputFormat.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/OutputFormat.cs#L1-L20", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/OutputFormat.cs", + "startLine": 1, + "endLine": 20, + "content": "namespace Json.Schema;\n\n/// \n/// Enumerates the available output formats.\n/// \npublic enum OutputFormat\n{\n\t/// \n\t/// Indicates that only a single pass/fail node will be returned.\n\t/// \n\tFlag,\n\t/// \n\t/// Indicates that all nodes will be listed as children of the top node.\n\t/// \n\tList,\n\t/// \n\t/// Indicates that nodes will match the structure of the schema.\n\t/// \n\tHierarchical\n}", + "snippet": "namespace Json.Schema;\n\n/// \n/// Enumerates the available output formats.\n/// \npublic enum OutputFormat\n{\n\t/// \n\t/// Indicates that only a single pass/fail node will be returned.\n\t/// \n/// A that uses a predicate for evaluation.\n/// \npublic class PredicateFormat : Format\n{\n\t/// \n\t/// A predicate that also supplies an `out` error message parameter.\n\t/// \n\t/// The element to validate.\n\t/// An error message.\n\t/// `true`. Override to return another value.\n\tpublic delegate bool PredicateWithErrorMessage(JsonElement element, out string? errorMessage);\n\n\tprivate readonly Func? _predicate;\n\tprivate readonly PredicateWithErrorMessage? _predicateWithErrorMessage;\n\n\t/// \n\t/// Creates a new .\n\t/// \n\t/// The format key.\n\t/// The predicate.\n\tpublic PredicateFormat(string key, Func predicate)\n\t\t: base(key)\n\t{\n\t\t_predicate = predicate;\n\t}\n\n\t/// \n\t/// Creates a new .\n\t/// \n\t/// The format key.\n\t/// The predicate.\n\tpublic PredicateFormat(string key, PredicateWithErrorMessage predicate)\n\t\t: base(key)\n\t{\n\t\t_predicateWithErrorMessage = predicate;\n\t}\n\n\t/// \n\t/// Validates an instance against a format and provides an error message.\n\t/// \n\t/// The element to validate.\n\t/// \n\t/// `true`. Override to return another value.\n\tpublic override bool Validate(JsonElement element, out string? errorMessage)\n\t{\n\t\tif (_predicateWithErrorMessage != null)\n\t\t\treturn _predicateWithErrorMessage(element, out errorMessage);\n\n\t\terrorMessage = null;\n\t\treturn _predicate!(element);\n\t}\n}", + "snippet": "using System;\nusing System.Text.Json;\n\nnamespace Json.Schema;\n\n/// \n/// A that uses a predicate for evaluation.\n/// \npublic class PredicateFormat : Format\n{\n\t/// \n\t/// A p" + }, + { + "title": "src/JsonSchema/PropertyDependenciesKeyword.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/PropertyDependenciesKeyword.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/PropertyDependenciesKeyword.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n/// \n/// Handles the `propertyDependencies` keyword.\n/// \n[SchemaKeyword(Name)]\n[SchemaSpecVersion(SpecVersion.DraftNext)]\n[Vocabulary(Vocabularies.ApplicatorNextId)]\n[JsonConverter(typeof(PropertyDependenciesKeywordJsonConverter))]\npublic class PropertyDependenciesKeyword : IJsonSchemaKeyword, ICustomSchemaCollector\n{\n\tprivate readonly JsonSchema[] _schemas;\n\n\t/// \n\t/// The JSON name of the keyword.\n\t/// \n\tpublic const string Name = \"propertyDependencies\";\n\n\t/// \n\t/// Gets the collection of dependencies.\n\t/// \n\tpublic IReadOnlyDictionary Dependencies { get; }\n\n\tIEnumerable ICustomSchemaCollector.Schemas => _schemas;\n\t/// \n\t/// Creates a new instance of the .\n\t/// \n\t/// The collection of dependencies.\n\tpublic PropertyDependenciesKeyword(IReadOnlyDictionary dependencies)\n\t{\n\t\tDependencies = dependencies;\n\t\t_schemas = Dependencies.SelectMany(x => x.Value.Schemas.Select(y => y.Value)).ToArray();\n\t}\n\n\t/// \n\t/// Builds a constraint object for a keyword.\n\t/// \n\t/// The for the schema object that houses this keyword.\n\t/// \n\t/// The set of other s that have been processed prior to this one.\n\t/// Will contain the constraints for keyword dependencies.\n\t/// \n\t/// The .\n\t/// A constraint object.\n\tpublic KeywordConstraint GetConstraint(SchemaConstraint schemaConstraint,\n\t\tReadOnlySpan localConstraints,\n\t\tEvaluationContext context)\n\t{\n\t\tvar subschemaConstraints = Dependencies.SelectMany(property =>\n\t\t{\n\t\t\tcontext.PushEvaluationPath(property.Key);\n\t\t\tvar propertyConstraint = property.Value.Schemas.Select(requirement =>\n\t\t\t{\n\t\t\t\tcontext.PushEvaluationPath(requirement.Key);\n\t\t\t\tvar requirementConstraint = requirement.Value.GetConstraint(JsonPointer.Create(Name, property.Key), schemaConstraint.BaseInstanceLocation, JsonPointer.Empty, context);\n\t\t\t\tcontext.PopEvaluationPath();\n\t\t\t\trequirementConstraint.InstanceLocator = evaluation =>\n\t\t\t\t{\n\t\t\t\t\tif (evaluation.LocalInstance is not JsonObject obj ||\n\t\t\t\t\t !obj.TryGetValue(property.Key, out var value, out _) ||\n\t\t\t\t\t !value.IsEquivalentTo(requirement.Key))\n\t\t\t\t\t\treturn [];\n\n\t\t\t\t\treturn CommonJsonPointers.SingleEmptyPointerArray;\n\t\t\t\t};\n\n\t\t\t\treturn requirementConstraint;\n\t\t\t});\n\t\t\tcontext.PopEvaluationPath();\n\n\t\t\treturn propertyConstraint;\n\t\t}).ToArray();\n\n\t\treturn new KeywordConstraint(Name, Evaluator)\n\t\t{\n\t\t\tChildDependencies = subschemaConstraints\n\t\t};\n\t}\n\n\tprivate static void Evaluator(KeywordEvaluation evaluation, EvaluationContext context)\n\t{\n\t\tvar failedProperties = evaluation.ChildEvaluations\n\t\t\t.Where(x => !x.Results.IsValid)\n\t\t\t.Select(x => x.Results.EvaluationPath[^1])\n\t\t\t.ToArray();\n\t\tevaluation.Results.SetAnnotation(Name, evaluation.ChildEvaluations.Select(x => (JsonNode)x.Results.EvaluationPath[^1].ToString()!).ToJsonArray());\n\t\t\n\t\tif (failedProperties.Length != 0)\n\t\t\tevaluation.Results.Fail(Name, ErrorMessages.GetDependentSchemas(context.Options.Culture)\n\t\t\t\t.ReplaceToken(\"failed\", failedProperties));\n\t}\n\n\t(JsonSchema? Schema, int SegmentsConsumed) ICustomSchemaCollector.FindSubschema(JsonPointer pointer)\n\t{\n\t\tif (pointer.Count < 2) return (null, 0);\n\t\tif (!Dependencies.TryGetValue(pointer[0], out var property)) return (null, 0);\n\t\tif (!property.Schemas.TryGetValue(pointer[1], out var schema)) return (null, 0);\n\n\t\treturn (schema, 2);\n\t}\n}\n\n/// \n/// JSON converter for .\n/// \npublic sealed class PropertyDependenciesKeywordJsonConverter : WeaklyTypedJsonConverter\n{\n\t/// Reads and converts the JSON to type .\n\t/// The reader.\n\t/// The type to convert.\n\t/// An object that specifies serialization options to use.", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serialization;\nusing Json.More;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n" + }, + { + "title": "src/JsonSchema/PropertyDependenciesKeyword.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/PropertyDependenciesKeyword.cs#L121-L137", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/PropertyDependenciesKeyword.cs", + "startLine": 121, + "endLine": 137, + "content": "/// The converted value.\n\tpublic override PropertyDependenciesKeyword Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar dependencies = options.ReadDictionary(ref reader, JsonSchemaSerializerContext.Default.PropertyDependency);\n\n\t\treturn new PropertyDependenciesKeyword(dependencies!);\n\t}\n\n\t/// Writes a specified value as JSON.\n\t/// The writer to write to.\n\t/// The value to convert to JSON.\n\t/// An object that specifies serialization options to use.\n\tpublic override void Write(Utf8JsonWriter writer, PropertyDependenciesKeyword value, JsonSerializerOptions options)\n\t{\n\t\toptions.WriteDictionary(writer, value.Dependencies, JsonSchemaSerializerContext.Default.PropertyDependency);\n\t}\n}", + "snippet": "/// The converted value.\n\tpublic override PropertyDependenciesKeyword Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar dependencies = options.ReadDictionary(r" + }, + { + "title": "src/JsonSchema/PropertyDependency.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/PropertyDependency.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/PropertyDependency.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Schema;\n\n/// \n/// Represents a single entry in the `propertyDependencies` keyword.\n/// \n[JsonConverter(typeof(PropertyDependencyJsonConverter))]\npublic class PropertyDependency : IEquatable\n{\n\t/// \n\t/// Gets the collection of value-dependent schemas for this property.\n\t/// \n\tpublic IReadOnlyDictionary Schemas { get; }\n\n\t/// \n\t/// Creates a new instance of .\n\t/// \n\t/// The collection of value-dependent schemas for this property\n\tpublic PropertyDependency(IReadOnlyDictionary schemas)\n\t{\n\t\tSchemas = schemas;\n\t}\n\n\t/// \n\t/// Creates a new instance of .\n\t/// \n\t/// The collection of value-dependent schemas for this property\n\tpublic PropertyDependency(params (string property, JsonSchema schema)[] schemas)\n\t{\n\t\tSchemas = schemas.ToDictionary(x => x.property, x => x.schema);\n\t}\n\n\t/// Indicates whether the current object is equal to another object of the same type.\n\t/// An object to compare with this object.\n\t/// true if the current object is equal to the other parameter; otherwise, false.\n\tpublic bool Equals(PropertyDependency? other)\n\t{\n\t\tif (ReferenceEquals(null, other)) return false;\n\t\tif (ReferenceEquals(this, other)) return true;\n\t\tif (Schemas.Count != other.Schemas.Count) return false;\n\t\tvar byKey = Schemas.Join(other.Schemas,\n\t\t\t\ttd => td.Key,\n\t\t\t\tod => od.Key,\n\t\t\t\t(td, od) => new { ThisDef = td.Value, OtherDef = od.Value })\n\t\t\t.ToArray();\n\t\tif (byKey.Length != Schemas.Count) return false;\n\n\t\treturn byKey.All(g => Equals(g.ThisDef, g.OtherDef));\n\t}\n\n\t/// Determines whether the specified object is equal to the current object.\n\t/// The object to compare with the current object.\n\t/// true if the specified object is equal to the current object; otherwise, false.\n\tpublic override bool Equals(object? obj)\n\t{\n\t\treturn Equals(obj as PropertyDependency);\n\t}\n\n\t/// Serves as the default hash function.\n\t/// A hash code for the current object.\n\tpublic override int GetHashCode()\n\t{\n\t\treturn Schemas.GetStringDictionaryHashCode();\n\t}\n\n\t/// \n\t/// Implicitly converts a keyed collection of to a property dependency.\n\t/// \n\t/// \n\tpublic static implicit operator PropertyDependency(Dictionary dependency)\n\t{\n\t\treturn new PropertyDependency(dependency);\n\t}\n\n\t/// \n\t/// Implicitly converts a keyed collection of to a property dependency.\n\t/// \n\t/// \n\tpublic static implicit operator PropertyDependency((string property, JsonSchema schema)[] dependency)\n\t{\n\t\treturn new PropertyDependency(dependency);\n\t}\n\n\t/// \n\t/// Implicitly converts a keyed collection of to a property dependency.\n\t/// \n\t/// \n\tpublic static implicit operator PropertyDependency((string property, JsonSchemaBuilder schema)[] dependency)\n\t{\n\t\treturn new PropertyDependency(dependency.ToDictionary(x => x.property, x => x.schema.Build()));\n\t}\n}\n\n/// \n/// JSON converter for .\n/// \npublic sealed class PropertyDependencyJsonConverter : WeaklyTypedJsonConverter\n{\n\t/// Reads and converts the JSON to type .\n\t/// The reader.\n\t/// The type to convert.\n\t/// An object that specifies serialization options to use.\n\t/// The converted value.\n\tpublic override PropertyDependency Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar schemas = options.ReadDictionary(ref reader, JsonSchemaSerializerContext.Default.JsonSchema);\n\n\t\treturn new PropertyDependency(schemas!);\n\t}\n\n\t/// Writes a specified value as JSON.\n\t/// The writer to write to.\n\t/// The value to convert to JSON.\n\t/// An object that specifies serialization options to use.", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Schema;\n\n/// \n/// Represents a single entry in th" + }, + { + "title": "src/JsonSchema/PropertyDependency.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/PropertyDependency.cs#L121-L125", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/PropertyDependency.cs", + "startLine": 121, + "endLine": 125, + "content": "public override void Write(Utf8JsonWriter writer, PropertyDependency value, JsonSerializerOptions options)\n\t{\n\t\toptions.WriteDictionary(writer, value.Schemas, JsonSchemaSerializerContext.Default.JsonSchema);\n\t}\n}", + "snippet": "public override void Write(Utf8JsonWriter writer, PropertyDependency value, JsonSerializerOptions options)\n\t{\n\t\toptions.WriteDictionary(writer, value.Schemas, JsonSchemaSerializerContext.Default.JsonSchema);\n\t}\n}" + }, + { + "title": "src/JsonSchema/RefResolutionException.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/RefResolutionException.cs#L1-L75", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/RefResolutionException.cs", + "startLine": 1, + "endLine": 75, + "content": "using System;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n/// \n/// Thrown when a reference cannot be resolved.\n/// \npublic class RefResolutionException : JsonSchemaException\n{\n\t/// \n\t/// Gets the base URI of the reference.\n\t/// \n\tpublic Uri BaseUri { get; }\n\t/// \n\t/// Gets an anchor, if one exists.\n\t/// \n\tpublic string? Anchor { get; }\n\t/// \n\t/// Gets the type of anchor, if one exists.\n\t/// \n\tpublic AnchorType? AnchorType { get; }\n\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The base URI of the reference.\n\t/// (optional) - The anchor. Default is null.\n\t/// (optional) - The type of anchor, if present.\n\tpublic RefResolutionException(Uri baseUri, string? anchor = null, AnchorType? anchorType = null)\n\t\t: base($\"Could not resolve {Format(baseUri, anchor, anchorType)}\")\n\t{\n\t\tBaseUri = baseUri;\n\t\tAnchor = anchor;\n\t\tAnchorType = anchor is null\n\t\t\t? null\n\t\t\t: anchorType ?? Schema.AnchorType.Static;\n\t}\n\n\tprivate static string Format(Uri baseUri, string? anchor, AnchorType? anchorType)\n\t{\n\t\tif (anchor is null) return $\"'{baseUri}'\";\n\n\t\tswitch (anchorType)\n\t\t{\n\t\t\tcase Schema.AnchorType.Static:\n\t\t\t\treturn $\"anchor '{anchor}' in schema '{baseUri}'\";\n\t\t\tcase Schema.AnchorType.Dynamic:\n\t\t\t\treturn $\"dynamic anchor '{anchor}' in schema '{baseUri}'\";\n\t\t\tcase Schema.AnchorType.Recursive:\n\t\t\t\treturn $\"recursive anchor in schema '{baseUri}'\";\n\t\t\tdefault:\n\t\t\t\tthrow new ArgumentOutOfRangeException(nameof(anchorType), \"Anchor type must be specified if anchor is present.\");\n\t\t}\n\t}\n}\n\n/// \n/// Specifies the type of anchor that was used during a reference resolution operation.\n/// \npublic enum AnchorType\n{\n\t/// \n\t/// Indicates the anchor was produced by `$anchor` (Draft 2019-09+) or by `$id` (Drafts 6 & 7).\n\t/// \n\tStatic,\n\t/// \n\t/// Indicates the anchor was produced by `$dynamicAnchor` (Draft 2020-12+).\n\t/// \n\tDynamic,\n\t/// \n\t/// Indicates the anchor was produced by `$recursiveAnchor` (Draft 2019-09).\n\t/// \n\tRecursive\n}", + "snippet": "using System;\nusing Json.Pointer;\n\nnamespace Json.Schema;\n\n/// \n/// Thrown when a reference cannot be resolved.\n/// \npublic class RefResolutionException : JsonSchemaException\n{\n\t/// \n\t/// Gets" + }, + { + "title": "src/JsonSchema/RegexFormat.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/RegexFormat.cs#L1-L62", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/RegexFormat.cs", + "startLine": 1, + "endLine": 62, + "content": "using System.Diagnostics.CodeAnalysis;\nusing System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema;\n\n/// \n/// A regular-expression-based format.\n/// \npublic class RegexFormat : Format\n{\n\tprivate readonly RegexOrPattern _regex;\n\n\t/// \n\t/// Creates a new .\n\t/// \n\t/// The format key.\n\t/// The regular expression.\n\tpublic RegexFormat(string key, [StringSyntax(StringSyntaxAttribute.Regex)] string regex)\n\t\t: base(key)\n\t{\n\t\t_regex = regex;\n\t}\n\n\t/// \n\t/// Creates a new .\n\t/// \n\t/// The format key.\n\t/// The regular expression.\n\tpublic RegexFormat(string key, Regex regex)\n\t\t: base(key)\n\t{\n\t\t_regex = regex;\n\t}\n\n\t/// \n\t/// Validates an instance against a format and provides an error message.\n\t/// \n\t/// \n\t/// An error message.\n\t/// `true` if the value is a match for the regular expression; `false` otherwise.\n\tpublic override bool Validate(JsonElement value, out string? errorMessage)\n\t{\n\t\tif (value.GetSchemaValueType() != SchemaValueType.String)\n\t\t{\n\t\t\terrorMessage = null;\n\t\t\treturn true;\n\t\t}\n\n\t\tvar str = value.GetString();\n\t\tvar isMatch = _regex.IsMatch(str!);\n\n\t\tif (!isMatch)\n\t\t{\n\t\t\terrorMessage = $\"Value is not a match for the format '{Key}'.\";\n\t\t\treturn false;\n\t\t}\n\n\t\terrorMessage = null;\n\t\treturn isMatch;\n\t}\n}", + "snippet": "using System.Diagnostics.CodeAnalysis;\nusing System.Text.Json;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema;\n\n/// \n/// A regular-expression-based format.\n/// \npublic class RegexFormat :" + }, + { + "title": "src/JsonSchema/RegexOrPattern.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/RegexOrPattern.cs#L1-L79", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/RegexOrPattern.cs", + "startLine": 1, + "endLine": 79, + "content": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema;\n\ninternal readonly struct RegexOrPattern : IEquatable\n{\n\tprivate static readonly TimeSpan _timeout = TimeSpan.FromSeconds(5);\n\n\tprivate readonly string _pattern;\n\tprivate readonly Regex? _regex;\n\n\tprivate static string NormalizePattern(string pattern)\n\t{\n\t\treturn pattern.Replace(\"{Letter}\", \"{L}\").Replace(\"{digit}\", \"{Nd}\");\n\t}\n\n\tprivate RegexOrPattern(string pattern)\n\t{\n\t\t_pattern = NormalizePattern(pattern ?? throw new ArgumentNullException(nameof(pattern)));\n\t\t_ = CreateRegex(_pattern, false);\n\t}\n\n\tprivate RegexOrPattern(Regex regex)\n\t{\n\t\t_pattern = regex?.ToString() ?? throw new ArgumentNullException(nameof(regex));\n\t\t_regex = regex;\n\t}\n\n\tprivate static bool RequiresUnicodeMode(string pattern)\n\t{\n\t\tfor (int i = 0; i < pattern.Length - 1; i++)\n\t\t{\n\t\t\tif (pattern[i] != '\\\\') continue;\n\n\t\t\tvar next = pattern[i + 1];\n\t\t\tif ((next == 'p' || next == 'P') && i + 2 < pattern.Length && pattern[i + 2] == '{') return true;\n\t\t\tif (next == 'u' && i + 2 < pattern.Length && pattern[i + 2] == '{') return true;\n\n\t\t\ti++;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate static RegexOptions GetOptions(string pattern, bool compiled)\n\t{\n\t\tvar options = RequiresUnicodeMode(pattern) ? RegexOptions.None : RegexOptions.ECMAScript;\n\t\tif (compiled) options |= RegexOptions.Compiled;\n\t\treturn options;\n\t}\n\n\tinternal static Regex CreateRegex(string pattern, bool compiled)\n\t{\n\t\tvar normalizedPattern = NormalizePattern(pattern);\n\t\tvar options = GetOptions(normalizedPattern, compiled);\n\t\treturn new Regex(normalizedPattern, options, _timeout);\n\t}\n\n\tpublic bool IsMatch(string str) => _regex?.IsMatch(str) ??\n\t Regex.IsMatch(str, _pattern, GetOptions(_pattern, true), _timeout);\n\n\tpublic static implicit operator string(RegexOrPattern regexOrPattern)\n\t{\n\t\treturn regexOrPattern.ToString();\n\t}\n\n\tpublic static implicit operator RegexOrPattern(string pattern) => new(pattern);\n\n\tpublic static implicit operator RegexOrPattern(Regex regex) => new(regex);\n\n\tpublic override bool Equals(object? obj) => obj is RegexOrPattern other && Equals(other);\n\n\tpublic bool Equals(RegexOrPattern other) => string.Equals(_pattern, other._pattern, StringComparison.Ordinal);\n\n\tpublic override int GetHashCode() => _pattern.GetHashCode();\n\n\tpublic override string ToString() => _pattern;\n}", + "snippet": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace Json.Schema;\n\ninternal readonly struct RegexOrPattern : IEquatable\n{\n\tprivate static readonly TimeSpan _timeout = TimeSpan.FromSeconds(5);\n\n\t" + }, + { + "title": "src/JsonSchema/SchemaOrPropertyList.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/SchemaOrPropertyList.cs#L1-L50", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/SchemaOrPropertyList.cs", + "startLine": 1, + "endLine": 50, + "content": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema;\n\n/// \n/// Represents either a JSON schema definition or a list of required property names for use in schema composition and\n/// validation scenarios.\n/// \n/// This type will not need to be interacted with directly. Use implicit conversion from a \n/// to represent a schema, or from a list or array of strings to represent required properties.\npublic class SchemaOrPropertyList\n{\n\tinternal JsonSchemaBuilder? Schema { get; }\n\tinternal string[]? Requirements { get; }\n\n\tprivate SchemaOrPropertyList(JsonSchemaBuilder schema)\n\t{\n\t\tSchema = schema;\n\t}\n\n\tprivate SchemaOrPropertyList(IEnumerable requirements)\n\t{\n\t\tRequirements = requirements.ToArray();\n\t}\n\n\t/// \n\t/// Implicitly creates a from a .\n\t/// \n\tpublic static implicit operator SchemaOrPropertyList(JsonSchemaBuilder schema)\n\t{\n\t\treturn new SchemaOrPropertyList(schema);\n\t}\n\n\t/// \n\t/// Implicitly creates a from a list of strings.\n\t/// \n\tpublic static implicit operator SchemaOrPropertyList(List requirements)\n\t{\n\t\treturn new SchemaOrPropertyList(requirements);\n\t}\n\n\t/// \n\t/// Implicitly creates a from an array of strings.\n\t/// \n\tpublic static implicit operator SchemaOrPropertyList(string[] requirements)\n\t{\n\t\treturn new SchemaOrPropertyList(requirements);\n\t}\n}", + "snippet": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema;\n\n/// \n/// Represents either a JSON schema definition or a list of required property names for use in schema composition and\n/// valida" + }, + { + "title": "src/JsonSchema/SchemaRegistry.cs (1/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/SchemaRegistry.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/SchemaRegistry.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing System.Collections;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing Json.Schema.Keywords;\nusing Json.Schema.Keywords.Draft201909;\n\nnamespace Json.Schema;\n\n/// \n/// Provides a registry for storing and retrieving JSON schemas and other base documents by URI and anchor.\n/// \n/// The registry supports registering schemas with unique URIs and enables lookup by URI or anchor.\n/// Schemas can be fetched automatically using the delegate if not already registered. The property provides a shared, application-wide registry instance. Getting schemas via\n/// local instances fall back to the global registry.\npublic class SchemaRegistry\n{\n\tprivate class Registration\n\t{\n\t\tpublic IBaseDocument? Root { get; set; }\n\t\tpublic Dictionary? Anchors { get; set; }\n\t\tpublic Dictionary? DynamicAnchors { get; set; }\n\t\tpublic JsonSchemaNode? RecursiveAnchor { get; set; }\n\t}\n\n\tprivate static readonly Uri _empty = new(\"https://json-everything.lib/\");\n\n\tprivate readonly ConcurrentDictionary _registered = [];\n\tprivate Func? _fetch;\n\n\t/// \n\t/// The global registry.\n\t/// \n\tpublic static SchemaRegistry Global { get; } = new();\n\n\t/// \n\t/// Gets or sets a method to enable automatic download of schemas by `$id` URI.\n\t/// \n\tpublic Func Fetch\n\t{\n\t\tget => _fetch ??= (_,_) => null;\n\t\tset => _fetch = value;\n\t}\n\n\t/// \n\t/// Registers a schema by URI.\n\t/// \n\t/// The schema.\n\tpublic void Register(IBaseDocument document) => Register(document.BaseUri, document);\n\n\t/// \n\t/// Registers a schema by URI.\n\t/// \n\t/// The URI ID of the schema..\n\t/// The schema.\n\tpublic void Register(Uri? uri, IBaseDocument document) => RegisterSchema(uri, document);\n\n\t///// \n\t///// Registers a new meta-schema URI.\n\t///// \n\t///// The meta-schema URI.\n\t///// \n\t///// \n\t///// **WARNING** There be dragons here. Use only if you know what you're doing.\n\t///// \n\t//public static void RegisterNewSpecVersion(Uri metaSchemaUri, JsonSchema metaSchema)\n\t//{\n\t//\t// TODO\n\t//}\n\n\tinternal void RegisterAnchor(Uri uri, string anchor, JsonSchemaNode node)\n\t{\n\t\turi = MakeAbsolute(uri);\n\t\tvar registration = _registered.GetValueOrDefault(uri);\n\t\tif (registration != null)\n\t\t{\n\t\t\tregistration.Anchors ??= [];\n\t\t\tregistration.Anchors.Add(anchor, node);\n\t\t\treturn;\n\t\t}\n\n\t\t_registered[uri] = new Registration\n\t\t{\n\t\t\tAnchors = new() { [anchor] = node }\n\t\t};\n\t}\n\n\tinternal void RegisterDynamicAnchor(Uri uri, string anchor, JsonSchemaNode node)\n\t{\n\t\turi = MakeAbsolute(uri);\n\t\tvar registration = _registered.GetValueOrDefault(uri);\n\t\tif (registration != null)\n\t\t{\n\t\t\tregistration.Anchors ??= [];\n\t\t\tregistration.Anchors.Add(anchor, node);\n\t\t\tregistration.DynamicAnchors ??= [];\n\t\t\tregistration.DynamicAnchors.Add(anchor, node);\n\t\t\treturn;\n\t\t}\n\n\t\t_registered[uri] = new Registration\n\t\t{\n\t\t\tAnchors = new() { [anchor] = node },\n\t\t\tDynamicAnchors = new() { [anchor] = node }\n\t\t};\n\t}\n\n\tinternal void RegisterRecursiveAnchor(Uri uri, JsonSchemaNode node)\n\t{\n\t\turi = MakeAbsolute(uri);\n\t\tvar registration = _registered.GetValueOrDefault(uri);\n\t\tif (registration != null)\n\t\t{\n\t\t\tregistration.RecursiveAnchor = node;\n\t\t\treturn;", + "snippet": "using System;\nusing System.Collections;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing Json.More;\nusing Json.Schema.K" + }, + { + "title": "src/JsonSchema/SchemaRegistry.cs (2/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/SchemaRegistry.cs#L121-L240", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/SchemaRegistry.cs", + "startLine": 121, + "endLine": 240, + "content": "}\n\n\t\t_registered[uri] = new Registration\n\t\t{\n\t\t\tRecursiveAnchor = node\n\t\t};\n\t}\n\n\tprivate Registration RegisterSchema(Uri? uri, IBaseDocument schema)\n\t{\n\t\tvar schemaUri = MakeAbsolute(schema.BaseUri);\n\t\tvar registration = _registered.GetValueOrDefault(schemaUri);\n\t\tif (registration == null)\n\t\t{\n\t\t\t_registered[schemaUri] = registration = new Registration { Root = schema };\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (registration.Root is not null && schema != registration.Root)\n\t\t\t\tthrow new JsonSchemaException(\"Overwriting registered schemas is not permitted.\");\n\t\t\tregistration.Root = schema;\n\t\t}\n\n\t\tif (uri is not null && uri != schemaUri)\n\t\t{\n\t\t\t// also register with custom URI\n\t\t\tregistration = _registered.First(x => ReferenceEquals(x.Value.Root, schema)).Value;\n\t\t\t_registered[uri] = registration;\n\t\t}\n\n\t\treturn registration;\n\t}\n\n\t/// \n\t/// Gets a schema by URI ID and/or anchor.\n\t/// \n\t/// The URI ID.\n\t/// \n\t/// The schema, if registered in either this or the global registry;\n\t/// otherwise null.\n\t/// \n\t// For URI equality see https://docs.microsoft.com/en-us/dotnet/api/system.uri.op_equality?view=netcore-3.1\n\t// tl;dr - URI equality doesn't consider fragments\n\tpublic IBaseDocument? Get(Uri uri)\n\t{\n\t\tif (uri is { IsAbsoluteUri: true, IsFile: true })\n\t\t\turi = new Uri(uri.OriginalString.Split('#')[0]);\n\n\t\treturn GetRegistration(uri)?.Root;\n\t}\n\n\tinternal JsonSchemaNode? Get(Uri baseUri, string? anchor)\n\t{\n\t\tif (baseUri is { IsAbsoluteUri: true, IsFile: true })\n\t\t\tbaseUri = new Uri(baseUri.OriginalString.Split('#')[0]);\n\n\t\tvar registration = GetRegistration(baseUri);\n\n\t\tif (registration?.Anchors is null) return null;\n\n\t\treturn registration.Anchors!.GetValueOrDefault(anchor);\n\t}\n\n\t// need this to check for local dynamic anchor for 2020-12 (bookend)\n\tinternal JsonSchemaNode? GetDynamic(Uri baseUri, string? anchor)\n\t{\n\t\tvar registration = GetRegistration(baseUri);\n\n\t\tif (registration?.DynamicAnchors is null) return null;\n\n\t\treturn registration.DynamicAnchors!.GetValueOrDefault(anchor);\n\t}\n\n\tinternal JsonSchemaNode? GetDynamic(DynamicScope scope, string anchor)\n\t{\n\t\tvar uris = scope\n\t\t\t.Reverse();\n\t\tvar registrations = uris\n\t\t\t.Select(GetRegistration);\n\t\tvar anchors = registrations\n\t\t\t.Select(x => x?.DynamicAnchors?.GetValueOrDefault(anchor));\n\t\tvar selected = anchors\n\t\t\t.FirstOrDefault(x => x is not null);\n\t\treturn selected;\n\t}\n\n\tinternal JsonSchemaNode? GetRecursive(DynamicScope scope)\n\t{\n\t\tRegistration? target = null;\n\t\tforeach (var uri in scope)\n\t\t{\n\t\t\tvar registration = GetRegistration(uri);\n\t\t\tif (registration?.RecursiveAnchor is null) break;\n\n\t\t\ttarget = registration;\n\t\t}\n\n\t\treturn target?.RecursiveAnchor;\n\t}\n\n\tinternal JsonSchemaNode? GetRecursive(Uri uri)\n\t{\n\t\tvar registration = GetRegistration(uri);\n\t\treturn registration?.RecursiveAnchor;\n\t}\n\n\tprivate Registration? GetRegistration(Uri baseUri)\n\t{\n\t\tvar registration = _registered.GetValueOrDefault(baseUri);\n\t\tif (registration == null && !ReferenceEquals(this, Global))\n\t\t\tregistration = Global._registered.GetValueOrDefault(baseUri);\n\n\t\tif (registration is null)\n\t\t{\n\t\t\tvar remote = Fetch(baseUri, this);\n\t\t\tif (remote == null && !ReferenceEquals(this, Global))\n\t\t\t\tremote = Global.Fetch(baseUri, this);\n\n\t\t\tif (remote is not null) \n\t\t\t\tregistration = RegisterSchema(baseUri, remote);", + "snippet": "}\n\n\t\t_registered[uri] = new Registration\n\t\t{\n\t\t\tRecursiveAnchor = node\n\t\t};\n\t}\n\n\tprivate Registration RegisterSchema(Uri? uri, IBaseDocument schema)\n\t{\n\t\tvar schemaUri = MakeAbsolute(schema.BaseUri);\n\t\tvar registration =" + }, + { + "title": "src/JsonSchema/SchemaRegistry.cs (3/3)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/SchemaRegistry.cs#L241-L342", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/SchemaRegistry.cs", + "startLine": 241, + "endLine": 342, + "content": "}\n\n\t\treturn registration;\n\t}\n\n\tprivate static Uri MakeAbsolute(Uri? uri)\n\t{\n\t\tif (uri == null) return _empty;\n\n\t\tif (uri.IsAbsoluteUri) return uri;\n\n\t\treturn _empty.Resolve(uri);\n\t}\n\n\tinternal void CopyFrom(SchemaRegistry other)\n\t{\n\t\t_fetch = other._fetch;\n\n\t\tforeach (var registration in other._registered)\n\t\t{\n\t\t\t_registered[registration.Key] = registration.Value;\n\t\t}\n\t}\n\n\t/// \n\t/// Creates a bundled JSON Schema document that includes the root schema and all referenced schemas as definitions.\n\t/// \n\t/// \n\t/// The bundled schema will contain all referenced schemas under the `$defs` property, allowing for\n\t/// self-contained schema validation. If any referenced schema cannot be resolved, a \n\t/// will be thrown.\n\t/// \n\t/// The URI of the root JSON Schema to bundle. This schema and all schemas it references will be included in the\n\t/// bundle.\n\t/// The URI to assign as the $id of the resulting bundled schema document.\n\t/// The options to use when building the bundled schema, such as validation or parsing settings.\n\t/// A new JsonSchema instance representing the bundled schema document, or null if the root schema cannot be found.\n\t/// Thrown for unsupported reference types. Only `$ref` is supported.\n\t/// Thrown if a reference cannot be resolved.\n\tpublic JsonSchema? CreateBundle(Uri rootUri, Uri bundleUri, BuildOptions? options = null)\n\t{\n\t\toptions ??= new BuildOptions\n\t\t{\n\t\t\tSchemaRegistry = this\n\t\t};\n\n\t\tvar document = Get(rootUri);\n\t\tif (document is not JsonSchema root) return null;\n\n\t\tvar toCheck = new Queue();\n\t\ttoCheck.Enqueue(root);\n\t\tvar checkedSchemas = new HashSet();\n\t\tvar defs = new JsonObject { [rootUri.ToString()] = root.Root.Source.AsNode() };\n\t\twhile (toCheck.Count != 0)\n\t\t{\n\t\t\tvar currentSchema = toCheck.Dequeue();\n\t\t\tif (!checkedSchemas.Add(currentSchema)) continue;\n\n\t\t\tvar nodes = new Queue();\n\t\t\tnodes.Enqueue(currentSchema.Root);\n\t\t\twhile (nodes.Count != 0)\n\t\t\t{\n\t\t\t\tvar currentNode = nodes.Dequeue();\n\n\t\t\t\tforeach (var keyword in currentNode.Keywords)\n\t\t\t\t{\n\t\t\t\t\tif (keyword.Handler is RefKeyword)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar reference = (Uri)keyword.Value!;\n\t\t\t\t\t\tvar resolvedDocument = Get(reference);\n\t\t\t\t\t\tif (resolvedDocument is JsonSchema resolved)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttoCheck.Enqueue(resolved);\n\t\t\t\t\t\t\tdefs[reference.ToString()] ??= resolved.Root.Source.AsNode();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse throw new RefResolutionException(reference);\n\t\t\t\t\t}\n\t\t\t\t\telse if (keyword.Handler is DynamicRefKeyword or Keywords.Draft202012.DynamicRefKeyword or RecursiveRefKeyword)\n\t\t\t\t\t\tthrow new NotSupportedException(\"Dynamic and recursive references are unsupported for bundles.\");\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tforeach (var subschema in keyword.Subschemas)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnodes.Enqueue(subschema);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar bundleBuilder = new JsonSchemaBuilder(options)\n\t\t\t.Schema(MetaSchemas.Draft202012Id)\n\t\t\t.Id(bundleUri)\n\t\t\t.Ref(rootUri);\n\t\tbundleBuilder.Add(\"$defs\", defs);\n\n\t\treturn options.SchemaRegistry == this\n\t\t\t? bundleBuilder.BuildWithoutRegistering(options)\n\t\t\t: bundleBuilder.Build(options);\n\t}\n}", + "snippet": "}\n\n\t\treturn registration;\n\t}\n\n\tprivate static Uri MakeAbsolute(Uri? uri)\n\t{\n\t\tif (uri == null) return _empty;\n\n\t\tif (uri.IsAbsoluteUri) return uri;\n\n\t\treturn _empty.Resolve(uri);\n\t}\n\n\tinternal void CopyFrom(SchemaRegistr" + }, + { + "title": "src/JsonSchema/SchemaValueType.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/SchemaValueType.cs#L1-L54", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/SchemaValueType.cs", + "startLine": 1, + "endLine": 54, + "content": "using System;\nusing System.ComponentModel;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Schema;\n\n/// \n/// Enumerates the schema value types.\n/// \n/// \n/// This is a flags-enabled enumeration, so values that support multiple\n/// types can be bit-wise OR'd `|` together.\n/// \n[Flags]\n[JsonConverter(typeof(EnumStringConverter))]\npublic enum SchemaValueType\n{\n\t/// \n\t/// Indicates the value should be an object.\n\t/// \n\t[Description(\"object\")]\n\tObject = 1 << 0,\n\t/// \n\t/// Indicates the value should be an array.\n\t/// \n\t[Description(\"array\")]\n\tArray = 1 << 1,\n\t/// \n\t/// Indicates the value should be a boolean.\n\t/// \n\t[Description(\"boolean\")]\n\tBoolean = 1 << 2,\n\t/// \n\t/// Indicates the value should be a string.\n\t/// \n\t[Description(\"string\")]\n\tString = 1 << 3,\n\t/// \n\t/// Indicates the value should be a number.\n\t/// \n\t[Description(\"number\")]\n\tNumber = 1 << 4,\n\t/// \n\t/// Indicates the value should be an integer.\n\t/// \n\t[Description(\"integer\")]\n\tInteger = 1 << 5,\n\t/// \n\t/// Indicates the value should be null.\n\t/// \n\t[Description(\"null\")]\n\tNull = 1 << 6\n}", + "snippet": "using System;\nusing System.ComponentModel;\nusing System.Text.Json.Serialization;\nusing Json.More;\n\nnamespace Json.Schema;\n\n/// \n/// Enumerates the schema value types.\n/// \n/// \n/// This is a f" + }, + { + "title": "src/JsonSchema/Serialization/JsonSchemaAttribute.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Serialization/JsonSchemaAttribute.cs#L1-L41", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Serialization/JsonSchemaAttribute.cs", + "startLine": 1, + "endLine": 41, + "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Reflection;\n\nnamespace Json.Schema.Serialization;\n\n/// \n/// Identifies a to use when deserializing a type.\n/// \n[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)]\npublic class JsonSchemaAttribute : Attribute\n{\n\tinternal JsonSchema Schema { get; }\n\n\t/// \n\t/// Identifies a to use when deserializing a type.\n\t/// \n\t/// The type declaring the schema.\n\t/// The property or field name for the schema. This member must be public and static.\n\t/// Thrown when the member cannot be found or is not public and static.\n\t[RequiresUnreferencedCode(\"Uses reflection\")]\n\tpublic JsonSchemaAttribute(Type declaringType, string memberName)\n\t{\n\t\tMemberInfo? member = declaringType.GetProperty(memberName, BindingFlags.Static | BindingFlags.Public);\n\t\tif (member == null)\n\t\t{\n\t\t\tmember = declaringType.GetField(memberName, BindingFlags.Static | BindingFlags.Public);\n\t\t\tif (member == null)\n\t\t\t\tthrow new ArgumentException($\"Cannot find public static member named `{memberName}`\");\n\t\t}\n\n\t\tvar prop = member as PropertyInfo;\n\t\tvar field = member as FieldInfo;\n\n\t\tvar value = prop?.GetValue(null) ?? field?.GetValue(null);\n\t\tif (value is not JsonSchema schema)\n\t\t\tthrow new ArgumentException($\"Value of property must be `{typeof(JsonSchema).FullName}`\");\n\n\t\tSchema = schema;\n\t}\n}", + "snippet": "using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Reflection;\n\nnamespace Json.Schema.Serialization;\n\n/// \n/// Identifies a to use when deserializing a type.\n/// \n/// Adds schema validation for types decorated with the .\n/// \n[RequiresDynamicCode(\"JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.\")]\npublic class ValidatingJsonConverter : JsonConverterFactory\n{\n\tprivate static readonly ConcurrentDictionary _cache = new();\n\tprivate static readonly ValidatingJsonConverter _instance = new();\n\n\t/// \n\t/// Default options factory used when creating validating converters.\n\t/// Creates a new JsonSerializerOptions without ValidatingJsonConverter instances to avoid recursion.\n\t/// \n\tpublic static readonly Func DefaultOptionsFactory = o =>\n\t{\n\t\tvar newOptions = new JsonSerializerOptions(o);\n\t\tvar existingConverters = o.Converters.OfType().ToArray();\n\t\tforeach (var c in existingConverters)\n\t\t{\n\t\t\tnewOptions.Converters.Remove(c);\n\t\t}\n\t\treturn newOptions;\n\t};\n\n\t/// \n\t/// Provides evaluation options for the validator.\n\t/// \n\tpublic EvaluationOptions EvaluationOptions { get; set; } = new();\n\n\t/// \n\t/// Adds an explicit type/schema mapping for types external types which cannot be decorated with .\n\t/// \n\t/// \n\t/// \n\tpublic static void MapType(JsonSchema schema)\n\t{\n\t\t_instance.CreateConverter(typeof(T), schema);\n\t}\n\n\t/// \n\t/// Registers a pre-created converter for a specific type.\n\t/// Used primarily by source-generated code to register converters for AOT scenarios.\n\t/// \n\t/// The type to register the converter for.\n\t/// The converter instance to register.\n\tpublic static void RegisterConverter(Type type, JsonConverter converter)\n\t{\n\t\t_instance.SetOptions(converter);\n\t\t_cache[type] = converter;\n\t}\n\n\t/// When overridden in a derived class, determines whether the converter instance can convert the specified object type.\n\t/// The type of the object to check whether it can be converted by this converter instance.\n\t/// \n\t/// if the instance can convert the specified object type; otherwise, .\n\tpublic override bool CanConvert(Type typeToConvert)\n\t{\n\t\tif (_cache.TryGetValue(typeToConvert, out var converter)) return converter != null;\n\n\t\tvar canConvert = typeToConvert.GetCustomAttributes(typeof(JsonSchemaAttribute)).SingleOrDefault() != null;\n\t\tif (!canConvert)\n\t\t\t_cache[typeToConvert] = null;\n\n\t\treturn canConvert;\n\t}\n\n\t/// Creates a converter for a specified type.\n\t/// The type handled by the converter.\n\t/// The serialization options to use.\n\t/// \n\t/// An instance of a where `T` is compatible with .\n\t/// If is returned, a will be thrown.\n\t/// \n\tpublic override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\t// at this point, we know that we should have a converter, so we don't need to check for null\n\t\tif (_cache.TryGetValue(typeToConvert, out var converter))\n\t\t{\n\t\t\t// override its options using this converter's options\n\t\t\tSetOptions(converter!);\n\t\t\treturn converter;\n\t\t}\n\n\t\tvar schema = GetSchema(typeToConvert);\n\t\treturn CreateConverter(typeToConvert, schema);\n\t}\n\n\t/// \n\t/// Gets the schema for a type.\n\t/// \n\tprotected virtual JsonSchema GetSchema(Type type)\n\t{\n\t\tvar schemaAttribute = (JsonSchemaAttribute)type.GetCustomAttributes(typeof(JsonSchemaAttribute)).Single();\n\t\treturn schemaAttribute.Schema;\n\t}\n\n\tprivate JsonConverter CreateConverter(Type typeToConvert, JsonSchema schema)\n\t{\n\t\tvar converterType = typeof(ValidatingJsonConverter<>).MakeGenericType(typeToConvert);\n\n\t\tvar converter = (JsonConverter)Activator.CreateInstance(converterType, schema, DefaultOptionsFactory)!;\n\n\t\tSetOptions(converter);\n\t\t_cache[typeToConvert] = converter;\n\n\t\treturn converter;\n\t}", + "snippet": "using System;\nusing System.Collections.Concurrent;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text.Json;\nusing System.Text.Json.Nodes;\nusing System.Text.Json.Serializa" + }, + { + "title": "src/JsonSchema/Serialization/ValidatingJsonConverter.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Serialization/ValidatingJsonConverter.cs#L121-L239", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Serialization/ValidatingJsonConverter.cs", + "startLine": 121, + "endLine": 239, + "content": "private void SetOptions(JsonConverter converter)\n\t{\n\t\tvar validatingConverter = (IValidatingJsonConverter)converter;\n\t\tvalidatingConverter.Options = EvaluationOptions;\n\t}\n}\n\ninternal interface IValidatingJsonConverter\n{\n\tEvaluationOptions? Options { get; set; }\n}\n\n/// \n/// DO NOT USE THIS CLASS DIRECTLY. INSTEAD, REGISTER THE NON-GENERIC CONVERTER WITH YOUR SERIALIZER OPTIONS.\n/// Validates JSON against a schema during deserialization.\n/// \n/// The type being converted.\npublic class ValidatingJsonConverter : WeaklyTypedJsonConverter, IValidatingJsonConverter\n{\n\tprivate readonly JsonSchema _schema;\n\tprivate readonly Func _optionsFactory;\n\n\t/// \n\t/// Gets or sets the evaluation options for schema validation.\n\t/// \n\tpublic EvaluationOptions? Options { get; set; }\n\n\t/// \n\t/// Creates a new instance of .\n\t/// \n\t/// The JSON schema to validate against.\n\t/// A factory function to create serializer options without validating converters to avoid recursion.\n\tpublic ValidatingJsonConverter(JsonSchema schema, Func optionsFactory)\n\t{\n\t\t_schema = schema;\n\t\t_optionsFactory = optionsFactory;\n\t}\n\n\t/// \n\t/// Reads and validates JSON data against the schema.\n\t/// \n\t/// The reader to use for reading JSON.\n\t/// The type to convert to.\n\t/// The serializer options.\n\t/// The deserialized object.\n\t/// Thrown when the JSON does not meet schema requirements.\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"We guarantee that the SerializerOptions covers all the types we need for AOT scenarios.\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"We guarantee that the SerializerOptions covers all the types we need for AOT scenarios.\")]\n\tpublic override T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar readerCopy = reader;\n\t\tvar node = options.Read(ref readerCopy, JsonSchemaSerializerContext.Default.JsonElement);\n\n\t\tvar validation = _schema.Evaluate(node, Options);\n\n\t\tvar newOptions = _optionsFactory(options);\n\n\t\tif (validation.IsValid)\n\t\t\t// TODO: this does not use the options reader because at least one test failed with a NotSupportedException\n\t\t\t/*\n\t\t\treturn newOptions.Read(ref reader);\n\t\t\t/*/\n\t\t\treturn JsonSerializer.Deserialize(ref reader, newOptions);\n\t\t//*/\n\n\t\tthrow new JsonException(\"JSON does not meet schema requirements\")\n\t\t{\n\t\t\tData =\n\t\t\t{\n\t\t\t\t[\"validation\"] = validation\n\t\t\t}\n\t\t};\n\t}\n\n\t/// Reads a dictionary key from a JSON property name.\n\t/// The to read from.\n\t/// The type to convert.\n\t/// The options to use when reading the value.\n\t/// The value that was converted.\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"We guarantee that the SerializerOptions covers all the types we need for AOT scenarios.\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"We guarantee that the SerializerOptions covers all the types we need for AOT scenarios.\")]\n\tpublic override T ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n\t{\n\t\tvar newOptions = _optionsFactory(options);\n\t\treturn JsonSerializer.Deserialize($\"\\\"{reader.GetString()}\\\"\", newOptions)!;\n\t}\n\n\t/// \n\t/// Writes the JSON representation of the object.\n\t/// \n\t/// The writer to use for writing JSON.\n\t/// The value to serialize.\n\t/// The serializer options.\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"We guarantee that the SerializerOptions covers all the types we need for AOT scenarios.\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"We guarantee that the SerializerOptions covers all the types we need for AOT scenarios.\")]\n\tpublic override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)\n\t{\n\t\tvar newOptions = _optionsFactory(options);\n\n\t\tnewOptions.Write(writer, value, typeof(T));\n\t}\n\n\t/// Writes a dictionary key as a JSON property name.\n\t/// The to write to.\n\t/// The value to convert. The value of determines if the converter handles values.\n\t/// The options to use when writing the value.\n\t[UnconditionalSuppressMessage(\"Trimming\", \"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code\", Justification = \"We guarantee that the SerializerOptions covers all the types we need for AOT scenarios.\")]\n\t[UnconditionalSuppressMessage(\"AOT\", \"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.\", Justification = \"We guarantee that the SerializerOptions covers all the types we need for AOT scenarios.\")]\n\tpublic override void WriteAsPropertyName(Utf8JsonWriter writer, [DisallowNull] T value, JsonSerializerOptions options)\n\t{\n\t\tvar newOptions = _optionsFactory(options);\n\t\tvar serialized = JsonSerializer.SerializeToNode(value, newOptions);\n\t\tif (serialized is not JsonValue jsonValue || !jsonValue.TryGetValue(out string? key))\n\t\t\tthrow new JsonException($\"The value {value} cannot be used as a JSON key because it does not serialize to a string.\");\n\n\t\twriter.WritePropertyName(key);\n\t\t\n\t}\n}", + "snippet": "private void SetOptions(JsonConverter converter)\n\t{\n\t\tvar validatingConverter = (IValidatingJsonConverter)converter;\n\t\tvalidatingConverter.Options = EvaluationOptions;\n\t}\n}\n\ninternal interface IValidatingJsonConverter\n{\n" + }, + { + "title": "src/JsonSchema/UnknownFormat.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/UnknownFormat.cs#L1-L27", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/UnknownFormat.cs", + "startLine": 1, + "endLine": 27, + "content": "using System.Text.Json;\n\nnamespace Json.Schema;\n\n/// \n/// Represents an unknown format.\n/// \npublic sealed class UnknownFormat : Format\n{\n\t/// \n\t/// Creates a new instance.\n\t/// \n\t/// The key.\n\tpublic UnknownFormat(string key) : base(key) { }\n\n\t/// \n\t/// Validates an instance against a format and provides an error message.\n\t/// \n\t/// \n\t/// An error message.\n\t/// `true`. Override to return another value.\n\tpublic override bool Validate(JsonElement value, out string? errorMessage)\n\t{\n\t\terrorMessage = null;\n\t\treturn true;\n\t}\n}", + "snippet": "using System.Text.Json;\n\nnamespace Json.Schema;\n\n/// \n/// Represents an unknown format.\n/// \npublic sealed class UnknownFormat : Format\n{\n\t/// \n\t/// Creates a new i" + }, + { + "title": "src/JsonSchema/Vocabulary.201909.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Vocabulary.201909.cs#L1-L113", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Vocabulary.201909.cs", + "startLine": 1, + "endLine": 113, + "content": "using System;\nusing Json.Schema.Keywords;\n// ReSharper disable InconsistentNaming\n\nnamespace Json.Schema;\n\npublic partial class Vocabulary\n{\n\t/// \n\t/// Gets the Applicator vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/applicator'.\n\tpublic static Vocabulary Draft201909_Applicator { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2019-09/vocab/applicator\"),\n\t\tJson.Schema.Keywords.Draft06.AdditionalItemsKeyword.Instance,\n\t\tAdditionalPropertiesKeyword.Instance,\n\t\tAllOfKeyword.Instance,\n\t\tAnyOfKeyword.Instance,\n\t\tContainsKeyword.Instance,\n\t\tDependentSchemasKeyword.Instance,\n\t\tElseKeyword.Instance,\n\t\tIfKeyword.Instance,\n\t\tJson.Schema.Keywords.Draft06.ItemsKeyword.Instance,\n\t\tNotKeyword.Instance,\n\t\tOneOfKeyword.Instance,\n\t\tPatternPropertiesKeyword.Instance,\n\t\tPropertiesKeyword.Instance,\n\t\tPropertyNamesKeyword.Instance,\n\t\tThenKeyword.Instance,\n\t\tJson.Schema.Keywords.Draft201909.UnevaluatedItemsKeyword.Instance,\n\t\tUnevaluatedPropertiesKeyword.Instance\n\t);\n\n\t/// \n\t/// Gets the Content vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/content'.\n\tpublic static Vocabulary Draft201909_Content { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2019-09/vocab/content\"),\n\t\tContentEncodingKeyword.Instance,\n\t\tContentMediaTypeKeyword.Instance,\n\t\tContentSchemaKeyword.Instance\n\t);\n\n\t/// \n\t/// Gets the Core vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/core'.\n\tpublic static Vocabulary Draft201909_Core { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2019-09/vocab/core\"),\n\t\tJson.Schema.Keywords.Draft201909.AnchorKeyword.Instance,\n\t\tCommentKeyword.Instance,\n\t\tDefsKeyword.Instance,\n\t\tIdKeyword.Instance,\n\t\tJson.Schema.Keywords.Draft201909.RecursiveAnchorKeyword.Instance,\n\t\tJson.Schema.Keywords.Draft201909.RecursiveRefKeyword.Instance,\n\t\tRefKeyword.Instance,\n\t\tSchemaKeyword.Instance,\n\t\tJson.Schema.Keywords.Draft201909.VocabularyKeyword.Instance\n\t);\n\n\t/// \n\t/// Gets the Format vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/format'.\n\tpublic static Vocabulary Draft201909_Format { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2019-09/vocab/format\"),\n\t\tJson.Schema.Keywords.Draft06.FormatKeyword.Annotate\n\t);\n\n\t/// \n\t/// Gets the Meta-Data vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/meta-data'.\n\tpublic static Vocabulary Draft201909_MetaData { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2019-09/vocab/meta-data\"),\n\t\tDefaultKeyword.Instance,\n\t\tDeprecatedKeyword.Instance,\n\t\tDescriptionKeyword.Instance,\n\t\tExamplesKeyword.Instance,\n\t\tReadOnlyKeyword.Instance,\n\t\tTitleKeyword.Instance,\n\t\tWriteOnlyKeyword.Instance\n\t);\n\n\t/// \n\t/// Gets the Validation vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/validation'.\n\tpublic static Vocabulary Draft201909_Validation { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2019-09/vocab/validation\"),\n\t\tConstKeyword.Instance,\n\t\tDependentRequiredKeyword.Instance,\n\t\tEnumKeyword.Instance,\n\t\tExclusiveMaximumKeyword.Instance,\n\t\tExclusiveMinimumKeyword.Instance,\n\t\tMaxContainsKeyword.Instance,\n\t\tMaximumKeyword.Instance,\n\t\tMaxItemsKeyword.Instance,\n\t\tMaxLengthKeyword.Instance,\n\t\tMaxPropertiesKeyword.Instance,\n\t\tMinContainsKeyword.Instance,\n\t\tMinimumKeyword.Instance,\n\t\tMinItemsKeyword.Instance,\n\t\tMinLengthKeyword.Instance,\n\t\tMinPropertiesKeyword.Instance,\n\t\tMultipleOfKeyword.Instance,\n\t\tPatternKeyword.Instance,\n\t\tRequiredKeyword.Instance,\n\t\tTypeKeyword.Instance,\n\t\tUniqueItemsKeyword.Instance\n\t);\n}", + "snippet": "using System;\nusing Json.Schema.Keywords;\n// ReSharper disable InconsistentNaming\n\nnamespace Json.Schema;\n\npublic partial class Vocabulary\n{\n\t/// \n\t/// Gets the Applicator vocabulary definition in JSON Schema Dr" + }, + { + "title": "src/JsonSchema/Vocabulary.202012.cs (1/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Vocabulary.202012.cs#L1-L120", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Vocabulary.202012.cs", + "startLine": 1, + "endLine": 120, + "content": "using System;\nusing Json.Schema.Keywords;\n// ReSharper disable InconsistentNaming\n\nnamespace Json.Schema;\n\npublic partial class Vocabulary\n{\n\t/// \n\t/// Gets the Applicator vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/applicator'.\n\tpublic static Vocabulary Draft202012_Applicator { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2020-12/vocab/applicator\"),\n\t\tAdditionalPropertiesKeyword.Instance,\n\t\tAllOfKeyword.Instance,\n\t\tAnyOfKeyword.Instance,\n\t\tContainsKeyword.Instance,\n\t\tDependentSchemasKeyword.Instance,\n\t\tElseKeyword.Instance,\n\t\tIfKeyword.Instance,\n\t\tItemsKeyword.Instance,\n\t\tNotKeyword.Instance,\n\t\tOneOfKeyword.Instance,\n\t\tPatternPropertiesKeyword.Instance,\n\t\tPrefixItemsKeyword.Instance,\n\t\tPropertiesKeyword.Instance,\n\t\tPropertyNamesKeyword.Instance\n\t);\n\n\t/// \n\t/// Gets the Content vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/content'.\n\tpublic static Vocabulary Draft202012_Content { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2020-12/vocab/content\"),\n\t\tContentEncodingKeyword.Instance,\n\t\tContentMediaTypeKeyword.Instance,\n\t\tContentSchemaKeyword.Instance\n\t);\n\n\t/// \n\t/// Gets the Core vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/core'.\n\tpublic static Vocabulary Draft202012_Core { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2020-12/vocab/core\"),\n\t\tAnchorKeyword.Instance,\n\t\tCommentKeyword.Instance,\n\t\tDefsKeyword.Instance,\n\t\tDynamicAnchorKeyword.Instance,\n\t\tJson.Schema.Keywords.Draft202012.DynamicRefKeyword.Instance,\n\t\tIdKeyword.Instance,\n\t\tRefKeyword.Instance,\n\t\tSchemaKeyword.Instance,\n\t\tJson.Schema.Keywords.Draft201909.VocabularyKeyword.Instance\n\t);\n\n\t/// \n\t/// Gets the Format-Annotation vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/format-annotation'.\n\tpublic static Vocabulary Draft202012_FormatAnnotation { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2020-12/vocab/format-annotation\"),\n\t\tJson.Schema.Keywords.Draft06.FormatKeyword.Annotate\n\t);\n\n\t/// \n\t/// Gets the Format-Assertion vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/format-assertion'.\n\tpublic static Vocabulary Draft202012_FormatAssertion { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2020-12/vocab/format-assertion\"),\n\t\tJson.Schema.Keywords.Draft06.FormatKeyword.Validate\n\t);\n\n\t/// \n\t/// Gets the Meta-Data vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/meta-data'.\n\tpublic static Vocabulary Draft202012_MetaData { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2020-12/vocab/meta-data\"),\n\t\tDefaultKeyword.Instance,\n\t\tDeprecatedKeyword.Instance,\n\t\tDescriptionKeyword.Instance,\n\t\tExamplesKeyword.Instance,\n\t\tReadOnlyKeyword.Instance,\n\t\tTitleKeyword.Instance,\n\t\tWriteOnlyKeyword.Instance\n\t);\n\n\t/// \n\t/// Gets the Unevaluated vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/unevaluated'.\n\tpublic static Vocabulary Draft202012_Unevaluated { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2020-12/vocab/unevaluated\"),\n\t\tUnevaluatedItemsKeyword.Instance,\n\t\tUnevaluatedPropertiesKeyword.Instance\n\t);\n\n\t/// \n\t/// Gets the Validation vocabulary definition in JSON Schema Draft 2019-09.\n\t/// \n\t/// The vocabulary is identified by the URI 'https://json-schema.org/draft/2019-09/vocab/validation'.\n\tpublic static Vocabulary Draft202012_Validation { get; } = new(\n\t\tnew Uri(\"https://json-schema.org/draft/2020-12/vocab/validation\"),\n\t\tConstKeyword.Instance,\n\t\tDependentRequiredKeyword.Instance,\n\t\tEnumKeyword.Instance,\n\t\tExclusiveMaximumKeyword.Instance,\n\t\tExclusiveMinimumKeyword.Instance,\n\t\tMaxContainsKeyword.Instance,\n\t\tMaximumKeyword.Instance,\n\t\tMaxItemsKeyword.Instance,\n\t\tMaxLengthKeyword.Instance,\n\t\tMaxPropertiesKeyword.Instance,\n\t\tMinContainsKeyword.Instance,\n\t\tMinimumKeyword.Instance,\n\t\tMinItemsKeyword.Instance,", + "snippet": "using System;\nusing Json.Schema.Keywords;\n// ReSharper disable InconsistentNaming\n\nnamespace Json.Schema;\n\npublic partial class Vocabulary\n{\n\t/// \n\t/// Gets the Applicator vocabulary definition in JSON Schema Dr" + }, + { + "title": "src/JsonSchema/Vocabulary.202012.cs (2/2)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Vocabulary.202012.cs#L121-L129", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Vocabulary.202012.cs", + "startLine": 121, + "endLine": 129, + "content": "MinLengthKeyword.Instance,\n\t\tMinPropertiesKeyword.Instance,\n\t\tMultipleOfKeyword.Instance,\n\t\tPatternKeyword.Instance,\n\t\tRequiredKeyword.Instance,\n\t\tTypeKeyword.Instance,\n\t\tUniqueItemsKeyword.Instance\n\t);\n}", + "snippet": "MinLengthKeyword.Instance,\n\t\tMinPropertiesKeyword.Instance,\n\t\tMultipleOfKeyword.Instance,\n\t\tPatternKeyword.Instance,\n\t\tRequiredKeyword.Instance,\n\t\tTypeKeyword.Instance,\n\t\tUniqueItemsKeyword.Instance\n\t);\n}" + }, + { + "title": "src/JsonSchema/Vocabulary.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/Vocabulary.cs#L1-L40", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/Vocabulary.cs", + "startLine": 1, + "endLine": 40, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema;\n\n/// \n/// Represents a collection of keyword handlers associated with a specific vocabulary identifier.\n/// \n/// Only JSON Schema drafts 2019-09 and 2020-12 make use of vocabularies. A vocabulary defines a set of\n/// keywords and their corresponding handlers, typically used to interpret or validate structured data according\n/// to a particular specification. The vocabulary is identified by a unique URI, and its keywords determine the\n/// behaviors or constraints it supports.\npublic partial class Vocabulary\n{\n\t/// \n\t/// Gets the unique identifier for this resource as a URI.\n\t/// \n\tpublic Uri Id { get; }\n\t\n\t/// \n\t/// Gets the collection of keyword handlers associated with the current instance.\n\t/// \n\tpublic IKeywordHandler[] Keywords { get; }\n\n\t/// \n\t/// Initializes a new instance of the Vocabulary class with the specified identifier and keyword handlers.\n\t/// \n\t/// All provided keyword handler collections are combined into a single set for the vocabulary.\n\t/// The unique identifier for the vocabulary. Cannot be null.\n\t/// One or more collections of keyword handlers to associate with the vocabulary.\n\tpublic Vocabulary(Uri id, params IEnumerable keywords)\n\t{\n\t\tId = id;\n\t\tKeywords = keywords.ToArray();\n\n\t\tif (Keywords.Length == 0)\n\t\t\tthrow new ArgumentException(\"At least one keyword handler is required.\");\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema;\n\n/// \n/// Represents a collection of keyword handlers associated with a specific vocabulary identifier.\n/// \n/" + }, + { + "title": "src/JsonSchema/VocabularyRegistry.cs (1/1)", + "url": "https://github.com/json-everything/json-everything/blob/main/src/JsonSchema/VocabularyRegistry.cs#L1-L80", + "source": "github", + "repo": "json-everything/json-everything", + "ref": "main", + "path": "src/JsonSchema/VocabularyRegistry.cs", + "startLine": 1, + "endLine": 80, + "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema;\n\n/// \n/// Provides a registry for managing JSON Schema vocabularies, allowing registration and unregistration of custom\n/// vocabularies in addition to well-known official vocabularies.\n/// \n/// The registry maintains a set of official vocabularies that cannot be modified or removed. Use the\n/// property to access a shared, application-wide registry instance. Getting vocabularies via\n/// local instances fall back to the global registry.\npublic class VocabularyRegistry\n{\n\tprivate readonly Dictionary _vocabs = new();\n\tprivate Uri[] _wellKnownVocabs = null!;\n\n\t/// \n\t/// Gets the global registry of vocabularies available throughout the application.\n\t/// \n\t/// Use this property to access a shared, application-wide instance of the vocabulary registry. The\n\t/// global registry is intended for scenarios where a centralized vocabulary store is required. This property is\n\t/// thread-safe.\n\tpublic static VocabularyRegistry Global { get; } = new();\n\n\t/// \n\t/// Registers a custom vocabulary for use within the system.\n\t/// \n\t/// Registering a vocabulary allows it to be referenced and used in subsequent operations. Official\n\t/// vocabularies cannot be overwritten or replaced by custom registrations.\n\t/// The vocabulary to register. The vocabulary's identifier must not conflict with any official vocabularies.\n\t/// Thrown if the vocabulary's identifier matches an official vocabulary, preventing overwriting of well-known\n\t/// vocabularies.\n\tpublic void Register(Vocabulary vocabulary)\n\t{\n\t\tif (_wellKnownVocabs?.Contains(vocabulary.Id) == true)\n\t\t\tthrow new ArgumentException(\"Cannot overwrite official vocabularies\");\n\n\t\t_vocabs[vocabulary.Id] = vocabulary;\n\t}\n\n\t/// \n\t/// Removes the vocabulary identified by the specified URI from the registry.\n\t/// \n\t/// The URI that uniquely identifies the vocabulary to remove. Cannot be an official vocabulary.\n\t/// Thrown if refers to an official vocabulary, which cannot be removed.\n\tpublic void Unregister(Uri vocabularyId)\n\t{\n\t\tif (_wellKnownVocabs?.Contains(vocabularyId) == true)\n\t\t\tthrow new ArgumentException(\"Cannot remove official vocabularies\");\n\n\t\t_vocabs.Remove(vocabularyId);\n\t}\n\n\tinternal Vocabulary? GetVocab(Uri vocabUri) =>\n\t\t_vocabs.GetValueOrDefault(vocabUri) ??\n\t\tGlobal._vocabs.GetValueOrDefault(vocabUri);\n\n\tinternal void RegisterDefaultVocabs()\n\t{\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2019-09/vocab/core\")] = Vocabulary.Draft201909_Core;\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2019-09/vocab/applicator\")] = Vocabulary.Draft201909_Applicator;\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2019-09/vocab/validation\")] = Vocabulary.Draft201909_Validation;\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2019-09/vocab/meta-data\")] = Vocabulary.Draft201909_MetaData;\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2019-09/vocab/format\")] = Vocabulary.Draft201909_Format;\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2019-09/vocab/content\")] = Vocabulary.Draft201909_Content;\n\t\t\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2020-12/vocab/core\")] = Vocabulary.Draft202012_Core;\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2020-12/vocab/applicator\")] = Vocabulary.Draft202012_Applicator;\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2020-12/vocab/validation\")] = Vocabulary.Draft202012_Validation;\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2020-12/vocab/meta-data\")] = Vocabulary.Draft202012_MetaData;\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2020-12/vocab/format-annotation\")] = Vocabulary.Draft202012_FormatAnnotation;\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2020-12/vocab/format-assertion\")] = Vocabulary.Draft202012_FormatAssertion;\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2020-12/vocab/content\")] = Vocabulary.Draft202012_Content;\n\t\t_vocabs[new Uri(\"https://json-schema.org/draft/2020-12/vocab/unevaluated\")] = Vocabulary.Draft202012_Unevaluated;\n\n\t\t_wellKnownVocabs = _vocabs.Keys.ToArray();\n\t}\n}", + "snippet": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Json.Schema;\n\n/// \n/// Provides a registry for managing JSON Schema vocabularies, allowing registration and unregistration of custom\n" + } + ] +}