File: metadata.rst

package info (click to toggle)
python-pyodata 1.11.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,280 kB
  • sloc: python: 7,170; xml: 947; makefile: 67; sh: 15
file content (46 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Metadata evaluation
===================


By default, the client makes sure that references to properties, entities and
entity sets are pointing to existing elements.

The most often problem that we had to deal with was an invalid *ValueList*
annotation pointing to a non-existing property.

To enable verification of service definition, the client instance of the class
*Service* publishes the property *schema* which returns an instance of the
class *Schema* from the module *pyodata.v2.model* and it contains parsed
*$metadata*.

List of the defined EntitySets
------------------------------

If you need to iterate over all EntitySets:

.. code-block:: python

    for es in service.schema.entity_sets:
         print(es.name)

or if you just need the list of EntitySet names:

.. code-block:: python

    entity_set_names = [es.name for es in service.schema.entity_sets]


Property has this label
-----------------------

.. code-block:: python

    assert northwind.schema.entity_type('Customer').proprty('CustomerID').label == 'Identifier'


Property has a value helper
---------------------------

.. code-block:: python

    assert northwind.schema.entity_type('Customer').proprty('City').value_helper is not None