public void GetModelType(string expected, OpenApiSchema openApiSchema)
        {
            // Act
            var actual = openApiSchema.GetModelType();

            // Assert
            Assert.Equal(expected, actual);
        }
Esempio n. 2
0
        private static bool IsModelOfTypeArray(OpenApiSchema schema, IDictionary <string, OpenApiSchema> modelSchemas)
        {
            var modelType = schema.GetModelType();

            if (modelType == null && schema.Reference.Id != null)
            {
                var(key, value) = modelSchemas.FirstOrDefault(x => x.Key.Equals(schema.Reference.Id, StringComparison.OrdinalIgnoreCase));
                if (key != null)
                {
                    return(value.Type != null && value.Type.EndsWith(OpenApiDataTypeConstants.Array, StringComparison.OrdinalIgnoreCase));
                }
            }

            return(modelType != null && modelType.EndsWith(OpenApiDataTypeConstants.Array, StringComparison.OrdinalIgnoreCase));
        }