Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

Python 3.10 is now available in preview.


Builder used for constructing validated objects.

Inherits From: Builder, expected_type

Given a class that implements validation.ValidatedBase, it will parse a YAML document and attempt to build an instance of the class. ObjectBuilder will only map YAML fields that are accepted by the ValidatedBase's GetValidator function. Lists are mapped to validated. Repeated attributes and maps are mapped to validated.Type properties.

For a YAML map to be compatible with a class, the class must have a constructor that can be called with no parameters. If the provided type does not have such a constructor a parse time error will occur.

The constructor initializes the validated object builder.

default_class Class that is instantiated upon the detection of a new document. An instance of this class will act as the document itself.



View source

Append a value to a sequence.

subject _ObjectSequence that is receiving new value.
value Value that is being appended to sequence.


View source

Instantiate new root validated object.

New instance of validated object.


View source

New instance of object mapper for opening map scope.

top_value Parent of nested object.

New instance of object mapper.


View source

New instance of object sequence.

top_value Object that contains the new sequence.

A new _ObjectSequencer instance.


View source

When leaving scope, ensures the new object is initialized.

This method is mainly for picking up on any missing required attributes.

top_value Parent of closing mapping object.
mapping _ObjectMapper instance that is leaving scope.


View source

Previously constructed sequence scope is at an end.

Called when the end of a sequence block is encountered. Useful for additional clean up or end of scope validation.

top_value Value which is the parent of the sequence.
sequence Sequence which is at the end of its scope.


View source

Initializes document with a value from the top level of a YAML document.

This method is called when the root document element is encountered at the top level of a YAML document. It should get called immediately after BuildDocument.

Receiving the None value indicates the empty document.

document Document as constructed in BuildDocument.
value Scalar value to initialize the document with.


View source

Maps key-value pair to an objects attribute.

subject _ObjectMapper of object that will receive new attribute.
key Key of attribute.
value Value of new attribute.

UnexpectedAttribute when the key is not a validated attribute of the subject value class.