Skip to content

fixes #46: sync vocabularies folder using the updated OData.Edm; Supp… #47

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
<None Remove="Microsoft.OData.ModelBuilder.xml" />
<None Remove="Microsoft.OData.ModelBuilder.*.nuspec" />
<None Remove="obj\**\Microsoft.OData.ModelBuilder.version.cs" />
<None Remove="Vocabularies\VocabularyTermConfigurationExtensions.tt" />
</ItemGroup>

<ItemGroup>
<Compile Remove="Vocabularies\VocabularyTermConfigurationExtensions.tt" />
</ItemGroup>

<ItemGroup>
Expand All @@ -34,11 +39,6 @@
<AutoGen>True</AutoGen>
<DependentUpon>SRResources.resx</DependentUpon>
</Compile>
<Compile Update="Vocabularies\VocabularyTermConfigurationExtensions.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>VocabularyTermConfigurationExtensions.tt</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
Expand All @@ -48,13 +48,6 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Update="Vocabularies\VocabularyTermConfigurationExtensions.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>VocabularyTermConfigurationExtensions.cs</LastGenOutput>
</None>
</ItemGroup>

<ItemGroup>
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
</ItemGroup>
Expand Down
530 changes: 484 additions & 46 deletions src/Microsoft.OData.ModelBuilder/Microsoft.OData.ModelBuilder.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public partial class DeleteRestrictionsConfiguration : VocabularyTermConfigurati
private readonly HashSet<CustomParameterConfiguration> _customQueryOptions = new HashSet<CustomParameterConfiguration>();
private string _description;
private string _longDescription;
private readonly HashSet<HttpResponseConfiguration> _errorResponses = new HashSet<HttpResponseConfiguration>();

/// <inheritdoc/>
public override string TermName => "Org.OData.Capabilities.V1.DeleteRestrictions";
Expand Down Expand Up @@ -77,7 +78,7 @@ public DeleteRestrictionsConfiguration HasMaxLevels(int maxLevels)
}

/// <summary>
/// Members of collections can be updated via a PATCH request with a `/$filter(...)/$each` segment
/// Members of collections can be deleted via a DELETE request with a `/$filter(...)/$each` segment
/// </summary>
/// <param name="filterSegmentSupported">The value to set</param>
/// <returns><see cref="DeleteRestrictionsConfiguration"/></returns>
Expand All @@ -88,7 +89,7 @@ public DeleteRestrictionsConfiguration IsFilterSegmentSupported(bool filterSegme
}

/// <summary>
/// Members of collections can be updated via a PATCH request with a type-cast segment and a `/$each` segment
/// Members of collections can be deleted via a DELETE request with a type-cast segment and a `/$each` segment
/// </summary>
/// <param name="typecastSegmentSupported">The value to set</param>
/// <returns><see cref="DeleteRestrictionsConfiguration"/></returns>
Expand Down Expand Up @@ -179,7 +180,7 @@ public DeleteRestrictionsConfiguration HasDescription(string description)
}

/// <summary>
/// A lengthy description of the request
/// A long description of the request
/// </summary>
/// <param name="longDescription">The value to set</param>
/// <returns><see cref="DeleteRestrictionsConfiguration"/></returns>
Expand All @@ -189,6 +190,29 @@ public DeleteRestrictionsConfiguration HasLongDescription(string longDescription
return this;
}

/// <summary>
/// Possible error responses returned by the request.
/// </summary>
/// <param name="errorResponsesConfiguration">The configuration to set</param>
/// <returns><see cref="DeleteRestrictionsConfiguration"/></returns>
public DeleteRestrictionsConfiguration HasErrorResponses(Func<HttpResponseConfiguration, HttpResponseConfiguration> errorResponsesConfiguration)
{
var instance = new HttpResponseConfiguration();
instance = errorResponsesConfiguration?.Invoke(instance);
return HasErrorResponses(instance);
}

/// <summary>
/// Possible error responses returned by the request.
/// </summary>
/// <param name="errorResponses">The value(s) to set</param>
/// <returns><see cref="DeleteRestrictionsConfiguration"/></returns>
public DeleteRestrictionsConfiguration HasErrorResponses(params HttpResponseConfiguration[] errorResponses)
{
_errorResponses.UnionWith(errorResponses);
return this;
}

/// <inheritdoc/>
public override IEdmExpression ToEdmExpression()
{
Expand Down Expand Up @@ -260,6 +284,15 @@ public override IEdmExpression ToEdmExpression()
properties.Add(new EdmPropertyConstructor("LongDescription", new EdmStringConstant(_longDescription)));
}

if (_errorResponses.Any())
{
var collection = _errorResponses.Select(item => item.ToEdmExpression()).Where(item => item != null);
if (collection.Any())
{
properties.Add(new EdmPropertyConstructor("ErrorResponses", new EdmCollectionExpression(collection)));
}
}

properties.AddRange(_dynamicProperties.ToEdmProperties());

if (!properties.Any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public ExpandRestrictionsConfiguration IsExpandable(bool expandable)
}

/// <summary>
/// $expand is supported for stream properties and media resources
/// $expand is supported for stream properties and media streams
/// </summary>
/// <param name="streamsExpandable">The value to set</param>
/// <returns><see cref="ExpandRestrictionsConfiguration"/></returns>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// This is an auto generated file. Please run the template to modify it.
// <auto-generated />

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.OData.Edm;
using Microsoft.OData.Edm.Vocabularies;

namespace Microsoft.OData.ModelBuilder.Capabilities.V1
{
/// <summary>
/// Org.OData.Capabilities.V1.HttpResponse
/// </summary>
public partial class HttpResponseConfiguration : IRecord
{
private readonly Dictionary<string, object> _dynamicProperties = new Dictionary<string, object>();
private string _statusCode;
private string _description;

/// <summary>
/// Creates a new instance of <see cref="HttpResponseConfiguration"/>
/// </summary>
public HttpResponseConfiguration()
{
}

/// <summary>
/// Dynamic properties.
/// </summary>
/// <param name="name">The name to set</param>
/// <param name="value">The value to set</param>
/// <returns><see cref="HttpResponseConfiguration"/></returns>
public HttpResponseConfiguration HasDynamicProperty(string name, object value)
{
_dynamicProperties[name] = value;
return this;
}

/// <summary>
/// HTTP response status code, for example 400, 403, 501
/// </summary>
/// <param name="statusCode">The value to set</param>
/// <returns><see cref="HttpResponseConfiguration"/></returns>
public HttpResponseConfiguration HasStatusCode(string statusCode)
{
_statusCode = statusCode;
return this;
}

/// <summary>
/// Human-readable description of the response
/// </summary>
/// <param name="description">The value to set</param>
/// <returns><see cref="HttpResponseConfiguration"/></returns>
public HttpResponseConfiguration HasDescription(string description)
{
_description = description;
return this;
}

/// <inheritdoc/>
public IEdmExpression ToEdmExpression()
{
var properties = new List<IEdmPropertyConstructor>();

if (!string.IsNullOrEmpty(_statusCode))
{
properties.Add(new EdmPropertyConstructor("StatusCode", new EdmStringConstant(_statusCode)));
}

if (!string.IsNullOrEmpty(_description))
{
properties.Add(new EdmPropertyConstructor("Description", new EdmStringConstant(_description)));
}

properties.AddRange(_dynamicProperties.ToEdmProperties());

if (!properties.Any())
{
return null;
}

return new EdmRecordExpression(properties);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public partial class InsertRestrictionsConfiguration : VocabularyTermConfigurati
private readonly HashSet<CustomParameterConfiguration> _customQueryOptions = new HashSet<CustomParameterConfiguration>();
private string _description;
private string _longDescription;
private readonly HashSet<HttpResponseConfiguration> _errorResponses = new HashSet<HttpResponseConfiguration>();

/// <inheritdoc/>
public override string TermName => "Org.OData.Capabilities.V1.InsertRestrictions";
Expand Down Expand Up @@ -215,7 +216,7 @@ public InsertRestrictionsConfiguration HasDescription(string description)
}

/// <summary>
/// A lengthy description of the request
/// A long description of the request
/// </summary>
/// <param name="longDescription">The value to set</param>
/// <returns><see cref="InsertRestrictionsConfiguration"/></returns>
Expand All @@ -225,6 +226,29 @@ public InsertRestrictionsConfiguration HasLongDescription(string longDescription
return this;
}

/// <summary>
/// Possible error responses returned by the request.
/// </summary>
/// <param name="errorResponsesConfiguration">The configuration to set</param>
/// <returns><see cref="InsertRestrictionsConfiguration"/></returns>
public InsertRestrictionsConfiguration HasErrorResponses(Func<HttpResponseConfiguration, HttpResponseConfiguration> errorResponsesConfiguration)
{
var instance = new HttpResponseConfiguration();
instance = errorResponsesConfiguration?.Invoke(instance);
return HasErrorResponses(instance);
}

/// <summary>
/// Possible error responses returned by the request.
/// </summary>
/// <param name="errorResponses">The value(s) to set</param>
/// <returns><see cref="InsertRestrictionsConfiguration"/></returns>
public InsertRestrictionsConfiguration HasErrorResponses(params HttpResponseConfiguration[] errorResponses)
{
_errorResponses.UnionWith(errorResponses);
return this;
}

/// <inheritdoc/>
public override IEdmExpression ToEdmExpression()
{
Expand Down Expand Up @@ -314,6 +338,15 @@ public override IEdmExpression ToEdmExpression()
properties.Add(new EdmPropertyConstructor("LongDescription", new EdmStringConstant(_longDescription)));
}

if (_errorResponses.Any())
{
var collection = _errorResponses.Select(item => item.ToEdmExpression()).Where(item => item != null);
if (collection.Any())
{
properties.Add(new EdmPropertyConstructor("ErrorResponses", new EdmCollectionExpression(collection)));
}
}

properties.AddRange(_dynamicProperties.ToEdmProperties());

if (!properties.Any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Microsoft.OData.ModelBuilder.Capabilities.V1
{
/// <summary>
/// Stream property supports update of its media edit URL and/or media read URL
/// Stream property or media stream supports update of its media edit URL and/or media read URL
/// </summary>
public partial class MediaLocationUpdateSupportedConfiguration : VocabularyTermConfiguration
{
Expand All @@ -22,7 +22,7 @@ public partial class MediaLocationUpdateSupportedConfiguration : VocabularyTermC
public override string TermName => "Org.OData.Capabilities.V1.MediaLocationUpdateSupported";

/// <summary>
/// Stream property supports update of its media edit URL and/or media read URL
/// Stream property or media stream supports update of its media edit URL and/or media read URL
/// </summary>
/// <param name="mediaLocationUpdateSupported">The value to set</param>
/// <returns><see cref="MediaLocationUpdateSupportedConfiguration"/></returns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
namespace Microsoft.OData.ModelBuilder.Capabilities.V1
{
/// <summary>
/// Org.OData.Capabilities.V1.NavigationPropertyRestriction
/// Using a property of `NavigationPropertyRestriction` in a [`NavigationRestrictions`](#NavigationRestrictions) annotation
/// is discouraged in favor of using an annotation with the corresponding term from this vocabulary and a target path starting with a container and ending in the `NavigationProperty`,
/// unless the favored alternative is impossible because a dynamic expression requires an instance path whose evaluation
/// starts at the target of the `NavigationRestrictions` annotation. See [this example](../examples/Org.OData.Capabilities.V1.capabilities.md).
/// </summary>
public partial class NavigationPropertyRestrictionConfiguration : IRecord
{
Expand Down Expand Up @@ -56,6 +59,10 @@ public NavigationPropertyRestrictionConfiguration HasDynamicProperty(string name

/// <summary>
/// Navigation properties can be navigated
/// The target path of a [`NavigationRestrictions`](#NavigationRestrictions) annotation followed by this
/// navigation property path addresses the resource to which the other properties of `NavigationPropertyRestriction` apply.
/// Instance paths that occur in dynamic expressions are evaluated starting at the boundary between both paths,
/// which must therefore be chosen accordingly.
/// </summary>
/// <param name="navigationProperty">The value to set</param>
/// <returns><see cref="NavigationPropertyRestrictionConfiguration"/></returns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public partial class OperationRestrictionsConfiguration : VocabularyTermConfigur
private readonly HashSet<PermissionTypeConfiguration> _permissions = new HashSet<PermissionTypeConfiguration>();
private readonly HashSet<CustomParameterConfiguration> _customHeaders = new HashSet<CustomParameterConfiguration>();
private readonly HashSet<CustomParameterConfiguration> _customQueryOptions = new HashSet<CustomParameterConfiguration>();
private readonly HashSet<HttpResponseConfiguration> _errorResponses = new HashSet<HttpResponseConfiguration>();

/// <inheritdoc/>
public override string TermName => "Org.OData.Capabilities.V1.OperationRestrictions";
Expand Down Expand Up @@ -117,6 +118,29 @@ public OperationRestrictionsConfiguration HasCustomQueryOptions(params CustomPar
return this;
}

/// <summary>
/// Possible error responses returned by the request.
/// </summary>
/// <param name="errorResponsesConfiguration">The configuration to set</param>
/// <returns><see cref="OperationRestrictionsConfiguration"/></returns>
public OperationRestrictionsConfiguration HasErrorResponses(Func<HttpResponseConfiguration, HttpResponseConfiguration> errorResponsesConfiguration)
{
var instance = new HttpResponseConfiguration();
instance = errorResponsesConfiguration?.Invoke(instance);
return HasErrorResponses(instance);
}

/// <summary>
/// Possible error responses returned by the request.
/// </summary>
/// <param name="errorResponses">The value(s) to set</param>
/// <returns><see cref="OperationRestrictionsConfiguration"/></returns>
public OperationRestrictionsConfiguration HasErrorResponses(params HttpResponseConfiguration[] errorResponses)
{
_errorResponses.UnionWith(errorResponses);
return this;
}

/// <inheritdoc/>
public override IEdmExpression ToEdmExpression()
{
Expand Down Expand Up @@ -154,6 +178,15 @@ public override IEdmExpression ToEdmExpression()
}
}

if (_errorResponses.Any())
{
var collection = _errorResponses.Select(item => item.ToEdmExpression()).Where(item => item != null);
if (collection.Any())
{
properties.Add(new EdmPropertyConstructor("ErrorResponses", new EdmCollectionExpression(collection)));
}
}

properties.AddRange(_dynamicProperties.ToEdmProperties());

if (!properties.Any())
Expand Down
Loading