Swagger is great for both documentation and the client code generation. I use it to generate clients for inter-service communication as well as for SPAs (best with TypeScript).
It's really best when your backend framework typically generates the Swagger definition from your API code, though. Spring, APIStar, and others will do this.