Is generating API from codegen a good practice? - api-design

Im writing a new set of APIs mostly in golang and traditionally we have been writing the API and generating the swagger specs for it. However, I bumped into swagger codegen recently. I think it is a good way to manage APIs. This also ensures that our Swagger is always updated.
Do you think there are any disadvantages to using codegen to generate APIs? Can someone point me to articles for pros and cons?

Related

Does all features belongs to Django Rest Framework available in FAST API to develop REST APIS

I have been working in the Django rest framework since three years on wards. Recently reading about FAST API frame work. FAST API looking like a very good framework for the current REST API service development. Seems like few things are missing from FAST API which are there in django.
Pagination
class based views.
mock testing
class based views.
struggled allot to provide the lookup for encrypted data in the django rest framework.
Could any one help me that how can we achieve above features with FAST API.
Currently in Jan 2020. FastAPI has a much smaller and different featureset to Django Rest Framework (DRF).
DRF is built on Django you have all the features Django available to you as well as convenient tools for building REST API's.
With FastAPI the framework way is more minimal it provides a simple, quick way to create and test a set of OpenAPI compatible endpoints. With a focus on speed and asynchronous style request-response handling.
However does not include ORM or migrations, admin, accounts etc and all the other 'batteries included' stuff you get with Django.
To achieve the functionality you have listed you'd right now you'd have to roll-your-own or use some pre-existing async python packages and adapt for your needs.

How to implement ElasticSearch with asp.net web application?

I have read the documentation of ElasticSearch and I am familiar with its endpoints and how to maintain Clusters,Nodes,Indices,etc.
Now I am planning to use it in an Asp.net web api and I am a little bit confused about what is the best way to implement it.
I found that ElasticSearch provides two options to work with .Net application:
1)Nest
2)ElasticSearch.net
So, my first question which way is preferred to integrate my web application with ElasticSearch so I can get advantage of the power of Elasticsearch in searching/analyzing/managing big amount of data and what are the advantages and disadvantages of each one ?
My second question I have read that Nest is a high level client and Elasticsearch.net is a low level one.What does that mean?
My third question do the above libraries expose all ElasticSearch endpoints or are there limitations?
My fourth question is there another way to integrate ElasticSearch in my web application other than the above two libraries?
I would appreciate any references,tutorials so I can get started with(because the documentation of ElasticSearch website is not clear).
Check out the documentation for the .NET clients as I think it answers all your questions.
Both NEST and Elasticsearch.Net expose all of the APIs within Elasticsearch, with the former mapping each request and response to a type so you don't need to do this yourself.
You can of course write your own implementation to interact with Elasticsearch over HTTP. Use whichever you're most comfortable with, but personally I'd recommend starting with NEST as it handles a lot of things for you such as mapping inference, connection behaviour with round-robin, etc. (disclaimer: I work on the Elasticsearch .NET clients).
For an example tutorial of integrating with a .NET (Nancy) web application, check out NuSearch.

Is the swagger api tied to spring-boot?

It isn't clear to me from the swagger-api docs but most of the examples I'm seeing online using both Spring-MVC and Swagger seem to be also using Spring-Boot. Are the two inherently tied together, or is this just a correlation in the user community?

Method for generating .net client code for a REST based web api

I'd like to access some web api's using .net code, but am not sure if there's a way to generate a client side wrapper of some kind for these? Perhaps a code generator that can look at the web api documentation or through sample calls and generated .net classes and methods to encapsulate the api?
There isn't. REST-based APIs do not have a WSDL or service contract that could be used to generate a client stub.
That said, consider the following alternatives:
REST Coder: this is interesting research but no definitive tools yet.
Google for .NET WCF REST client: it turns up a lot of interesting results.
As far as I know, there isn't.
However, you can try one of the many wrappers available, that makes your life easier once you have to write less code.
Check this one out I've written a few months ago:
http://webapiclient.azurewebsites.net

Backbone.js, ASP.NET, WCF Service, JSON

I'm about to create a small web app on Asp.Net 3.5.
Thought this time maybe I should try using Backbone.js..
Is it practical/easy to implement?
I've just spent the whole day trying to set up a WCF Service to return Json without positive results.
I would love to hear the best path for implementation from someone who has already used Backbone.js with Asp.Net.
Alternatively I would love to hear of alternatives that are easy to integrate with Asp.Net.
I've just spent the whole day trying to set up a WCF Service to return
Json without positive results.
Take a look at this tutorial, is short and straight to the point.
Thought this time maybe I should try using Backbone.js.. Is it
practical/easy to implement?
Well... as usual, it basically depend on what you want to do. Backbone can help you if you want to implement the MVC pattern in your client-side code, but it requires some time to get into the APIs so if your goal for the moment is just to create and consume a WCF service using Javascript you could consider using jQuery or MooTools and then switch to Backbone if you need.
PS
Here and here you'll find two quickstart backbone tutorials.
Use the REST Singleton Service template in the WCF REST Starter Kit Project Templates to get WCF with JSON support up and running quickly.

Resources