Swashbuckle.Swagger.SchemaRegistry.CreateInlineSchema C# (CSharp) Method

CreateInlineSchema() private method

private CreateInlineSchema ( Type type ) : Schema
type System.Type
return Schema
        private Schema CreateInlineSchema(Type type)
        {
            if (_customSchemaMappings.ContainsKey(type))
                return _customSchemaMappings[type]();

            var jsonContract = _contractResolver.ResolveContract(type);

            if (jsonContract is JsonPrimitiveContract)
            {
                var schema = CreatePrimitiveSchema((JsonPrimitiveContract)jsonContract);
                // SchemaExtensions.GetAttributeDetails(schema, type.GetProperty(jsonContract));
                return schema;
            }

            var dictionaryContract = jsonContract as JsonDictionaryContract;
            if (dictionaryContract != null)
                return dictionaryContract.IsSelfReferencing()
                    ? CreateRefSchema(type)
                    : CreateDictionarySchema(dictionaryContract);

            var arrayContract = jsonContract as JsonArrayContract;
            if (arrayContract != null)
                return arrayContract.IsSelfReferencing()
                    ? CreateRefSchema(type)
                    : CreateArraySchema(arrayContract);

            var objectContract = jsonContract as JsonObjectContract;
            if (objectContract != null && objectContract.IsInferrable())
                return CreateRefSchema(type);

            // Fallback to abstract "object"
            return CreateRefSchema(typeof(object));
        }