npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ayoka-ts-gen

v1.0.1

Published

## Overview This project is an extension to the Swagger codegen CLI tool for generating a typescript API layer on the frontend. it is mainly designed to be used with the apisauce and AyokaMobile CLI, since most of the mustache templates have hard-coded fo

Downloads

8

Readme

Swagger Codegen for the ayoka-typescript library

Overview

This project is an extension to the Swagger codegen CLI tool for generating a typescript API layer on the frontend. it is mainly designed to be used with the apisauce and AyokaMobile CLI, since most of the mustache templates have hard-coded folder values.

What's Swagger?

The goal of Swagger� is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service.

Check out OpenAPI-Spec for additional information about the Swagger project, including additional libraries with support for other languages and more.

How do I use this?

At this point, you've likely generated a client setup. It will include something along these lines:

.
|- README.md    // this file
|- pom.xml      // build script
|-- src
|--- main
|---- java
|----- io.swagger.codegen.AyokaTypescriptGenerator.java // generator file
|---- resources
|----- ayoka-typescript // template files
|----- META-INF
|------ services
|------- io.swagger.codegen.CodegenConfig

You will need to make changes in at least the following:

AyokaTypescriptGenerator.java

Templates in this folder:

src/main/resources/ayoka-typescript

Once modified, you can run this:

mvn package

In your generator project. A single jar file will be produced in target. You can now use that with codegen:

java -cp /path/to/swagger-codegen-cli.jar:/path/to/your.jar io.swagger.codegen.Codegen -l ayoka-typescript -i /path/to/swagger.yaml -o ./test

Now your templates are available to the client generator and you can write output values

But how do I modify this?

The AyokaTypescriptGenerator.java has comments in it--lots of comments. There is no good substitute for reading the code more, though. See how the AyokaTypescriptGenerator implements CodegenConfig. That class has the signature of all values that can be overridden.

For the templates themselves, you have a number of values available to you for generation. You can execute the java command from above while passing different debug flags to show the object you have available during client generation:

# The following additional debug options are available for all codegen targets:
# -DdebugSwagger prints the OpenAPI Specification as interpreted by the codegen
# -DdebugModels prints models passed to the template engine
# -DdebugOperations prints operations passed to the template engine
# -DdebugSupportingFiles prints additional data passed to the template engine

java -DdebugOperations -cp /path/to/swagger-codegen-cli.jar:/path/to/your.jar io.swagger.codegen.Codegen -l ayoka-typescript -i /path/to/swagger.yaml -o ./test

Will, for example, output the debug info for operations. You can use this info in the api.mustache file.

HOW TO DEPLOY TO NPM

**prerequisite - make sure jdeploy is installed on your machine

whenever you want to push a new version of this generator to npm:

  • Click createjar.bat in the root directory