Skip to content

Commit

Permalink
Deploying to gh-pages from @ 64a60d6 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsdennis committed Jun 6, 2024
1 parent a7ef569 commit 925f8b9
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 7 deletions.
Binary file modified _framework/LearnJsonEverything.Template.dll
Binary file not shown.
Binary file modified _framework/LearnJsonEverything.Template.dll.br
Binary file not shown.
Binary file modified _framework/LearnJsonEverything.Template.dll.gz
Binary file not shown.
Binary file modified _framework/LearnJsonEverything.Template.pdb.gz
Binary file not shown.
Binary file modified _framework/LearnJsonEverything.dll
Binary file not shown.
Binary file modified _framework/LearnJsonEverything.dll.br
Binary file not shown.
Binary file modified _framework/LearnJsonEverything.dll.gz
Binary file not shown.
Binary file modified _framework/LearnJsonEverything.pdb.gz
Binary file not shown.
6 changes: 3 additions & 3 deletions _framework/blazor.boot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"mainAssemblyName": "LearnJsonEverything",
"resources": {
"hash": "sha256-us3BwxG+bzvqvFrHRSirwCmGvJSHxjfIFHWXPC5cCGk=",
"hash": "sha256-/mfCyRbUz0PTj+9KQsEFe06GWi15knYDk0T/2h0FB+4=",
"jsModuleNative": {
"dotnet.native.8.0.6.suuomc2hr0.js": "sha256-YU6M9+jtDVnB8/wtrgIndOstzNh778Ls8g9XnbjorSk="
},
Expand All @@ -24,8 +24,8 @@
"Json.More.dll": "sha256-xr0aE0+HsrvtjruJdaapKt2/DGB0qSUz+xD0XmvawxM=",
"JsonPointer.Net.dll": "sha256-DzV9BEIGNC1mcOpb+JYI2gGXuDG5qg157LjFTnJ6pAE=",
"JsonSchema.Net.dll": "sha256-iCLcArFhOdHD16SQ2km8JXYsJmbv4fa37t+iopIb8+w=",
"LearnJsonEverything.dll": "sha256-aLO3SE4jcnH1ujCDkHePFMe5FyUVniZNACljmYC+IGI=",
"LearnJsonEverything.Template.dll": "sha256-MXRpDNQ3fuzhzLv/IqR6Yy8UkegUH7oYvfWR+Q/Aw3I=",
"LearnJsonEverything.dll": "sha256-HMhC+Eb7AO6iyR3thMWDV60cIw9GaIXEmt5K87t1CUQ=",
"LearnJsonEverything.Template.dll": "sha256-NqX+HByG0vRSrwzta/CYol2kSbSCsGKVammRUbswD24=",
"Markdig.dll": "sha256-34Ry04hh+o21Q3VDOJoD0lmCasZYDBsC9CvOeWz3BjI=",
"Markdig.SyntaxHighlighting.dll": "sha256-YEfO9OsS0T4kDjPXOW2pJF8qg62omn4UYMy/C2tcmC4=",
"Microsoft.AspNetCore.Authorization.dll": "sha256-IsV1p8+7qyVgHgqn8Yon3RZfqKDNjdC/kTwzUwtaAlY=",
Expand Down
Binary file modified _framework/blazor.boot.json.br
Binary file not shown.
Binary file modified _framework/blazor.boot.json.gz
Binary file not shown.
17 changes: 17 additions & 0 deletions css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,23 @@ a.navbar-brand {
background-color: transparent;
}

.stamp {
border: 4px groove rgba(220, 0, 0, 0.8);
border-radius: 10px;
color: rgba(220, 0, 0, 0.8);
font-weight: 800;
padding: 0 6px 0 6px;
position: absolute;
transform: translate(40%, 50%) rotate(-10deg);
z-index: 10;
}

.disabled {
pointer-events: none;
background-color: transparent !important;
border-color: transparent !important;
}

/*--- LIBRARY ---*/

.version-callout {
Expand Down
4 changes: 4 additions & 0 deletions css/bootstrap-overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ select.form-control {
.row > * {
padding-left: 0;
padding-right: 0;
}

.text-justify p {
text-align: justify;
}
129 changes: 125 additions & 4 deletions data/lessons/schema.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
---
- id: 26b6ebca-58e6-4814-86ea-4946d844c9a6
title: Any string
instructions: |-
title: 'Schema Builder: Any string'
background: |
The `JsonSchemaBuilder` class provides a type-safe fluent interface for building schemas in code.
Adding a keyword is accomplished by calling the same-name (usually) extension method.
docs: 'schema/basics/#schema-inlining'
api: api/JsonSchema.Net/JsonSchemaBuilderExtensions
instructions: |
Configure the provided `JsonSchemaBuilder` to produce a schema that validates a string instance.
inputTemplate: ''
contextCode: |-
Expand Down Expand Up @@ -37,8 +42,13 @@
- instance: false
isValid: false
- id: 26b6ebca-58e6-4814-86ea-4946d844c9a7
title: Number with limits
instructions: |-
title: 'Schema Builder: Number with limits'
background: |
The `JsonSchemaBuilder` class provides a type-safe fluent interface for building schemas in code.
Adding a keyword is accomplished by calling the same-name (usually) extension method.
docs: 'schema/basics/#schema-inlining'
api: api/JsonSchema.Net/JsonSchemaBuilderExtensions
instructions: |
Configure the provided `JsonSchemaBuilder` to produce a schema that validates a number instance
that is less than or equal to 10 but greater than 0.
inputTemplate: ''
Expand Down Expand Up @@ -84,3 +94,114 @@
isValid: false
- instance: false
isValid: false
- id: 36b6ebca-58e6-4814-86ea-4946d844c9a7
background: |
The `JsonSchemaBuilder` class provides a type-safe fluent interface for building schemas in code.
Adding a keyword is accomplished by calling the same-name (usually) extension method.
Some keywords take schemas. To do this with _JsonSchema.Net_, you'll want to pass a nested
`JsonSchemaBuilder`.
To help make your code prettier, there is an implicit cast from `JsonSchemaBuilder` to `JsonSchema`
that automatically calls the `.Build()` method so you don't have to.
docs: 'schema/basics/#schema-inlining'
api: api/JsonSchema.Net/JsonSchemaBuilderExtensions
title: 'Schema Builder: Homogenous arrays'
instructions: |
Configure the provided `JsonSchemaBuilder` to produce a schema that validates a array instance
filled with integers. Ensure that the array has no more than 5 items.
inputTemplate: ''
contextCode: |-
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using Json.Schema;
namespace LearnJsonEverything;
public class Lesson : ILessonRunner<EvaluationResults>
{
public EvaluationResults Run(JsonObject context)
{
var instance = context["instance"];
var builder = new JsonSchemaBuilder();
/* USER CODE */
var schema = builder.Build();
return schema.Evaluate(instance);
}
}
tests:
- instance: 6.8
isValid: false
- instance: [1,2,3]
isValid: true
- instance: ["string",1,2]
isValid: false
- instance: [1,2,3,4,5,6]
isValid: false
- instance: a string value
isValid: false
- instance: []
isValid: true
- instance: {}
isValid: false
- instance: false
isValid: false
- id: 26b6ebca-58e6-4814-86ea-4946d844c9a8
background: |
The `JsonSchemaBuilder` class provides a type-safe fluent interface. Adding a keyword is
accomplished by calling the same-name (usually) extension method.
docs: 'schema/basics/#schema-deserialization'
title: Deserializing a schema
instructions: |
Deserialize the text in `schemaText` into a `JsonSchema` variable called `schema`.
inputTemplate: ''
contextCode: |-
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using Json.Schema;
namespace LearnJsonEverything;
public class Lesson : ILessonRunner<EvaluationResults>
{
public EvaluationResults Run(JsonObject context)
{
var instance = context["instance"];
var schemaText =
"""
{
"type": "object",
"properties": {
"foo": { "type": "number", "minimum": 0 },
"bar": { "type": "string" }
},
"required": ["foo", "bar"]
}
""";
/* USER CODE */
return schema.Evaluate(instance);
}
}
tests:
- instance: { "foo": 13, "bar": "a string" }
isValid: true
- instance: { "foo": false, "bar": "a string" }
isValid: false
- instance: { "foo": 13 }
isValid: false
- instance: { "bar": "a string" }
isValid: false
- instance: [1,2,3]
isValid: false
- instance: 6.8
isValid: false

0 comments on commit 925f8b9

Please sign in to comment.