Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions and actions as interfaces #228

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
db7851b
Functions and actions as interfaces
HeikoTheissen Sep 22, 2023
20f34f7
Added test case
HeikoTheissen Sep 22, 2023
35fc526
ImplementsInterface contains a qualified name
HeikoTheissen Sep 22, 2023
469945f
Core.QualifiedName does not exist
HeikoTheissen Sep 22, 2023
5ed5187
rephrased
HeikoTheissen Sep 22, 2023
0d42e84
No trailing spaces
HeikoTheissen Sep 22, 2023
70f1532
Implements
HeikoTheissen Sep 22, 2023
285d2a3
Allow annotation of implementation references
HeikoTheissen Sep 22, 2023
175e47f
Same qualifier
HeikoTheissen Sep 22, 2023
6ea912c
name -> qualified name
HeikoTheissen Sep 25, 2023
5e8deb2
Don't demand qualifiers
HeikoTheissen Sep 26, 2023
b920fb8
Equivalent signature
HeikoTheissen Sep 27, 2023
c892227
Added example
HeikoTheissen Sep 27, 2023
91267ff
Merge remote-tracking branch 'origin/Core.IsInterface' into
HeikoTheissen Sep 27, 2023
6dafaeb
Definition of equivalence
HeikoTheissen Sep 27, 2023
69096aa
Merge branch 'Core.IsInterface' into Core.IsInterface-equivalence
HeikoTheissen Sep 27, 2023
6a1f9a0
Markdown formatting of examples
HeikoTheissen Sep 27, 2023
83c139f
typo
HeikoTheissen Sep 27, 2023
34d2148
Consider overloads
HeikoTheissen Sep 27, 2023
f2f188a
typo
HeikoTheissen Sep 27, 2023
b08ecc3
Pass tests
HeikoTheissen Sep 27, 2023
f201ff2
Merge remote-tracking branch 'origin/Core.IsInterface' into
HeikoTheissen Sep 27, 2023
a0a04ad
Interface -> Signature
HeikoTheissen Sep 27, 2023
10f7e50
-optional parameter
HeikoTheissen Sep 28, 2023
bcfac70
Merge branch 'Core.IsInterface-equivalence' into Core.IsInterface
HeikoTheissen Sep 28, 2023
1aa7131
No parameter renaming in example
HeikoTheissen Sep 28, 2023
0d7020b
Additional return type property
HeikoTheissen Sep 28, 2023
e2e2dab
Derived types with undescribed properties
HeikoTheissen Sep 28, 2023
8fc6c04
Merge branch 'fix/derived-type-w-o-description' into Core.IsInterface
HeikoTheissen Sep 28, 2023
3ae65c6
Merge remote-tracking branch 'origin/main' into Core.IsInterface
HeikoTheissen Sep 28, 2023
1c4f4a1
Signatures italicized
HeikoTheissen Oct 2, 2023
fcd2425
updated example
HeikoTheissen Oct 11, 2023
c20ffee
non-nullable binding parameter
HeikoTheissen Oct 11, 2023
00203d7
Changed example
HeikoTheissen Oct 12, 2023
0af13e6
Merge remote-tracking branch 'origin/main' into Core.IsInterface
HeikoTheissen Nov 24, 2023
c20a875
rephrased
HeikoTheissen Nov 24, 2023
914f640
@ralfhandl's suggestion
HeikoTheissen Nov 24, 2023
87bae7b
Implementations can consist of several overloads
HeikoTheissen Dec 15, 2023
87dd77d
Merge branch 'main' into Core.IsInterface
ralfhandl Dec 15, 2023
34b1eaf
Avoid leading <br>
HeikoTheissen Jan 9, 2024
50a7a1c
Feedback from TC 2024-01-10
HeikoTheissen Jan 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions examples/Org.OData.Core.V1.IsSignature-equivalence.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"$Version": "4.0",
"$Reference": {
"https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.json": {
"$Include": [
{
"$Namespace": "Org.OData.Core.V1",
"$Alias": "Core"
}
]
},
"https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Measures.V1.json": {
"$Include": [
{
"$Namespace": "Org.OData.Measures.V1",
"$Alias": "Measures"
}
]
},
"/SalesDocument.svc/$metadata": {
"$Include": [
{
"$Namespace": "SalesDocument",
"$Alias": "service"
}
]
}
},
"signature.sample": {
"$Alias": "self",
"@Core.LongDescription": "The [implementation](#ReturnsOrderWeight) differs from the [signature](#SalesDocumentWeight) in the following allowed ways:\n- Specialized binding parameter type from `Edm.EntityType` to a concrete entity type\n- Specialized return type from [`self.QuantityUnitType`](#QuantityUnitType) to [`self.ReturnsOrderWeightType`](#ReturnsOrderWeightType)\n - Removed nullability of return type property `Unit`\n - Additional return type property `PackagingWeight` (could be ignored by the client)",
"SalesDocumentWeight": [
{
"$Kind": "Function",
"$IsBound": true,
"@Core.IsSignature": true,
"@Core.Description": "Determines the total weight of the goods in a sales document",
"$Parameter": [
{
"$Name": "SalesDocument",
"$Type": "Edm.EntityType"
}
],
"$ReturnType": {
"$Type": "self.QuantityUnitType"
}
}
],
"QuantityUnitType": {
"$Kind": "ComplexType",
"Quantity": {
"$Type": "Edm.Decimal",
"$Scale": 0,
"@Measures.Unit": {
"$Path": "Unit"
}
},
"Unit": {
"$Nullable": true
}
},
"ReturnsOrderWeight": [
{
"$Kind": "Function",
"$IsBound": true,
"@Core.ImplementsSignature": "self.SalesDocumentWeight",
"$Parameter": [
{
"$Name": "SalesDocument",
"$Type": "service.ReturnsOrderType"
}
],
"$ReturnType": {
"$Type": "self.ReturnsOrderWeightType"
}
}
],
"ReturnsOrderWeightType": {
"$Kind": "ComplexType",
"$BaseType": "self.QuantityUnitType",
"Unit": {},
"PackagingWeight": {
"$Type": "Edm.Decimal",
"$Scale": 0,
"@Measures.Unit": {
"$Path": "Unit"
}
}
}
}
}
58 changes: 58 additions & 0 deletions examples/Org.OData.Core.V1.IsSignature-equivalence.md
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a valid example for allowed differences between signature and implementation?

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
**Namespace: [signature.sample](Org.OData.Core.V1.IsSignature-equivalence.xml)**



The [implementation](#ReturnsOrderWeight) differs from the [signature](#SalesDocumentWeight) in the following allowed ways:
- Specialized binding parameter type from `Edm.EntityType` to a concrete entity type
- Specialized return type from [`self.QuantityUnitType`](#QuantityUnitType) to [`self.ReturnsOrderWeightType`](#ReturnsOrderWeightType)
- Removed nullability of return type property `Unit`
- Additional return type property `PackagingWeight` (could be ignored by the client)


## Functions

<a name="SalesDocumentWeight"></a>
### [*SalesDocumentWeight*](./Org.OData.Core.V1.IsSignature-equivalence.xml#L23:~:text=<Function%20Name="-,SalesDocumentWeight,-")

**Signature only:**
Determines the total weight of the goods in a sales document

Parameter|Type|Description
:--------|:---|:----------
**[SalesDocument](./Org.OData.Core.V1.IsSignature-equivalence.xml#L26:~:text=<Function%20Name="-,SalesDocumentWeight,-")**|EntityType|**Binding parameter**
[&rarr;](./Org.OData.Core.V1.IsSignature-equivalence.xml#L27:~:text=<Function%20Name="-,SalesDocumentWeight,-")|[QuantityUnitType](#QuantityUnitType)|


<a name="ReturnsOrderWeight"></a>
### [ReturnsOrderWeight](./Org.OData.Core.V1.IsSignature-equivalence.xml#L36:~:text=<Function%20Name="-,ReturnsOrderWeight,-")

**Implements [SalesDocumentWeight](#SalesDocumentWeight)**


Parameter|Type|Description
:--------|:---|:----------
**[SalesDocument](./Org.OData.Core.V1.IsSignature-equivalence.xml#L38:~:text=<Function%20Name="-,ReturnsOrderWeight,-")**|[ReturnsOrderType](#ReturnsOrderType)|**Binding parameter**
[&rarr;](./Org.OData.Core.V1.IsSignature-equivalence.xml#L39:~:text=<Function%20Name="-,ReturnsOrderWeight,-")|[ReturnsOrderWeightType](#ReturnsOrderWeightType)|


<a name="QuantityUnitType"></a>
## [QuantityUnitType](./Org.OData.Core.V1.IsSignature-equivalence.xml#L29:~:text=<ComplexType%20Name="-,QuantityUnitType,-")


**Derived Types:**
- [ReturnsOrderWeightType](#ReturnsOrderWeightType)

Property|Type|Description
:-------|:---|:----------
[Quantity](./Org.OData.Core.V1.IsSignature-equivalence.xml#L30:~:text=<ComplexType%20Name="-,QuantityUnitType,-")|Decimal|
[Unit](./Org.OData.Core.V1.IsSignature-equivalence.xml#L33:~:text=<ComplexType%20Name="-,QuantityUnitType,-")|String?|

<a name="ReturnsOrderWeightType"></a>
## [ReturnsOrderWeightType](./Org.OData.Core.V1.IsSignature-equivalence.xml#L41:~:text=<ComplexType%20Name="-,ReturnsOrderWeightType,-"): [QuantityUnitType](#QuantityUnitType)


Property|Type|Description
:-------|:---|:----------
[*Quantity*](./Org.OData.Core.V1.IsSignature-equivalence.xml#L30:~:text=<ComplexType%20Name="-,QuantityUnitType,-")|Decimal|
[Unit](./Org.OData.Core.V1.IsSignature-equivalence.xml#L42:~:text=<ComplexType%20Name="-,ReturnsOrderWeightType,-")|String|
[PackagingWeight](./Org.OData.Core.V1.IsSignature-equivalence.xml#L43:~:text=<ComplexType%20Name="-,ReturnsOrderWeightType,-")|Decimal|
50 changes: 50 additions & 0 deletions examples/Org.OData.Core.V1.IsSignature-equivalence.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Namespace="Org.OData.Core.V1" Alias="Core" />
</edmx:Reference>
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Measures.V1.xml">
<edmx:Include Namespace="Org.OData.Measures.V1" Alias="Measures" />
</edmx:Reference>
<edmx:Reference Uri="/SalesDocument.svc/$metadata">
<edmx:Include Namespace="SalesDocument" Alias="service" />
</edmx:Reference>
<edmx:DataServices>
<Schema Namespace="signature.sample" Alias="self" xmlns="http://docs.oasis-open.org/odata/ns/edm">

<Annotation Term="Core.LongDescription">
<String>The [implementation](#ReturnsOrderWeight) differs from the [signature](#SalesDocumentWeight) in the following allowed ways:
- Specialized binding parameter type from `Edm.EntityType` to a concrete entity type
- Specialized return type from [`self.QuantityUnitType`](#QuantityUnitType) to [`self.ReturnsOrderWeightType`](#ReturnsOrderWeightType)
- Removed nullability of return type property `Unit`
- Additional return type property `PackagingWeight` (could be ignored by the client)</String>
</Annotation>

<Function Name="SalesDocumentWeight" IsBound="true">
<Annotation Term="Core.IsSignature" />
<Annotation Term="Core.Description" String="Determines the total weight of the goods in a sales document" />
<Parameter Name="SalesDocument" Type="Edm.EntityType" Nullable="false" />
<ReturnType Type="self.QuantityUnitType" Nullable="false" />
</Function>
<ComplexType Name="QuantityUnitType">
<Property Name="Quantity" Type="Edm.Decimal" Nullable="false">
<Annotation Term="Measures.Unit" Path="Unit" />
</Property>
<Property Name="Unit" Type="Edm.String" Nullable="true" />
</ComplexType>

<Function Name="ReturnsOrderWeight" IsBound="true">
<Annotation Term="Core.ImplementsSignature" String="self.SalesDocumentWeight" />
<Parameter Name="SalesDocument" Type="service.ReturnsOrderType" Nullable="false" />
<ReturnType Type="self.ReturnsOrderWeightType" Nullable="false" />
</Function>
<ComplexType Name="ReturnsOrderWeightType" BaseType="self.QuantityUnitType">
<Property Name="Unit" Type="Edm.String" Nullable="false" />
<Property Name="PackagingWeight" Type="Edm.Decimal" Nullable="false">
<Annotation Term="Measures.Unit" Path="Unit" />
</Property>
</ComplexType>

</Schema>
</edmx:DataServices>
</edmx:Edmx>
Loading