Skip to content

Commit

Permalink
feat(language-server): Add yaml schema for definitions file (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissimon-au committed Jul 31, 2024
1 parent 89f94f4 commit 65ec44a
Show file tree
Hide file tree
Showing 9 changed files with 784 additions and 54 deletions.
29 changes: 15 additions & 14 deletions src/core/Contextive.Core/Contextive.Core.fsproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<DebuggerSupport>false</DebuggerSupport>
</PropertyGroup>
<ItemGroup>
<Compile Include="File.fs"/>
<Compile Include="Definitions.fs"/>
<Compile Include="CandidateTerms.fs"/>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets"/>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<DebuggerSupport>false</DebuggerSupport>
</PropertyGroup>
<ItemGroup>
<Compile Include="File.fs" />
<Compile Include="DefinitionsSchema.fs" />
<Compile Include="Definitions.fs" />
<Compile Include="CandidateTerms.fs" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>
173 changes: 173 additions & 0 deletions src/core/Contextive.Core/DefinitionsSchema.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
module Contextive.Core.DefinitionsSchema

let schema =
"""{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://contextive.tech/",
"title": "Contextive Definitions Schema",
"description": "Schema for defining an ubiquitous language.",
"type": "object",
"properties": {
"contexts": {
"description": "A list of contexts.",
"type": "array",
"items": {
"title": "Context",
"description": "A context in the ubiquitous language, consisting of a list of terms.",
"type": "object",
"properties": {
"name": {
"title": "Name",
"description": "The name of the context.",
"type": "string",
"examples": [
"Cargo"
]
},
"domainVisionStatement": {
"title": "Domain Vision Statement",
"description": "A statement that describes the purpose of the context.",
"type": "string",
"examples": [
"To manage the routing of cargo through transportation legs"
]
},
"paths": {
"title": "Paths",
"description": "A list of paths that the context is involved in.",
"type": "array",
"items": {
"title": "Path",
"description": "A path that the context is involved in.",
"type": "string",
"examples": [
"CargoDemo",
"'**' # default, all paths"
]
},
"examples": [
[
"CargoDemo"
]
],
"minItems": 1,
"uniqueItems": true
},
"terms": {
"title": "Terms",
"description": "A list of terms in the context.",
"type": "array",
"items": {
"title": "Term",
"description": "A term in the context.",
"type": "object",
"properties": {
"name": {
"title": "Name",
"description": "The name of the term.",
"type": "string",
"examples": [
"Cargo"
]
},
"definition": {
"title": "Definition",
"description": "A definition of the term.",
"type": "string",
"examples": [
"A unit of transportation that needs moving and delivery to its delivery location."
]
},
"examples": {
"title": "Examples",
"description": "A list of example sentences using the term.",
"type": "array",
"items": {
"title": "Example sentence",
"description": "An example sentence using the term.",
"type": "string",
"examples": [
"Multiple Customers are involved with a Cargo, each playing a different role.",
"The Cargo delivery goal is specified."
]
},
"examples": [
[
"Multiple Customers are involved with a Cargo, each playing a different role.",
"The Cargo delivery goal is specified."
]
],
"minItems": 1,
"uniqueItems": true
},
"aliases": {
"title": "Aliases",
"description": "A list of aliases for the term.",
"type": "array",
"items": {
"title": "Alias",
"description": "An alias for the term.",
"type": "string",
"examples": [
"unit"
]
},
"examples": [
[
"unit"
]
],
"minItems": 1,
"uniqueItems": true
}
},
"required": ["name"]
},
"examples": [
{
"name": "Cargo",
"definition": "A unit of transportation that needs moving and delivery to its delivery location.",
"examples": [
"Multiple Customers are involved with a Cargo, each playing a different role.",
"The Cargo delivery goal is specified."
],
"aliases": [
"unit"
]
}
],
"minItems": 1,
"uniqueItems": true
}
},
"required": ["name", "terms"]
},
"minItems": 1,
"uniqueItems": true,
"examples": [
{
"name": "Cargo",
"domainVisionStatement": "To manage the routing of cargo through transportation legs",
"paths": [
"CargoDemo"
],
"terms": [
{
"name": "Cargo",
"definition": "A unit of transportation that needs moving and delivery to its delivery location.",
"examples": [
"Multiple Customers are involved with a Cargo, each playing a different role.",
"The Cargo delivery goal is specified."
],
"aliases": [
"unit"
]
}
]
}
]
}
},
"required": ["contexts"]
}
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://contextive.tech/",
"title": "Contextive Definitions Schema",
"description": "Schema for defining an ubiquitous language.",
"type": "object",
"properties": {
"contexts": {
"description": "A list of contexts.",
"type": "array",
"items": {
"title": "Context",
"description": "A context in the ubiquitous language, consisting of a list of terms.",
"type": "object",
"properties": {
"name": {
"title": "Name",
"description": "The name of the context.",
"type": "string",
"examples": [
"Cargo"
]
},
"domainVisionStatement": {
"title": "Domain Vision Statement",
"description": "A statement that describes the purpose of the context.",
"type": "string",
"examples": [
"To manage the routing of cargo through transportation legs"
]
},
"paths": {
"title": "Paths",
"description": "A list of paths that the context is involved in.",
"type": "array",
"items": {
"title": "Path",
"description": "A path that the context is involved in.",
"type": "string",
"examples": [
"CargoDemo",
"'**' # default, all paths"
]
},
"examples": [
[
"CargoDemo"
]
],
"minItems": 1,
"uniqueItems": true
},
"terms": {
"title": "Terms",
"description": "A list of terms in the context.",
"type": "array",
"items": {
"title": "Term",
"description": "A term in the context.",
"type": "object",
"properties": {
"name": {
"title": "Name",
"description": "The name of the term.",
"type": "string",
"examples": [
"Cargo"
]
},
"definition": {
"title": "Definition",
"description": "A definition of the term.",
"type": "string",
"examples": [
"A unit of transportation that needs moving and delivery to its delivery location."
]
},
"examples": {
"title": "Examples",
"description": "A list of example sentences using the term.",
"type": "array",
"items": {
"title": "Example sentence",
"description": "An example sentence using the term.",
"type": "string",
"examples": [
"Multiple Customers are involved with a Cargo, each playing a different role.",
"The Cargo delivery goal is specified."
]
},
"examples": [
[
"Multiple Customers are involved with a Cargo, each playing a different role.",
"The Cargo delivery goal is specified."
]
],
"minItems": 1,
"uniqueItems": true
},
"aliases": {
"title": "Aliases",
"description": "A list of aliases for the term.",
"type": "array",
"items": {
"title": "Alias",
"description": "An alias for the term.",
"type": "string",
"examples": [
"unit"
]
},
"examples": [
[
"unit"
]
],
"minItems": 1,
"uniqueItems": true
}
},
"required": ["name"]
},
"examples": [
{
"name": "Cargo",
"definition": "A unit of transportation that needs moving and delivery to its delivery location.",
"examples": [
"Multiple Customers are involved with a Cargo, each playing a different role.",
"The Cargo delivery goal is specified."
],
"aliases": [
"unit"
]
}
],
"minItems": 1,
"uniqueItems": true
}
},
"required": ["name", "terms"]
},
"minItems": 1,
"uniqueItems": true,
"examples": [
{
"name": "Cargo",
"domainVisionStatement": "To manage the routing of cargo through transportation legs",
"paths": [
"CargoDemo"
],
"terms": [
{
"name": "Cargo",
"definition": "A unit of transportation that needs moving and delivery to its delivery location.",
"examples": [
"Multiple Customers are involved with a Cargo, each playing a different role.",
"The Cargo delivery goal is specified."
],
"aliases": [
"unit"
]
}
]
}
]
}
},
"required": ["contexts"]
}
Loading

0 comments on commit 65ec44a

Please sign in to comment.