Getting Started with YIZY API

Installation

Install the @yizy/specification package to start writing YIZY Spec in Typescript!
npx jsr add @yizy/specification
deno add jsr:@yizy/specification
bunx jsr add @yizy/specification
Checkout the package page on JSR for more installation details.

Example


import { type Service,
        field,
        referenceType,
        nullableReferenceType,
        objectType } from '@yizy/specification';

export const secretService: Service = {
	serviceName: 'SecretService',
	baseUrls: ['http://localhost:8080'],
	endpoints: [
		{
			url: '/agents/getAgentByName',
			name: 'getAgentByName',
			requestModel: 
              objectType('GetAgentByNameRequest', [
                field('name', 'string')
              ]),
			responseModel: 
              objectType('GetAgentByNameResponse', [
				field('error', nullableReferenceType('Grenade')),
				field('agent', referenceType('Agent'))
			  ])
		}
	],
	referenceTypes: [
		objectType('Agent', [
			field('name', 'string'),
			field('age', 'int'),
			field('department', 'string')
		]),
		objectType('Grenade', [
          field('code', 'int'),
          field('msg', 'string'),
          field('name', 'string')])
	]
};

// Copy the output and paste it to the 
// website at https://yizy.rootxsnowstudio.com/app
const output = JSON.stringify(secretService);

Copy and paste the output to the app page. That's it. It's that YIZY!