Exemple #1
0
        private void SerializeMethod(StringBuilder sb, Method method, int indentation)
        {
            sb.AppendLine((method.Verb + ":").Indent(indentation));
            RamlSerializerHelper.SerializeDescriptionProperty(sb, method.Description, indentation + 2);
            //SerializeType(sb, method.Type, indentation + 2);

            if (method.Headers != null)
            {
                sb.AppendLine("headers:".Indent(indentation + 2));
                foreach (var header in method.Headers)
                {
                    sb.AppendLine(header.Key + ":".Indent(indentation + 4));
                    RamlSerializerHelper.SerializeParameterProperties(sb, header.Value, indentation + 6);
                }
            }

            SerializeArrayProperty(sb, "is", method.Is, indentation + 2);
            SerializeProtocols(sb, method.Protocols, indentation + 2);
            SerializeArrayProperty(sb, "securedBy", method.SecuredBy, indentation + 2);
            SerializeParameters(sb, "baseUriParameters", method.BaseUriParameters, indentation + 2);
            SerializeParameters(sb, "queryParameters", method.QueryParameters, indentation + 2);
            SerializeBody(sb, method.Body, indentation + 2);
            SerializeResponses(sb, method.Responses, indentation + 2);
            raml1TypesSerializer.SerializeAnnotations(sb, method.Annotations, indentation + 2);
        }
Exemple #2
0
 private void SerializeMimeType(StringBuilder sb, KeyValuePair <string, MimeType> mimeType, int indentation)
 {
     sb.AppendLine((mimeType.Key + ":").Indent(indentation));
     RamlSerializerHelper.SerializeDescriptionProperty(sb, mimeType.Value.Description, indentation + 2);
     RamlSerializerHelper.SerializeProperty(sb, "type", mimeType.Value.Type, indentation + 2);
     SerializeParameters(sb, "formParameters", mimeType.Value.FormParameters, indentation + 2);
     RamlSerializerHelper.SerializeProperty(sb, "schema", mimeType.Value.Schema, indentation + 2);
     RamlSerializerHelper.SerializeProperty(sb, "example", mimeType.Value.Example, indentation + 2);
     raml1TypesSerializer.SerializeAnnotations(sb, mimeType.Value.Annotations, indentation + 2);
 }
Exemple #3
0
 private void SerializeResource(StringBuilder sb, Resource resource, int indentation)
 {
     sb.AppendLine((resource.RelativeUri + ":").Indent(indentation));
     SerializeParameters(sb, "baseUriParameters", resource.BaseUriParameters, indentation + 2);
     RamlSerializerHelper.SerializeDescriptionProperty(sb, resource.Description, indentation + 2);
     RamlSerializerHelper.SerializeProperty(sb, "displayName", resource.DisplayName, indentation + 2);
     SerializeProtocols(sb, resource.Protocols, indentation + 2);
     SerializeParameters(sb, "uriParameters", resource.UriParameters, indentation + 2);
     SerializeMethods(sb, resource.Methods, indentation + 2);
     //SerializeType(sb, resource.Type, indentation + 2);
     SerializeResources(sb, resource.Resources, indentation + 2);
     raml1TypesSerializer.SerializeAnnotations(sb, resource.Annotations, indentation + 2);
 }
Exemple #4
0
        private void SerializeSecurityScheme(StringBuilder sb, IDictionary <string, SecurityScheme> scheme, int indent)
        {
            foreach (var securityScheme in scheme)
            {
                sb.AppendLine(("- " + securityScheme.Key + ":").Indent(indent));
                RamlSerializerHelper.SerializeDescriptionProperty(sb, securityScheme.Value.Description, indent + 4);
                if (securityScheme.Value.Type != null && securityScheme.Value.Type.Any())
                {
                    RamlSerializerHelper.SerializeProperty(sb, "type", securityScheme.Value.Type.First().Key, indent + 4);
                }

                SerializeSecurityDescriptor(sb, securityScheme.Value.DescribedBy, indent + 4);
                SerializeSecuritySettings(sb, securityScheme.Value.Settings, indent + 4);
            }
        }
Exemple #5
0
 private void SerializeResponse(StringBuilder sb, Response response, int indentation)
 {
     sb.AppendLine(response.Code.Indent(indentation) + ":");
     RamlSerializerHelper.SerializeDescriptionProperty(sb, response.Description, indentation + 2);
     SerializeBody(sb, response.Body, indentation + 2);
 }