Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
django-forms-as-jsonschema
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Libraries
django-forms-as-jsonschema
Commits
8129242f
Commit
8129242f
authored
2 years ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Rename schema to jsonschema
parent
b7e13671
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
django_forms_as_jsonschema/forms.py
+3
-3
3 additions, 3 deletions
django_forms_as_jsonschema/forms.py
django_forms_as_jsonschema/jsonschema.py
+6
-7
6 additions, 7 deletions
django_forms_as_jsonschema/jsonschema.py
with
9 additions
and
10 deletions
django_forms_as_jsonschema/forms.py
+
3
−
3
View file @
8129242f
from
django.forms
import
Form
from
django.forms
import
Form
from
django_forms_as_jsonschema.
schema
import
Schema
from
.json
schema
import
JSON
Schema
class
JSONSchemaFormMixin
:
class
JSONSchemaFormMixin
:
def
as_jsonschema
(
self
:
Form
)
->
str
:
def
as_jsonschema
(
self
:
Form
)
->
dict
:
schema
=
Schema
()
schema
=
JSON
Schema
()
for
name
,
field
in
self
.
fields
.
items
():
for
name
,
field
in
self
.
fields
.
items
():
schema
.
add_field
(
name
,
field
)
schema
.
add_field
(
name
,
field
)
return
schema
.
schema
return
schema
.
schema
This diff is collapsed.
Click to expand it.
django_forms_as_jsonschema/schema.py
→
django_forms_as_jsonschema/
json
schema.py
+
6
−
7
View file @
8129242f
...
@@ -4,15 +4,14 @@ import json
...
@@ -4,15 +4,14 @@ import json
from
django
import
forms
from
django
import
forms
class
Schema
:
class
JSONSchema
:
SCHEMA
=
{
"
$schema
"
:
"
https://json-schema.org/draft/2020-12/schema
"
,
"
type
"
:
"
object
"
,
"
properties
"
:
{},
}
def
__init__
(
self
):
def
__init__
(
self
):
self
.
schema
=
copy
.
deepcopy
(
self
.
SCHEMA
)
self
.
schema
=
{
"
$schema
"
:
"
https://json-schema.org/draft/2020-12/schema
"
,
"
type
"
:
"
object
"
,
"
properties
"
:
{},
}
# example_json = {
# example_json = {
# "type": "object",
# "type": "object",
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment