1.0.10 • Published 7 years ago

java2swag v1.0.10

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

java-bean-to-swagger-definition

Read Java bean and convert to swagger definition

Prerequisite:

Installation

  $ git clone https://github.com/artificiala/java-bean-to-swagger-definition.git
  $ npm install

How to use

  $ node app.js /path/to/java/file/directory /path/to/yaml/output/definitions.yaml
  

Example

  $ node app.js ./java-project/definitions ./java-project/swagger/definition.yaml

Example Java file to be conveted

// FullAddrBean.java
package com.a.b.c.beans;

import com.a.b.beans.AddrAmphurBean;
import com.a.b.beans.AddrCountryBean;
import com.a.b.beans.AddrDistricBean;
import com.a.b.beans.AddrProvinceBean;

public class FullAddrBean {
	private String persAddress;
	private AddrProvinceBean province;
	private AddrAmphurBean amphur;
	private AddrDistricBean district;
	private String zipcode;
  
	public String getPersAddress() {
		return persAddress;
	}
	public void setPersAddress(String persAddress) {
		this.persAddress = persAddress;
	}
	
	public AddrProvinceBean getProvince() {
		return province;
	}
	public void setProvince(AddrProvinceBean province) {
		this.province = province;
	}
	public AddrAmphurBean getAmphur() {
		return amphur;
	}
	public void setAmphur(AddrAmphurBean amphur) {
		this.amphur = amphur;
	}
	public AddrDistricBean getDistrict() {
		return district;
	}
	public void setDistrict(AddrDistricBean district) {
		this.district = district;
	}
	public String getZipcode() {
		return zipcode;
	}
	public void setZipcode(String zipcode) {
		this.zipcode = zipcode;
	}
}

Result

# definition.yaml
FullAddrBean:
  properties:
    persAddress:
      type: string
    country:
      $ref: '#/definitions/AddrCountryBean'
    province:
      $ref: '#/definitions/AddrProvinceBean'
    amphur:
      $ref: '#/definitions/AddrAmphurBean'
    district:
      $ref: '#/definitions/AddrDistricBean'
    zipcode:
      type: string
1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago