-
Notifications
You must be signed in to change notification settings - Fork 59
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
Properly handle type definitions elements in schema #103
Draft
habbes
wants to merge
24
commits into
OData:master
Choose a base branch
from
habbes:81-handle-type-definitions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes issue #81
The connected service could not generate code for the Outlook Beta API mentioned in the related issue due to 2 main issue:
Issue 1
The outlook beta API mentioned in the related issue contained the following type definition:
Apparently the code generator did not know how to handle such cases. It tried to generate its code as an
IEdmEntityType
, and that lead to null-reference exceptions. Similar issues occurred when translating function parameters that whose types are based on type definitions.This PR solves this issue in two ways:
E.g: a function defined in the schema as:
will be defined in the generated C# code as:
Note that using
MyNamespace.DateTime
as a type in the C# code would cause compile-time errors because there's no equivalent C# type generated for the type definition by the code generator.Issue 2
For edm types like
TimeOfDay
which are defined in the OData Edm library, the connected service was generating code in the wrong namespace, i.e. generatingMicrosoft.OData.Edm.Library.TimeOfDay
instead ofMicrosoft.OData.Edm.TimeOfDay
. It was probably generating code for an older version of the lib. The code generator itself uses an older version of edm lib (6.x). We should probably update it to 7.6 soon.PS:
I created this branch based on my other un-merged PR (pull #100) instead of the master branch because the master branch still does not have any tests suits. As soon as the other PR is merged, I'll remove the Draft status for this PR and mark it officially ready for review.