예제 #1
0
        private void FindSchema(OpenApiMediaTypeEx content)
        {
            JToken token = Docs[SchemasKey].First;

            while (token is JProperty prop && prop.Name != content.SchemaExt.JsonRef)
            {
                token = token.Next;
            }
            if (token is JProperty p && p.Name == content.SchemaExt.JsonRef)
            {
                content.Schema = token.First?.ToObject <OpenApiSchema>(_serializer);
            }
        }
예제 #2
0
        private Dictionary <string, OpenApiMediaType> CreateContent(Response response)
        {
            OpenApiMediaTypeEx content = response?.Content[MediaTypeNames.Application.Json];
            var ret = new Dictionary <string, OpenApiMediaType>();

            if (content != null)
            {
                if (!content.SchemaExt.IsReference)
                {
                    content.SetSchema();
                }
                else
                {
                    FindSchema(content);
                }

                ret.Add(MediaTypeNames.Application.Json, content);
            }

            return(ret);
        }