Spec API

Object Interface

All fields in OAS 3.0 objects are accessed using python’s [] operator. This is done to avoid any confusion between which fields are in the spec vs attributes of the implementation class and to avoid workarounds wherein spec fields which conflict with keywords or builtins - e.g. in - can retain their original names.

For example, accessing the paths field in a document is done like so:

my_doc = OpenApiObject(...)
paths = my_doc['paths']

OpenApiBaseObject

class poast.openapi3.spec.model.baseobj.OpenApiBaseObject(data, doc_path='#')[source]

Bases: poast.openapi3.spec.model.entity.OpenApiEntity, dict

Base class for OpenAPI specification objects.

__init__(data, doc_path='#')[source]

Invoke child class initialization.

__missing__(key)[source]

If a value is missing from the spec, return the default, as defined by the standard, if possible.

accept(visitor)[source]

Depth first traversal, via visitor.

Parameters:visitor (func) – a function that takes a single OpenApiEntity as an argument.
validate()[source]

Validate the data in this object against the spec.

value(show_unset=False)[source]

Gnarly (in the bad way) convenience/debug function used to return the document as a python dictionary for pprinting and dev validation.

__weakref__

list of weak references to the object (if defined)

Primitive Types

OpenApi 3.0 Primitive datatype definitions.

See also: - https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#data-types

Container Types

This module defines the OpenApi 3.0 container types

For more info, see:

Document Objects