Skip to content

Commit 8a2cee0

Browse files
committed
Generated build artifacts for v2.0.0b1 release
1 parent 0bdfa5b commit 8a2cee0

File tree

6 files changed

+1132
-993
lines changed

6 files changed

+1132
-993
lines changed

docs/coverage-badge.svg

Lines changed: 1 addition & 1 deletion
Loading

docs/index.html

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,10 @@ <h2>The custom mappings file</h2>
644644
<div class="code-block"><pre><code class="language-python">
645645
from OpenApiLibCore import (
646646
IGNORE,
647-
Dto,
648647
IdDependency,
649648
IdReference,
650649
PathPropertiesConstraint,
650+
RelationsMapping,
651651
PropertyValueConstraint,
652652
UniquePropertyValueConstraint,
653653
)
@@ -658,7 +658,7 @@ <h2>The custom mappings file</h2>
658658
}
659659

660660

661-
class MyDtoThatDoesNothing(Dto):
661+
class MyMappingThatDoesNothing(RelationsMapping):
662662
@staticmethod
663663
def get_relations():
664664
relations = []
@@ -675,13 +675,13 @@ <h2>The custom mappings file</h2>
675675
return relations
676676

677677

678-
DTO_MAPPING = {
679-
("/myspecialpath", "post"): MyDtoThatDoesNothing
678+
RELATIONS_MAPPING = {
679+
("/myspecialpath", "post"): MyMappingThatDoesNothing
680680
}
681681

682682

683683
PATH_MAPPING = {
684-
"/mypathwithexternalid/{external_id}": MyDtoThatDoesNothing
684+
"/mypathwithexternalid/{external_id}": MyMappingThatDoesNothing
685685
}
686686

687687
</code></pre></div>
@@ -693,13 +693,13 @@ <h2>The custom mappings file</h2>
693693
Here the classes needed to implement custom mappings are imported.
694694
This section can just be copied without changes.</li>
695695
<li>The <code class="language-python">ID_MAPPING</code> "constant" definition / assignment.</li>
696-
<li>The section defining the mapping Dtos. More on this later.</li>
697-
<li>The <code class="language-python">DTO_MAPPING</code> "constant" definition / assignment.</li>
696+
<li>The section defining the RelationsMappings. More on this later.</li>
697+
<li>The <code class="language-python">RELATIONS_MAPPING</code> "constant" definition / assignment.</li>
698698
<li>The <code class="language-python">PATH_MAPPING</code> "constant" definition / assignment.</li>
699699
</ol>
700700

701-
<h2>The ID_MAPPING, DTO_MAPPING and PATH_MAPPING</h2>
702-
When a custom mappings file is used, the OpenApiLibCore will attempt to import it and then import <code>DTO_MAPPING</code>, <code>PATH_MAPPING</code> and <code>ID_MAPPING</code> from it.
701+
<h2>The ID_MAPPING, RELATIONS_MAPPING and PATH_MAPPING</h2>
702+
When a custom mappings file is used, the OpenApiLibCore will attempt to import it and then import <code>RELATIONS_MAPPING</code>, <code>PATH_MAPPING</code> and <code>ID_MAPPING</code> from it.
703703
For this reason, the exact same name must be used in a custom mappings file (capitilization matters).
704704

705705
<h3>The ID_MAPPING</h3>
@@ -721,18 +721,18 @@ <h3>The ID_MAPPING</h3>
721721

722722
</code></pre></div>
723723

724-
<h3>The DTO_MAPPING</h3>
725-
The <code>DTO_MAPPING</code> is a dictionary with a tuple as its key and a mappings Dto as its value.
724+
<h3>The RELATIONS_MAPPING</h3>
725+
The <code>RELATIONS_MAPPING</code> is a dictionary with a tuple as its key and a RelationsMapping as its value.
726726
The tuple must be in the form <code class="language-python">("path_from_the_paths_section", "method_supported_by_the_path")</code>.
727727
The <code class="language-python">path_from_the_paths_section</code> must be exactly as found in the openapi document.
728728
The <code class="language-python">method_supported_by_the_path</code> must be one of the methods supported by the path and must be in lowercase.
729729

730730
<h3>The PATH_MAPPING</h3>
731-
The <code>PATH_MAPPING</code> is a dictionary with a <code>"path_from_the_paths_section"</code> as its key and a mappings Dto as its value.
731+
The <code>PATH_MAPPING</code> is a dictionary with a <code>"path_from_the_paths_section"</code> as its key and a RelationsMapping as its value.
732732
The <code>path_from_the_paths_section</code> must be exactly as found in the openapi document.
733733

734734

735-
<h2>Dto mapping classes</h2>
735+
<h2>RelationsMapping classes</h2>
736736
As can be seen from the import section above, a number of classes are available to deal with relations between resources and / or constraints on properties.
737737
Each of these classes is designed to handle a relation or constraint commonly seen in REST APIs.
738738

@@ -757,7 +757,7 @@ <h3><code>IdReference</code></h3>
757757
This relation can be implemented as follows:
758758

759759
<div class="code-block"><pre><code class="language-python">
760-
class EmployeeDto(Dto):
760+
class EmployeeMapping(RelationsMapping):
761761
@staticmethod
762762
def get_relations():
763763
relations = [
@@ -769,8 +769,8 @@ <h3><code>IdReference</code></h3>
769769
]
770770
return relations
771771

772-
DTO_MAPPING = {
773-
("/employees", "post"): EmployeeDto
772+
RELATIONS_MAPPING = {
773+
("/employees", "post"): EmployeeMapping
774774
}
775775

776776
</code></pre></div>
@@ -801,7 +801,7 @@ <h3><code>IdDependency</code></h3>
801801
To verify that the specified <code>error_code</code> indeed occurs when attempting to <code>delete</code> the Wagegroup, we can implement the following dependency:
802802

803803
<div class="code-block"><pre><code class="language-python">
804-
class WagegroupDto(Dto):
804+
class WagegroupMapping(RelationsMapping):
805805
@staticmethod
806806
def get_relations():
807807
relations = [
@@ -813,8 +813,8 @@ <h3><code>IdDependency</code></h3>
813813
]
814814
return relations
815815

816-
DTO_MAPPING = {
817-
("/wagegroups/{wagegroup_id}", "delete"): WagegroupDto
816+
RELATIONS_MAPPING = {
817+
("/wagegroups/{wagegroup_id}", "delete"): WagegroupMapping
818818
}
819819

820820
</code></pre></div>
@@ -833,7 +833,7 @@ <h3><code>UniquePropertyValueConstraint</code></h3>
833833
To verify that the specified <code>error_code</code> occurs when attempting to <code>post</code> an Employee with an <code>employee_number</code> that is already in use, we can implement the following dependency:
834834

835835
<div class="code-block"><pre><code class="language-python">
836-
class EmployeeDto(Dto):
836+
class EmployeeMapping(RelationsMapping):
837837
@staticmethod
838838
def get_relations():
839839
relations = [
@@ -845,15 +845,15 @@ <h3><code>UniquePropertyValueConstraint</code></h3>
845845
]
846846
return relations
847847

848-
DTO_MAPPING = {
849-
("/employees", "post"): EmployeeDto,
850-
("/employees/${employee_id}", "put"): EmployeeDto,
851-
("/employees/${employee_id}", "patch"): EmployeeDto,
848+
RELATIONS_MAPPING = {
849+
("/employees", "post"): EmployeeMapping,
850+
("/employees/${employee_id}", "put"): EmployeeMapping,
851+
("/employees/${employee_id}", "patch"): EmployeeMapping,
852852
}
853853

854854
</code></pre></div>
855855

856-
Note how this example reuses the <code>EmployeeDto</code> to model the uniqueness constraint for all the operations (<code>post</code>, <code>put</code> and <code>patch</code>) that all relate to the same <code>employee_number</code>.
856+
Note how this example reuses the <code>EmployeeMapping</code> to model the uniqueness constraint for all the operations (<code>post</code>, <code>put</code> and <code>patch</code>) that all relate to the same <code>employee_number</code>.
857857

858858
<hr>
859859

@@ -867,7 +867,7 @@ <h3><code>PropertyValueConstraint</code></h3>
867867
This type of constraint can be modeled as follows:
868868

869869
<div class="code-block"><pre><code class="language-python">
870-
class EmployeeDto(Dto):
870+
class EmployeeMapping(RelationsMapping):
871871
@staticmethod
872872
def get_relations():
873873
relations = [
@@ -879,10 +879,10 @@ <h3><code>PropertyValueConstraint</code></h3>
879879
]
880880
return relations
881881

882-
DTO_MAPPING = {
883-
("/employees", "post"): EmployeeDto,
884-
("/employees/${employee_id}", "put"): EmployeeDto,
885-
("/employees/${employee_id}", "patch"): EmployeeDto,
882+
RELATIONS_MAPPING = {
883+
("/employees", "post"): EmployeeMapping,
884+
("/employees/${employee_id}", "put"): EmployeeMapping,
885+
("/employees/${employee_id}", "patch"): EmployeeMapping,
886886
}
887887

888888
</code></pre></div>
@@ -891,7 +891,7 @@ <h3><code>PropertyValueConstraint</code></h3>
891891
To support additional restrictions like these, the <code class="language-python">PropertyValueConstraint</code> supports two additional properties: <code class="language-python">error_value</code> and <code class="language-python">invalid_value_error_code</code>:
892892

893893
<div class="code-block"><pre><code class="language-python">
894-
class EmployeeDto(Dto):
894+
class EmployeeMapping(RelationsMapping):
895895
@staticmethod
896896
def get_relations():
897897
relations = [
@@ -905,10 +905,10 @@ <h3><code>PropertyValueConstraint</code></h3>
905905
]
906906
return relations
907907

908-
DTO_MAPPING = {
909-
("/employees", "post"): EmployeeDto,
910-
("/employees/${employee_id}", "put"): EmployeeDto,
911-
("/employees/${employee_id}", "patch"): EmployeeDto,
908+
RELATIONS_MAPPING = {
909+
("/employees", "post"): EmployeeMapping,
910+
("/employees/${employee_id}", "put"): EmployeeMapping,
911+
("/employees/${employee_id}", "patch"): EmployeeMapping,
912912
}
913913

914914
</code></pre></div>
@@ -920,7 +920,7 @@ <h3><code>PropertyValueConstraint</code></h3>
920920
This situation can be handled by use of the special <code class="language-python">IGNORE</code> value (see below for other uses):
921921

922922
<div class="code-block"><pre><code class="language-python">
923-
class EmployeeDto(Dto):
923+
class EmployeeMapping(RelationsMapping):
924924
@staticmethod
925925
def get_relations():
926926
relations = [
@@ -934,10 +934,10 @@ <h3><code>PropertyValueConstraint</code></h3>
934934
]
935935
return relations
936936

937-
DTO_MAPPING = {
938-
("/employees", "post"): EmployeeDto,
939-
("/employees/${employee_id}", "put"): EmployeeDto,
940-
("/employees/${employee_id}", "patch"): EmployeeDto,
937+
RELATIONS_MAPPING = {
938+
("/employees", "post"): EmployeeMapping,
939+
("/employees/${employee_id}", "put"): EmployeeMapping,
940+
("/employees/${employee_id}", "patch"): EmployeeMapping,
941941
}
942942

943943
</code></pre></div>
@@ -950,7 +950,7 @@ <h3><code>PathPropertiesConstraint</code></h3>
950950
<blockquote><u>Just use this for the <code>path</code></u></blockquote>
951951

952952
<blockquote><i>
953-
Note: The <code class="language-python">PathPropertiesConstraint</code> is only applicable to the <code class="language-python">get_path_relations</code> in a <code class="language-python">Dto</code> and only the <code class="language-python">PATH_MAPPING</code> uses the <code class="language-python">get_path_relations</code>.
953+
Note: The <code class="language-python">PathPropertiesConstraint</code> is only applicable to the <code class="language-python">get_path_relations</code> in a <code class="language-python">RelationsMapping</code> and only the <code class="language-python">PATH_MAPPING</code> uses the <code class="language-python">get_path_relations</code>.
954954
</i></blockquote>
955955

956956
To be able to automatically perform endpoint validations, the OpenApiLibCore has to construct the <code>url</code> for the resource from the <code>path</code> as found in the openapi document.
@@ -970,7 +970,7 @@ <h3><code>PathPropertiesConstraint</code></h3>
970970
It should be clear that the OpenApiLibCore won't be able to acquire a valid <code>month</code> and <code>date</code>. The <code class="language-python">PathPropertiesConstraint</code> can be used in this case:
971971

972972
<div class="code-block"><pre><code class="language-python">
973-
class BirthdaysDto(Dto):
973+
class BirthdaysMapping(RelationsMapping):
974974
@staticmethod
975975
def get_path_relations():
976976
relations = [
@@ -979,7 +979,7 @@ <h3><code>PathPropertiesConstraint</code></h3>
979979
return relations
980980

981981
PATH_MAPPING = {
982-
"/birthdays/{month}/{date}": BirthdaysDto
982+
"/birthdays/{month}/{date}": BirthdaysMapping
983983
}
984984

985985
</code></pre></div>
@@ -999,7 +999,7 @@ <h3><code>IGNORE</code></h3>
999999
To prevent OpenApiLibCore from generating invalid combinations of path and query parameters in this type of endpoint, the <code class="language-python">IGNORE</code> special value can be used to ensure the related query parameter is never send in a request.
10001000

10011001
<div class="code-block"><pre><code class="language-python">
1002-
class EnergyLabelDto(Dto):
1002+
class EnergyLabelMapping(RelationsMapping):
10031003
@staticmethod
10041004
def get_parameter_relations():
10051005
relations = [
@@ -1018,8 +1018,8 @@ <h3><code>IGNORE</code></h3>
10181018
]
10191019
return relations
10201020

1021-
DTO_MAPPING = {
1022-
("/energy_label/{zipcode}/{home_number}", "get"): EnergyLabelDto,
1021+
RELATIONS_MAPPING = {
1022+
("/energy_label/{zipcode}/{home_number}", "get"): EnergyLabelMapping,
10231023
}
10241024

10251025
</code></pre></div>
@@ -1032,7 +1032,7 @@ <h3><code>IGNORE</code></h3>
10321032
Such situations can be handled by a mapping as shown below:
10331033
</p>
10341034
<div class="code-block"><pre><code class="language-python">
1035-
class PatchEmployeeDto(Dto):
1035+
class PatchEmployeeMapping(RelationsMapping):
10361036
@staticmethod
10371037
def get_parameter_relations() -> list[ResourceRelation]:
10381038
relations: list[ResourceRelation] = [
@@ -1051,8 +1051,8 @@ <h3><code>IGNORE</code></h3>
10511051
]
10521052
return relations
10531053

1054-
DTO_MAPPING = {
1055-
("/employees/{employee_id}", "patch"): PatchEmployeeDto,
1054+
RELATIONS_MAPPING = {
1055+
("/employees/{employee_id}", "patch"): PatchEmployeeMapping,
10561056
}
10571057

10581058
</code></pre></div>

docs/openapi_libcore.html

Lines changed: 378 additions & 401 deletions
Large diffs are not rendered by default.

docs/openapidriver.html

Lines changed: 378 additions & 401 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)