marshmallow-jsonschema-3


Namemarshmallow-jsonschema-3 JSON
Version 1.0.9 PyPI version JSON
download
home_page
SummaryMarshmallow schema to OpenAPI 3.0.x-3.1 spec. Fork of marshmallow-jsonschema by Stephen J. Fuhry.
upload_time2022-06-30 13:51:18
maintainer
docs_urlNone
author10Speed
requires_python>=3.8
licenseMIT License
keywords marshmallow-jsonschema marshmallow schema serialization jsonschema validation openapi openapi3.1 openapi3.0
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # marshmallow-jsonschema-3

Transform marshmallow schemas into correct OpenAPI3.0.x-3.1 definitions.
Fork of [marshmallow-jsonschema](https://github.com/fuhrysteve/marshmallow-jsonschema) by 
Stephen J. Fuhry.

Why fork?
- Add support for marshmallow fields.Constant (missing in marshmallow-jsonschema 0.13.0)
- Add enum handling for the future? At least not as useless as current 
  approach. Flags `use_repr_enums=` to convert enums into list of `1=a, 2=b` or `use_new_enums=` 
  to create [3.1 suggested enums](https://github.com/OAI/OpenAPI-Specification/issues/348#issuecomment-336194030).
- Put schema references into `#/components/schemas/<name>` instead of `#/definitions/<name>` 
  [source](https://spec.openapis.org/oas/latest.html#components-object-example)
- Add old `nullable: true` attribute using `use_nullable=` flag.

## Installation
`pip install marshmallow-jsonschema-3` in >=Python3.8

## Usage

```python
from marshmallow import Schema, fields
from marshmallow_jsonschema_3 import JSONSchema

class UserSchema(Schema):
    username = fields.String()
    age = fields.Integer()
    birthday = fields.Date()

user_schema = UserSchema()
json_schema = JSONSchema(use_repr_enums=True, use_nullable=True)
json_schema.dump(user_schema)
```

## Deployment
1. Make your changes
2. Create `~/.pypirc` file for twine
```
[distutils]
index-servers =
    pypi
    testpypi

[pypi]
username = pypiusername
password = pypipsw

[testpypi]
username = pypiusername
password = pypipsw
```
2. `make pypitest` to deploy to https://test.pypi.org
3. Use `pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.
   org/simple marshmallow-jsonschema-3` to install test package in your projects using 
   real pypi dependencies. The default pip install provided by test.pypi will only look for dependencies 
   in test.pypi, and will fail to find actual versions of dependencies...

Use `make pypi` for real pypi and use `pip install marshmallow-jsonschema-3` to install 
published package.


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "marshmallow-jsonschema-3",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "marshmallow-jsonschema marshmallow schema serialization jsonschema validation openapi openapi3.1 openapi3.0",
    "author": "10Speed",
    "author_email": "info@10speed.cloud",
    "download_url": "https://files.pythonhosted.org/packages/71/f3/51922b552b665d283137b66ed9ea4c674776700521098687244648d85eaf/marshmallow-jsonschema-3-1.0.9.tar.gz",
    "platform": null,
    "description": "# marshmallow-jsonschema-3\n\nTransform marshmallow schemas into correct OpenAPI3.0.x-3.1 definitions.\nFork of [marshmallow-jsonschema](https://github.com/fuhrysteve/marshmallow-jsonschema) by \nStephen J. Fuhry.\n\nWhy fork?\n- Add support for marshmallow fields.Constant (missing in marshmallow-jsonschema 0.13.0)\n- Add enum handling for the future? At least not as useless as current \n  approach. Flags `use_repr_enums=` to convert enums into list of `1=a, 2=b` or `use_new_enums=` \n  to create [3.1 suggested enums](https://github.com/OAI/OpenAPI-Specification/issues/348#issuecomment-336194030).\n- Put schema references into `#/components/schemas/<name>` instead of `#/definitions/<name>` \n  [source](https://spec.openapis.org/oas/latest.html#components-object-example)\n- Add old `nullable: true` attribute using `use_nullable=` flag.\n\n## Installation\n`pip install marshmallow-jsonschema-3` in >=Python3.8\n\n## Usage\n\n```python\nfrom marshmallow import Schema, fields\nfrom marshmallow_jsonschema_3 import JSONSchema\n\nclass UserSchema(Schema):\n    username = fields.String()\n    age = fields.Integer()\n    birthday = fields.Date()\n\nuser_schema = UserSchema()\njson_schema = JSONSchema(use_repr_enums=True, use_nullable=True)\njson_schema.dump(user_schema)\n```\n\n## Deployment\n1. Make your changes\n2. Create `~/.pypirc` file for twine\n```\n[distutils]\nindex-servers =\n    pypi\n    testpypi\n\n[pypi]\nusername = pypiusername\npassword = pypipsw\n\n[testpypi]\nusername = pypiusername\npassword = pypipsw\n```\n2. `make pypitest` to deploy to https://test.pypi.org\n3. Use `pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.\n   org/simple marshmallow-jsonschema-3` to install test package in your projects using \n   real pypi dependencies. The default pip install provided by test.pypi will only look for dependencies \n   in test.pypi, and will fail to find actual versions of dependencies...\n\nUse `make pypi` for real pypi and use `pip install marshmallow-jsonschema-3` to install \npublished package.\n\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Marshmallow schema to OpenAPI 3.0.x-3.1 spec. Fork of marshmallow-jsonschema by Stephen J. Fuhry.",
    "version": "1.0.9",
    "split_keywords": [
        "marshmallow-jsonschema",
        "marshmallow",
        "schema",
        "serialization",
        "jsonschema",
        "validation",
        "openapi",
        "openapi3.1",
        "openapi3.0"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "36d60b3afe5c8584adca54e81759d27a",
                "sha256": "1cff4271ff28f0e85d671cdcdbf9fd8c385fedfec628775c8037848857fcedb1"
            },
            "downloads": -1,
            "filename": "marshmallow_jsonschema_3-1.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "36d60b3afe5c8584adca54e81759d27a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10114,
            "upload_time": "2022-06-30T13:51:15",
            "upload_time_iso_8601": "2022-06-30T13:51:15.092520Z",
            "url": "https://files.pythonhosted.org/packages/ab/a9/d7c72fc14b750f52e78f2e4642950c553d8f84d42afcc935a6b4de72f247/marshmallow_jsonschema_3-1.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "8bbba66d6c50eae46b9dfeabb25511d4",
                "sha256": "81dc6625bdafe4f04ca2365317751228ad7f01f521cacef967635da583c4ee38"
            },
            "downloads": -1,
            "filename": "marshmallow-jsonschema-3-1.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "8bbba66d6c50eae46b9dfeabb25511d4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 10512,
            "upload_time": "2022-06-30T13:51:18",
            "upload_time_iso_8601": "2022-06-30T13:51:18.062639Z",
            "url": "https://files.pythonhosted.org/packages/71/f3/51922b552b665d283137b66ed9ea4c674776700521098687244648d85eaf/marshmallow-jsonschema-3-1.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-06-30 13:51:18",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "marshmallow-jsonschema-3"
}
        
Elapsed time: 0.40512s