Simple API call within the context of DocFx preprocessor - ecmascript-5

I would like to know if it is possible to make a simple API call (e.g. GitHub API v3) within the context of a DocFx custom template preprocessor. I have been trying all sorts of different approaches, but nothing has fully worked so far.
My goal is to make a call to an API to retrieve some data, and then update the model accordingly to be used in the *.liquid or *.tmpl renderers.
I have tried using the http/https node modules. I have also tried using node-fetch. It results in a docfx build error something like:
Error:Error transforming model ".../index.raw.json" generated from
".../index.md" using "conceptual.html.primary.js". Error running
Transform function inside template preprocessor
According to DocFx documentation, preprocessors follow the ES 5.1 standard. My code conforms to this.
Does anyone know if this is possible?
By the way, I am able to do simple model manipulation just fine, so I understand the basic concepts here with the DocFx preprocessors.
Thanks!

For the benefit of others, I discovered DocFX uses jint which cannot require a Node library directly. Therefore, it appears the plugin route is a better way to go for this use case.

Related

Ansible CallbackBase result object content

Our dev team provides us an Ansible package to work with. I noticed thy develop a custom stdout_callback and I'm trying to understand it.
I'm looking at the code of the class CallbackBase available here and I noticed the result variable but I can't find a description of it's content.
Is there a place I can find such information?
Next question, how does Ansible call such callback? CallbackBase contains several methods but I'd like to know where those methods are called.
Thanks for your feedbacks

Claudia.js jasmine post/put body key

I'm using claudia-api-builder and attempting to write tests using jasmine-node. I'm using the proxyRouter on my API using this tutorial https://claudiajs.com/tutorials/testing-locally.html, and I can pass path parameters fine as demonstrated. However, I can't find what the key is for the body of the request.
For example it says
You can fill in the other properties (eg queryStringParameters)
according to what the test expects
But I can't find anywhere that lists the possible properties. The API Gateway Proxy Object link also doesn't seem to go to anything useful, as the sample doesn't seem to include a body.
Does anybody know what the key I should be using is? Thanks!
Worked it out - somewhat embarrassingly it's just body.

Configure Swagger api with Play 2.4

Facing problem while configuring swagger api with play 2.4 framework.
Follow this url for configuration : https://github.com/swagger-api/swagger-play/tree/master/play-2.4/swagger-play2
After configuration gets a compile time error with message "type ApiHelpController is not a member of package controllers" as this ApiHelpController.scala file is present in app/controllers package.
Does anyone knows what i am missing.
Not sure what you are missing but let me show you an alternative for swagger play 2.4 integration
Unlike the one you were trying to use, this one does not require annotation, you write swagger spec directly in your routes files as comment. There are several benefits of this approach:
controller remain clean
you don't need to repeat path and parameters
you don't need to learn another API (the annotation api)
Also it generates swagger definition from case classes reflection.
Check it out:
https://github.com/iheartradio/play-swagger
Not sure about swagger-jaxrs, but swagger-play2 package works for me. You can refer to http://swagger.io/playing-with-swagger-using-swagger-and-swagger-ui-with-the-play-framework/

How to specify SonarQube rule description as a markdown/html resource file instead of using annotation?

I have my custom rule, let's say with AEM-1 key. So, as it is done here, I make my AEM-1.html resource file with some simple html content and it does not get's picked up by SonarQube 5.1. It refuses to start, because no description is provided for the rule.
I tried different packages names, tried to look for convention in source code etc. What's missing? Is there any documentation on that?
The naming convention is org/sonar/l10n/{plugin key}_{language}/rules/{repository key}/{rule key}.html.
It was documented in http://docs.sonarqube.org/display/DEV/Internationalization at the time rule descriptions supported localization. That's not the case anymore since version 4.2, but these HTML bundles are still supported.
The correct way since version 4.3 is to use the low-level API org.sonar.api.server.rule.RulesDefinition. It allows you to implement any kind over layer over it (xml, json, annotations, ...).

IoC, MVC4 Web API & HttpParameterBinding/ParameterBindingAttribute

I'm using ASP.Net MVC 4 RTM Web API. I have a controller action with a parameter that I'd like to populate via custom model binding. To achieve this, I created a class that derives from System.Web.Http.Controllers.HttpParameterBinding that sets the value of this parameter. I then created an attribute class that derives from System.Web.Http.ParameterBindingAttribute which I use to decorate the parameter on my controller action.
This is all working great, my HttpParameterBinding class is populating the action parameter correctly. The problem I have is that my custom parameter binding class has a dependency that I'd like resolved via my IoC container (Unity). Is there a way to override how Web API creates HttpParameterBinding instances so that I can build up my custom binding class dependency from Unity? I was able to do something similar for a filter attribute by creating a custom filter provider that uses Unity's BuildUp method to populate dependencies, however I'm not seeing anything similar for Web API's HttpParameterBindings.
In general: to use IoC / Unity in the Web API you need to set it up seperately.
Try downloading the nuget package Unity.WebApi and see if that helps!
Take a look at this article: Parameter Binding in WebAPI
It walks through a couple different options from Converters to Binders to BinderProviders. It sounds like you may be able to write a custom ModelBinderProvider which knows how to provide your dependency. If that isn't high enough in the chain you can look at replacing the default IActionValueBinder service. It's a DefaultActionValueBinder instance, which you can extend or simply re-implement.
I also highly recommend downloading the WebAPI source code, as it's been an incredible help for these issues as I've run into them. Here's the WebAPI source code. I recommend downloading it so you can open it in VS for easy navigation.
Feel free to check out FlitBit too (It's very modular, don't let the number of packages scare you off)! I'm working on a WebAPI package for supporting FlitBit, specifically FlitBit.IoC and FlitBit.Dto. I'll add an update if I work out my IoC issue, since it's very similar to yours.