@Override public void apply(Map<String, Object> configuration, RestDocumentationContext context) { WriterResolver resolverToUse = this.writerResolver; if (resolverToUse == null) { SnippetConfiguration snippetConfiguration = (SnippetConfiguration) configuration .get(SnippetConfiguration.class.getName()); resolverToUse = new StandardWriterResolver( new RestDocumentationContextPlaceholderResolverFactory(), snippetConfiguration.getEncoding(), snippetConfiguration.getTemplateFormat()); } configuration.put(WriterResolver.class.getName(), resolverToUse); }
public Operation build() { if (this.attributes.get(TemplateEngine.class.getName()) == null) { Map<String, Object> templateContext = new HashMap<>(); templateContext.put("tableCellContent", new AsciidoctorTableCellContentLambda()); this.attributes.put(TemplateEngine.class.getName(), new MustacheTemplateEngine( new StandardTemplateResourceResolver(this.templateFormat), Mustache.compiler().escapeHTML(false), templateContext)); } RestDocumentationContext context = createContext(); this.attributes.put(RestDocumentationContext.class.getName(), context); this.attributes.put(WriterResolver.class.getName(), new StandardWriterResolver( new RestDocumentationContextPlaceholderResolverFactory(), "UTF-8", this.templateFormat)); return new StandardOperation(this.name, ((this.requestBuilder == null) ? new OperationRequestBuilder("http://localhost/").buildRequest() : this.requestBuilder.buildRequest()), (this.responseBuilder == null) ? new OperationResponseBuilder().buildResponse() : this.responseBuilder.buildResponse(), this.attributes); }