Open-Needs Models#
Open-Needs is written to support docs-as-code philosophy and existing tools. And as most information is stored in files on code versioning systems, also the main source of information for Open-Needs shall be files.
Beside extracting need objects from documentation files (e.g. md or rst), it shall be also possible to import them from json-files, which may contain exported data from an issue tracking systems.
Also the complete configuration of a project in Open-Needs shall be defined in json format and files.
json-schema#
All kind of data provided by or stored inside Open-Needs shall have a schema defined by json-schema.
This shall affect all Open-Needs related files, which are created/used by client tools.
E.g. a project configuration, stored as open_needs_project_conf.json
, which is used by a client tool like
Sphinx-Needs to setup the project configuration on
Open-Needs Server.
json-schema will not be used to validate REST API requests or the content of the database. It is mostly used to validate files, which are used inside a docs-as-code approach to keep information in files and therefore also on git repositories.
Organization configurations#
An organization is an unique entity, which contains mostly projects only.
It may be used in future for common configuration of projects, which belong to one organization.
Schema#
- name
Organization schema
- uri
- location
/models/organization.schema.json
- status
work in progress
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://open-needs.org/organization.schema.json",
"title": "Open-Needs Organization schema",
"type": "object",
"properties": {
"key": {
"description": "An unique string as key, which represents the organization in urls.",
"type": "string"
},
"title": {
"description": "A title for the organization, which is used as textual representation in documents and websites.",
"type": "string"
},
"description": {
"description": "A description of the organization.",
"type": "string"
},
"url": {
"description": "An url to a webpage of the organization.",
"type": "string"
},
"projects": {
"description": "A list of projects belonging to the organization",
"type": "array",
"items": {
"$ref": "https://open-needs.org/project.schema.json"
}
}
},
"required": ["key", "title", "projects"]
}
Open-Needs Organization schema |
||
type |
object |
|
properties |
||
|
An unique string as key, which represents the organization in urls. |
|
type |
string |
|
|
A title for the organization, which is used as textual representation in documents and websites. |
|
type |
string |
|
|
A description of the organization. |
|
type |
string |
|
|
An url to a webpage of the organization. |
|
type |
string |
|
|
A list of projects belonging to the organization |
|
type |
array |
|
items |
https://open-needs.org/project.schema.json |
Project configurations#
In Open-Needs a project configuration contains the configuration for the following elements:
need types
need options
need link types
project warnings
global option values
and much more
Take a look into the configuration documentation of Sphinx-Needs to get a feeling about what may be part of a project configuration in future.
Most configuration is clustered inside Open-Needs Domains, so that a project configuration contains
its project specific config under the domain project
and imports the other domains under their domain specific
name.
Schema#
- name
Project schema
- uri
- location
/models/project.schema.json
- status
work in progress
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://open-needs.org/project.schema.json",
"title": "Open-Needs Project schema",
"type": "object",
"properties": {
"key": {
"description": "An unique string as key, which represents the project in urls.",
"type": "string"
},
"title": {
"description": "A title for the project, which is used as textual representation in documents and websites.",
"type": "string"
},
"description": {
"description": "A textual description of the project.",
"type": "string"
},
"url": {
"description": "An url to a webpage of the project.",
"type": "string"
},
"configuration": {
"description": "A project specific configuration, based on domain.schema",
"$ref": "https://open-needs.org/domain.schema.json"
},
"domains": {
"description": "A list of domains configuring the project",
"type": "array",
"items": {
"$ref": "https://open-needs.org/domain.schema.json"
}
},
"needs": {
"description": "A list of needs belonging to the project",
"type": "array",
"items": {
"$ref": "https://open-needs.org/need.schema.json"
}
}
},
"required": ["key", "title", "configuration", "domains", "needs"]
}
Open-Needs Project schema |
||
type |
object |
|
properties |
||
|
An unique string as key, which represents the project in urls. |
|
type |
string |
|
|
A title for the project, which is used as textual representation in documents and websites. |
|
type |
string |
|
|
A textual description of the project. |
|
type |
string |
|
|
An url to a webpage of the project. |
|
type |
string |
|
|
A project specific configuration, based on domain.schema |
|
https://open-needs.org/domain.schema.json |
||
|
A list of domains configuring the project |
|
type |
array |
|
items |
https://open-needs.org/domain.schema.json |
|
|
A list of needs belonging to the project |
|
type |
array |
|
items |
https://open-needs.org/need.schema.json |
Domain configurations#
Open-Needs Domains are a collection of need types, fields, checks and automatism, which are used to configure a project for one or multiple specific domains.
With using domains a project gains the possibility to create and mange need objects for these domains.
Domains are used to provide a common setup for a specific domain, so that no projects needs define all the needed need types and rules completely from scratch.
Examples for domains are:
Software development (E.g. requirements and specification types)
Software architecture (E.g. class and component types)
Autosar (E.g. SWC and runnable types)
Employees (E.g. employee, group and role types)
Software processes (E.g. process, step, workflow and artifact types)
Schema#
- name
Domain schema
- uri
- location
/models/domain.schema.json
- status
work in progress
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://open-needs.org/domain.schema.json",
"title": "Open-Needs Domain schema",
"type": "object",
"properties": {
"key": {
"description": "An unique string as key, which represents the domain worldwide.",
"type": "string"
},
"title": {
"description": "A title for the domain, which is used as textual representation in documents and websites.",
"type": "string"
},
"description": {
"description": "A description of the domain.",
"type": "string"
},
"url": {
"description": "An url to a webpage of the domain.",
"type": "string"
},
"types": {
"description": "List of need types which are defined by this domain",
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"description": "Short key as string of the domain type.",
"type": "string"
},
"title": {
"description": "Title as string of the domain type.",
"type": "string"
},
"color": {
"description": "Color in hex of the domain type (for graphical representations)",
"type": "string",
"pattern": "^#(?:[0-9a-fA-F]{3}){1,2}$"
},
"style": {
"description": "A PlantUML style name of the domain type (e.g. node or card).",
"type": "string"
}
},
"required": ["key", "title", "color", "style"]
}
},
"options": {
"description": "List of need options which are defined by this domain.",
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"description": "Name of the option as string.",
"type": "string"
},
"description": {
"description": "Description for the option.",
"type": "string"
},
"type": {
"description": "Name of the options",
"type": "string",
"enum": ["string", "number"]
},
"default": {
"description": "Default value of the option, if not set.",
"type": ["string", "number", "null"]
}
},
"required": ["name", "type", "default"]
}
},
"links": {
"description": "List of need links which are defined by this domain.",
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"description": "Name of the link as string.",
"type": "string"
},
"description": {
"description": "Description for the link.",
"type": "string"
},
"incoming": {
"description": "Label to use for incoming links.",
"type": "string"
},
"outgoing": {
"description": "Label to use for outgoing links.",
"type": "string"
},
"allow_dead_links": {
"description": "Links are allowed to reference not existing needs.",
"type": "boolean"
},
"style": {
"type": "object",
"properties": {
"color": {
"description": "Color of the link in graphical representations.",
"type": "string",
"pattern": "^#(?:[0-9a-fA-F]{3}){1,2}$"
},
"color_part": {
"description": "Color of the link in graphical representations (to need_parts).",
"type": "string",
"pattern": "^#(?:[0-9a-fA-F]{3}){1,2}$"
},
"start": {
"description": "PlantUML link start character (e.g. . or - ).",
"type": "string"
},
"end": {
"description": "PlantUML link end character (e.g. > or --o ).",
"type": "string"
}
},
"required": []
}
},
"required": ["name", "incoming", "outgoing"]
}
}
},
"required": ["key", "title", "description", "types", "options", "links"]
}
Open-Needs Domain schema |
|||||
type |
object |
||||
properties |
|||||
|
An unique string as key, which represents the domain worldwide. |
||||
type |
string |
||||
|
A title for the domain, which is used as textual representation in documents and websites. |
||||
type |
string |
||||
|
A description of the domain. |
||||
type |
string |
||||
|
An url to a webpage of the domain. |
||||
type |
string |
||||
|
List of need types which are defined by this domain |
||||
type |
array |
||||
items |
type |
object |
|||
properties |
|||||
|
Short key as string of the domain type. |
||||
type |
string |
||||
|
Title as string of the domain type. |
||||
type |
string |
||||
|
Color in hex of the domain type (for graphical representations) |
||||
type |
string |
||||
pattern |
^#(?:[0-9a-fA-F]{3}){1,2}$ |
||||
|
A PlantUML style name of the domain type (e.g. node or card). |
||||
type |
string |
||||
|
List of need options which are defined by this domain. |
||||
type |
array |
||||
items |
type |
object |
|||
properties |
|||||
|
Name of the option as string. |
||||
type |
string |
||||
|
Description for the option. |
||||
type |
string |
||||
|
Name of the options |
||||
type |
string |
||||
enum |
string, number |
||||
|
Default value of the option, if not set. |
||||
type |
string / number / null |
||||
|
List of need links which are defined by this domain. |
||||
type |
array |
||||
items |
type |
object |
|||
properties |
|||||
|
Name of the link as string. |
||||
type |
string |
||||
|
Description for the link. |
||||
type |
string |
||||
|
Label to use for incoming links. |
||||
type |
string |
||||
|
Label to use for outgoing links. |
||||
type |
string |
||||
|
Links are allowed to reference not existing needs. |
||||
type |
boolean |
||||
|
type |
object |
|||
properties |
|||||
|
Color of the link in graphical representations. |
||||
type |
string |
||||
pattern |
^#(?:[0-9a-fA-F]{3}){1,2}$ |
||||
|
Color of the link in graphical representations (to need_parts). |
||||
type |
string |
||||
pattern |
^#(?:[0-9a-fA-F]{3}){1,2}$ |
||||
|
PlantUML link start character (e.g. . or - ). |
||||
type |
string |
||||
|
PlantUML link end character (e.g. > or –o ). |
||||
type |
string |
Need item#
A single need item contains mostly its own data.
All dynamic elements (links, dynamic function) shall be resolved in the context of a specific documentation build/version.
It does not contain any information about project/domain configuration. For this a Needs container must be used.
So it acts mostly as a key-value store.
Schema#
- name
Need schema
- uri
- location
/models/need.schema.json
- status
work in progress
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://open-needs.org/need.schema.json",
"title": "Open-Needs Need schema",
"type": "object",
"patternProperties": {
"^.*$": {
"type": [
"string",
"number",
"null"
]
}
},
"required": [
"id",
"source_type",
"source_uri"
]
}
Open-Needs Need schema |
||
type |
object |
|
patternProperties |
||
|
type |
string / number / null |
Needs container#
Needs can be created/imported via the documentation files or by a needs_container.json
file.
A needs container can be used to store data from external systems (like Jira or Codebeamer) and make it available in the docs-as-code environment.
Also the Open-Needs tools are using this format to export their data, so that it can be used by scripts and other tools.
A needs container only contains needs related information, this may be:
Needs: All exported needs in a list with their data
Needs Domain: needs related project configuration as Open-Needs Domain config (needed types, options)
The exported Domain does contain information about the need configuration only. E.g. what types and options must be configured. It shall not contain none-need specific information like warnings, global values or automatism.
A needs container contains the “executed” information of needs in a specific documentation context/run. All possible dynamic functions and references must be resolved.
Schema#
- name
Needs container schema
- uri
- location
/models/needs_container.schema.json
- status
work in progress
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://open-needs.org/needs_container.schema.json",
"title": "Open-Needs Needs container schema",
"type": "object",
"properties": {
"key": {
"description": "An unique string as key, which represents the project in urls.",
"type": "string"
},
"title": {
"description": "A title for the project, which is used as textual representation in documents and websites.",
"type": "string"
},
"description": {
"description": "A textual description of the project.",
"type": "string"
},
"needs": {
"description": "A list of needs belonging to the project",
"type": "array",
"items": {
"$ref": "https://open-needs.org/need.schema.json"
}
},
"configuration": {
"description": "A needs container specific configuration, based on domain.schema",
"$ref": "https://open-needs.org/domain.schema.json"
}
},
"required": ["key", "title", "configuration", "needs"]
}
Open-Needs Needs container schema |
||
type |
object |
|
properties |
||
|
An unique string as key, which represents the project in urls. |
|
type |
string |
|
|
A title for the project, which is used as textual representation in documents and websites. |
|
type |
string |
|
|
A textual description of the project. |
|
type |
string |
|
|
A list of needs belonging to the project |
|
type |
array |
|
items |
https://open-needs.org/need.schema.json |
|
|
A needs container specific configuration, based on domain.schema |
|
https://open-needs.org/domain.schema.json |
Sphinx-Needs schema#
Here is the current json schema of Sphinx-Needs, which is not so complex but maybe can provide some ideas.
Source: needsfile.json
http://json-schema.org/draft-07/schema# |
||||||
needs.json schema |
||||||
type |
object |
|||||
properties |
||||||
|
type |
string |
||||
|
type |
string |
||||
|
type |
string |
||||
|
type |
object |
||||
patternProperties |
||||||
|
type |
object |
||||
properties |
||||||
|
type |
string |
||||
|
type |
object |
||||
|
type |
number |
||||
|
patternProperties |
|||||
|
type |
object |
||||
properties |
||||||
|
type |
string |
||||
|
type |
string |
||||
|
type |
string |
||||
|
type |
number |
||||
additionalProperties |
False |
Discussion#
For ideas and discussions going into details, please create a specific ticket on our github project.
For any other short information, feel free to add a comment.