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 🙏

© 2025 – Pkg Stats / Ryan Hefner

soil-schema

v0.2.3

Published

soil is schema language for REST and JSON api and swift / kotlin client code generator.

Downloads

4

Readme

soil

soil is schema language for REST and JSON api and swift / kotlin client code generator.

  • Short schema based REST api.
  • Small and flexible code generation.
  • Write and run api testing scenarios.

Other tools are more good if you want:

  • Speed: don't use JSON, use protobuf.
  • GraphQL: soil is not supporting GraphQL.
  • Complex api: use Open API Schema and around tools.

.soil file

Entity

Your REST resource is called Entity and defined by entity keyword in soil. For example, User resource on your REST api can is defined with .soil file.

entity User {

  field id: Integer
  mutable field name: String
}
  • entity: start of Entity.
  • User: entity name.
  • field id: Integer: User entity has id Integer property.
  • mutable field name: String: User entity has name mutable String property.

Single .soil file can contain multiple entity directives.

Endpoint

Entity has mapped any endpoints on REST api. Each entity directives can contain any endpoint directives.

entity User {

  ...

  endpoint GET /users {
    success {
      field users: List<User>
    }
  }
}
  • endpoint GET /users: Endpoint. This endpoint accessed by GET method and /users path.
  • success directive: successful response (status code 2xx) schema. like entity directive.
  • Recipe: Basic Endpoint

Request and writer entity

In the REST api, most of the time there are two types of resource fields: writable and read-only. In the POST and PUT methods, only the values of writable fields should be sent. soil handles this difference by separating "read-time Entity" and "write-time Entity".

entity User {

  field id: Integer
  mutable field name: String
}

If entity has mutable or writer field, entity has write-time mode. For example, this User entity exports as Swift code.

public final class User: Decodable {

    public let id: Int

    public var name: String

    public struct Writer: Encodable {

        public let name: String

        /// - Parameters:
        ///   - name: {no comment}
        public init(name: String) {
            self.name = name
        }
    }
}

User is read-time entity, User.Writer is write-time entity.

Others

Each recipe presents a specific sample of soil schema detailed features.

Installation

soil is written by nodejs and managed by npm.

$ npm install -g soil-schema

Scenario runner

soil scneario runner helps you test REST api.

$ npx soil replay

Write scenario file

scenario Test Scenario {
  GET /sample
}

soil http request to GET /sample endpoint.

Parameter overrides

scenario Comment {
  GET /articles/search {
    query = Search Query Parameter
  }
  POST /comments {
    body = Comment body
  }
}

Identifier endpoint

Use id directive in endpoint block, endpoint is identified by id string. You use endpoint reference that join by dot notation entity name and endpoint id in scenario block.

entity User {
  field id: Int
  mutable field name: String

  POST /users {
    id register
    request {
      field user: User
    }
    success {
      field user: User
    }
  }
}

scenario Register User {
  User.register { # Actually it uses `POST /users` endpoint.
    name = User Name
  }
}

api config

soil can be configured for your REST Api in the api section of soil.config.js.

|key|description|default |:---|:---|:--- |api.base|Base URL for scenario runner. e.g. https://api.example.com/v1. Required for replay sub-command.|undefined |api.booleanQuery|Boolean type parsing and stringify strategy.|'set-only-true' |api.headers|Custom headers collection used by scenario runner.|{}

Code Generation

You run soil generate command in your cli with target name, export code.

$ npx soil generate -g [target]

Supported targets are:

  • Swift (swift)
  • Kotlin (kotlin)

Swift

soil supports Swift code generation. Generated code has no dependencies, use your api request / response client class.

$ npx soil generate -g swift

with SoilSwift package

Instead of writing your own code, you can use soil-swift.

module.exports = {
  swift: {
    use: ['soil-swift'],
  },
}

Kotlin

soil supports Kotlin code generation.

$ npx soil generate -g kotlin