Skip to content

Commit d765fbf

Browse files
committed
first pass at codemeta generation form
1 parent 5b8509f commit d765fbf

File tree

13 files changed

+412
-122
lines changed

13 files changed

+412
-122
lines changed

content/create.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "Create a CodeMeta file"
3+
#layout: login
4+
---
5+
6+
{{< react-schema >}}
7+
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,14 @@
1-
2-
<html>
3-
<head>
4-
<title>React JSONSchemaForm Demo</title>
5-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
6-
</head>
7-
<body>
81
<div id="app"></div>
92

103
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.4.2/umd/react.production.min.js"></script>
114
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.4.2/umd/react-dom.production.min.js"></script>
125
<script src="https://unpkg.com/react-jsonschema-form/dist/react-jsonschema-form.js"></script>
136
<script type="text/javascript" src="/schema.json"></script>
7+
<script type="text/javascript" src="/uiSchema.json"></script>
8+
149
<script>
1510
const Form = JSONSchemaForm.default;
16-
const uiSchema= {
17-
firstName: {
18-
"ui:autofocus": true,
19-
"ui:emptyValue": "",
20-
},
21-
age: {
22-
"ui:widget": "updown",
23-
"ui:title": "Age of person",
24-
"ui:description": "(earthian year)",
25-
},
26-
};
11+
2712

2813
const formData= {
2914

@@ -39,6 +24,4 @@
3924
onSubmit: log("submitted"),
4025
onError: log("errors")
4126
}), document.getElementById("app"));
42-
</script>
43-
</body>
44-
</html>
27+
</script>

static/SoftwareSourceCode.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
const schema = {
2+
"id": "SoftwareSourceCode.json",
3+
"title": "SoftwareSourceCode",
4+
"format": "http://schema.org/SoftwareSourceCode",
5+
"media": {"type": "application/json;profile=http://schema.org/SoftwareSourceCode"},
6+
"type": "object",
7+
"properties": {
8+
9+
10+
"codeRepository": {
11+
"type": "array",
12+
"items": {
13+
"type": "string",
14+
"format": "uri",
15+
"links": [{
16+
"rel": "http://schema.org/codeRepository",
17+
"href": "{+$}",
18+
"linkSource": 2
19+
}]
20+
}
21+
},
22+
"programmingLanguage": {"type": "string"},
23+
"targetProduct": {"type": "string"},
24+
"runtimePlatform": {
25+
"description": "Runtime platform or script interpreter dependencies (Example - Java v1, Python2.3, .Net Framework 3.0)",
26+
"type": "string"
27+
},
28+
29+
30+
"sameAs": {
31+
"type": "array",
32+
"items": {
33+
"type": "string",
34+
"format": "uri"
35+
}
36+
},
37+
"url": {
38+
"type": "string",
39+
"format": "uri"
40+
},
41+
"description": {
42+
"title": "Description",
43+
"description": "A short description of the item.",
44+
"type": "string"
45+
},
46+
"name": {
47+
"title": "Name",
48+
"description": "The name of the item.",
49+
"type": "string"
50+
}
51+
}
52+
};

static/example.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const schema = {
2+
title: "A registration form",
3+
description: "A simple form example.",
4+
type: "object",
5+
required: ["firstName", "lastName"],
6+
properties: {
7+
firstName: {
8+
type: "string",
9+
title: "First name",
10+
default: "Chuck",
11+
},
12+
lastName: {
13+
type: "string",
14+
title: "Last name",
15+
},
16+
age: {
17+
type: "integer",
18+
title: "Age",
19+
},
20+
bio: {
21+
type: "string",
22+
title: "Bio",
23+
},
24+
password: {
25+
type: "string",
26+
title: "Password",
27+
minLength: 3,
28+
},
29+
telephone: {
30+
type: "string",
31+
title: "Telephone",
32+
minLength: 10,
33+
},
34+
},
35+
};
36+

static/schema.json

Lines changed: 16 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,31 @@
11
const schema = {
2-
"id": "Thing.json",
3-
"title": "Thing",
4-
"format": "http://schema.org/Thing",
5-
"media": {"type": "application/json;profile=http://schema.org/Thing"},
2+
"id": "SoftwareSourceCode.json",
3+
"title": "SoftwareSourceCode",
4+
"format": "http://schema.org/SoftwareSourceCode",
5+
"media": {"type": "application/json;profile=http://schema.org/SoftwareSourceCode"},
66
"type": "object",
77
"properties": {
8-
"additionalType": {
9-
"type": "array",
10-
"items": {
11-
"type": "string",
12-
"format": "uri",
13-
"links": [{
14-
"rel": "http://schema.org/additionalType",
15-
"href": "{+$}",
16-
"linkSource": 2
17-
}]
18-
}
19-
},
20-
"alternateName": {
21-
"type": "array",
22-
"items": {"$ref": "#/definitions/alternateName"}
23-
},
24-
"description": {
25-
"type": "array",
26-
"items": {"$ref": "#/definitions/description"}
27-
},
28-
"image": {
29-
"type": "array",
30-
"items": {
31-
"type": "string",
32-
"format": "uri",
33-
"links": [{
34-
"rel": "http://schema.org/image",
35-
"href": "{+$}",
36-
"linkSource": 2
37-
}]
38-
}
8+
9+
"name": {"type": "string", "description": "Name of the software"},
10+
"codeRepository": {
11+
"type": "string",
12+
"format": "uri"
3913
},
40-
"name": {"$ref": "#/definitions/name"},
14+
"programmingLanguage": {"type": "string"},
15+
"license": {"type": "string"},
16+
4117
"sameAs": {
42-
"type": "array",
43-
"items": {
4418
"type": "string",
45-
"format": "uri",
46-
"links": [{
47-
"rel": "http://schema.org/sameAs",
48-
"href": "{+$}",
49-
"linkSource": 2
50-
}]
51-
}
19+
"format": "uri"
5220
},
5321
"url": {
5422
"type": "string",
5523
"format": "uri"
56-
}
57-
},
58-
"links": [{
59-
"rel": "self",
60-
"href": "{+url}"
61-
}],
62-
"definitions": {
63-
"array": {
64-
"type": "array",
65-
"items": {"$ref": "#"}
66-
},
67-
"possibleRef": {
68-
"oneOf": [
69-
{"$ref": "#"},
70-
{
71-
"type": "string",
72-
"format": "uri",
73-
"links": [{
74-
"rel": "full",
75-
"href": "{+$}"
76-
}]
77-
}
78-
]
79-
},
80-
"possibleRefArray": {
81-
"oneOf": [
82-
{
83-
"type": "string",
84-
"format": "uri",
85-
"links": [{
86-
"rel": "full",
87-
"href": "{+$}"
88-
}]
89-
},
90-
{
91-
"type": "array",
92-
"items": {"$ref": "#/definitions/possibleRef"}
93-
}
94-
]
95-
},
96-
"alternateName": {
97-
"title": "Alternate Name",
98-
"description": "An alias for the item.",
99-
"type": "string"
100-
},
101-
"description": {
24+
},
25+
"description": {
10226
"title": "Description",
10327
"description": "A short description of the item.",
10428
"type": "string"
105-
},
106-
"name": {
107-
"title": "Name",
108-
"description": "The name of the item.",
109-
"type": "string"
11029
}
11130
}
112-
}
31+
};

static/thing.json

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
const schema = {
2+
"id": "Thing.json",
3+
"title": "Thing",
4+
"format": "http://schema.org/Thing",
5+
"media": {"type": "application/json;profile=http://schema.org/Thing"},
6+
"type": "object",
7+
"properties": {
8+
"additionalType": {
9+
"type": "array",
10+
"items": {
11+
"type": "string",
12+
"format": "uri",
13+
"links": [{
14+
"rel": "http://schema.org/additionalType",
15+
"href": "{+$}",
16+
"linkSource": 2
17+
}]
18+
}
19+
},
20+
"alternateName": {
21+
"type": "array",
22+
"items": {"$ref": "#/definitions/alternateName"}
23+
},
24+
"description": {
25+
"type": "array",
26+
"items": {"$ref": "#/definitions/description"}
27+
},
28+
"image": {
29+
"type": "array",
30+
"items": {
31+
"type": "string",
32+
"format": "uri",
33+
"links": [{
34+
"rel": "http://schema.org/image",
35+
"href": "{+$}",
36+
"linkSource": 2
37+
}]
38+
}
39+
},
40+
"name": {"$ref": "#/definitions/name"},
41+
"sameAs": {
42+
"type": "array",
43+
"items": {
44+
"type": "string",
45+
"format": "uri",
46+
"links": [{
47+
"rel": "http://schema.org/sameAs",
48+
"href": "{+$}",
49+
"linkSource": 2
50+
}]
51+
}
52+
},
53+
"url": {
54+
"type": "string",
55+
"format": "uri"
56+
}
57+
},
58+
"links": [{
59+
"rel": "self",
60+
"href": "{+url}"
61+
}],
62+
"definitions": {
63+
"array": {
64+
"type": "array",
65+
"items": {"$ref": "#"}
66+
},
67+
"possibleRef": {
68+
"oneOf": [
69+
{"$ref": "#"},
70+
{
71+
"type": "string",
72+
"format": "uri",
73+
"links": [{
74+
"rel": "full",
75+
"href": "{+$}"
76+
}]
77+
}
78+
]
79+
},
80+
"possibleRefArray": {
81+
"oneOf": [
82+
{
83+
"type": "string",
84+
"format": "uri",
85+
"links": [{
86+
"rel": "full",
87+
"href": "{+$}"
88+
}]
89+
},
90+
{
91+
"type": "array",
92+
"items": {"$ref": "#/definitions/possibleRef"}
93+
}
94+
]
95+
},
96+
"alternateName": {
97+
"title": "Alternate Name",
98+
"description": "An alias for the item.",
99+
"type": "string"
100+
},
101+
"description": {
102+
"title": "Description",
103+
"description": "A short description of the item.",
104+
"type": "string"
105+
},
106+
"name": {
107+
"title": "Name",
108+
"description": "The name of the item.",
109+
"type": "string"
110+
}
111+
}
112+
}

0 commit comments

Comments
 (0)