Example #1
0
        public string GetContainedItemTypeName(
            OpenApiMetadataResource openApiMetadataResource,
            ResourceChildItem resourceChildItem)
        {
            var schemaPrefix = resourceChildItem.SchemaProperCaseName;

            return(OpenApiMetadataDocumentHelper.CamelCaseSegments($"{schemaPrefix}_{resourceChildItem.Name}"));
        }
        public string GetReferenceName(ResourceClassBase openApiMetadataResource, Reference reference)
        {
            var schemaPrefix = openApiMetadataResource.Entity.DomainModel.SchemaNameMapProvider
                               .GetSchemaMapByPhysicalName(openApiMetadataResource.Entity.Schema)
                               .ProperCaseName;

            return(OpenApiMetadataDocumentHelper.CamelCaseSegments($"{schemaPrefix}_{reference.ReferenceTypeName}"));
        }
Example #3
0
        public string GetResourceName(Resource resource, IOpenApiMetadataResourceContext resourceContext)
        {
            var schemaPrefix = resource
                               .Entity
                               .DomainModel
                               .SchemaNameMapProvider
                               .GetSchemaMapByPhysicalName(resource.Entity.Schema)
                               .ProperCaseName;

            return(OpenApiMetadataDocumentHelper.CamelCaseSegments($"{schemaPrefix}_{resource.Name}"));
        }
        public string GetContainedItemTypeName(OpenApiMetadataResource openApiMetadataResource, ResourceChildItem resourceChildItem)
        {
            var name = resourceChildItem.IsDerivedFrom(openApiMetadataResource.Resource)
                ? CreateChildModelTypeName(
                openApiMetadataResource.Resource,
                resourceChildItem.Name,
                resourceChildItem.Parent)
                : resourceChildItem.Name;

            return
                (OpenApiMetadataDocumentHelper.CamelCaseSegments(
                     $"{resourceChildItem.SchemaProperCaseName}_{name}_{openApiMetadataResource.OperationNamingContext}"));
        }
        public string GetCollectionReferenceName(OpenApiMetadataResource openApiMetadataResource, Collection collection)
        {
            var name = collection.IsDerivedFrom(openApiMetadataResource.Resource)
                ? CreateChildModelTypeName(
                openApiMetadataResource.Resource,
                collection.ItemType.Name,
                collection.Parent)
                : collection.ItemType.Name;

            return
                (OpenApiMetadataDocumentHelper.CamelCaseSegments(
                     $"{collection.ItemType.SchemaProperCaseName}_{name}_{openApiMetadataResource.OperationNamingContext}"));
        }
Example #6
0
        public string GetCollectionReferenceName(
            OpenApiMetadataResource openApiMetadataResource,
            Collection collection)
        {
            var schemaPrefix = collection
                               .ItemType
                               .Entity
                               .DomainModel
                               .SchemaNameMapProvider
                               .GetSchemaMapByPhysicalName(collection.ItemType.Entity.Schema)
                               .ProperCaseName;

            return(OpenApiMetadataDocumentHelper.CamelCaseSegments($"{schemaPrefix}_{collection.ItemType.Name}"));
        }
Example #7
0
        public string GetEmbeddedObjectReferenceName(
            OpenApiMetadataResource openApiMetadataResource,
            EmbeddedObject embeddedObject)
        {
            var schemaPrefix = embeddedObject
                               .ObjectType
                               .Entity
                               .DomainModel
                               .SchemaNameMapProvider
                               .GetSchemaMapByPhysicalName(embeddedObject.ObjectType.Entity.Schema)
                               .ProperCaseName;

            return(OpenApiMetadataDocumentHelper.CamelCaseSegments($"{schemaPrefix}_{embeddedObject.ObjectType.Name}"));
        }
        public string GetResourceName(Resource resource, IOpenApiMetadataResourceContext resourceContext)
        {
            var name = resourceContext.ContextualResource == null
                ? string.Format(
                @"{0}_{1}_{2}",
                resource.SchemaProperCaseName,
                CompositeTermInflector.MakeSingular(resource.Name),
                resourceContext.OperationNamingContext)
                       .ToCamelCase()
                : string.Format(
                @"{0}_{1}_{2}_{3}",
                resource.SchemaProperCaseName,
                CompositeTermInflector.MakeSingular(resource.Name),
                resourceContext.ContextualResource.Name,
                resourceContext.OperationNamingContext);

            return(OpenApiMetadataDocumentHelper.CamelCaseSegments(name));
        }
Example #9
0
        private static string CreateCompositeChildModelTypeName(string resourceName, string childTypeName, ResourceClassBase containingResource)
        {
            if (containingResource is IHasParent)
            {
                return(OpenApiMetadataDocumentHelper.CamelCaseSegments(
                           string.Join(
                               "_",
                               ((IHasParent)containingResource)
                               .GetLineage()
                               .Select(x => x.Name.ToCamelCase())
                               .Concat(
                                   new[]
                {
                    childTypeName.ToCamelCase()
                }))));
            }

            return(OpenApiMetadataDocumentHelper.CamelCaseSegments($"{resourceName.ToCamelCase()}_{childTypeName.ToCamelCase()}"));
        }
Example #10
0
        public string GetResourceName(OpenApiMetadataResource openApiMetadataResource, ContentTypeUsage contentTypeUsage)
        {
            var schemaPrefix =
                openApiMetadataResource.Resource.Entity.DomainModel.SchemaNameMapProvider
                .GetSchemaMapByPhysicalName(openApiMetadataResource.Resource.Entity.Schema)
                .ProperCaseName;

            var name = openApiMetadataResource.ContextualResource == null
                ? string.Format(
                "{0}_{1}_{2}",
                schemaPrefix,
                CompositeTermInflector.MakeSingular(openApiMetadataResource.Resource.Name),
                contentTypeUsage)
                : string.Format(
                "{0}_{1}_{2}_{3}",
                schemaPrefix,
                CompositeTermInflector.MakeSingular(openApiMetadataResource.Resource.Name),
                openApiMetadataResource.ContextualResource.Name,
                contentTypeUsage);

            return(OpenApiMetadataDocumentHelper.CamelCaseSegments(name));
        }
 public string GetEmbeddedObjectReferenceName(OpenApiMetadataResource openApiMetadataResource, EmbeddedObject embeddedObject)
 {
     return
         (OpenApiMetadataDocumentHelper.CamelCaseSegments(
              $@"{embeddedObject.ObjectType.SchemaProperCaseName}_{embeddedObject.ObjectType.Name}_{openApiMetadataResource.OperationNamingContext}"));
 }
Example #12
0
        public string GetReferenceName(ResourceClassBase resource, Reference reference)
        {
            var schemaProperCaseName = reference.ReferencedResource.SchemaProperCaseName;

            return(OpenApiMetadataDocumentHelper.CamelCaseSegments($"{schemaProperCaseName}_{reference.ReferenceTypeName}"));
        }