ujjwalguptaofficial / fortjs-swagger Goto Github PK
View Code? Open in Web Editor NEWSwagger module for fortjs
Home Page: http://fortjs.info/tutorial/swagger/
License: GNU General Public License v3.0
Swagger module for fortjs
Home Page: http://fortjs.info/tutorial/swagger/
License: GNU General Public License v3.0
export class User implements SwaggerModel {
@OptionalProperty
name: string
password: string
friends: Friend[]
@IgnoreProperty
init?(user: any) {
this.name = user.name
this.password = user.password
this.friends = user.friends
}
getExample?() {
this.name = "name"
this.password = "password"
// Problem seems to be related to nested classes.
// If I include User here it won't throw an error but it also won't show up as a property on the swagger page.
this.friends = [new Friend()]
}
}
xport class Friend implements SwaggerModel {
@OptionalProperty
name: string
@IgnoreProperty
init?(user: any) {
this.name = user.name
}
getExample?() {
this.name = "name"
}
}
The friend property is not being added in swagger doc
I feel like the swagger documentation isn't very detailed.
For example it doesn't actually show you how you need to write the swagger classes.
I have this right now and it just throws an error:
class Component implements SwaggerModel {
@OptionalProperty
name: string;
completed: boolean;
manNr: string;
comment: string;
specialAttribute: string;
specialAttrValue: string;
instructionImg: string;
@IgnoreProperty
init?(component: any) {
this.name = component.name;
this.completed = component.completed;
this.manNr = component.manNr;
this.comment = component.comment;
this.specialAttribute = component.specialAttribute;
this.specialAttrValue = component.specialAttrValue;
this.instructionImg = component.instructionImg;
}
getExample?() {
this.name = "component_name"
this.completed = false
this.manNr = "1234"
this.comment = "comment"
this.specialAttribute = "NONE"
this.specialAttrValue = "value"
this.instructionImg = "img.png"
}
}
class Step implements SwaggerModel {
@OptionalProperty
_id: string
name: string
index: number
completed: boolean
components: Component[]
@IgnoreProperty
init?(step: any) {
this.name = step.name;
this.index = step.index;
this.completed = step.completed;
this.components = step.components
}
getExample?() {
this.name = "step_name"
this.index = 1
this.completed = false
this.components = [new Component()]
}
}
export class Order implements SwaggerModel {
@OptionalProperty
_id: string
serialNumber: string
productionOrder: string
articleNumber: string
model: string
assemblySteps: Step[]
testingSteps: Step[]
packingSteps: Step[]
startDate: number
endDate: number
complete: boolean
timer: number
paused: boolean
started: boolean
@IgnoreProperty
init?(order: any) {
this._id = order._id
this.serialNumber = order.serialNumber
this.productionOrder = order.productionOrder
this.articleNumber = order.articleNumber
this.model = order.model
this.assemblySteps = order.assemblySteps
this.testingSteps = order.testingSteps
this.packingSteps = order.packingSteps
this.startDate = order.startDate
this.endDate = order.endDate
this.complete = order.complete
this.timer = order.timer
this.paused = order.paused
this.started = order.started
}
getExample?() {
this._id = "123456789"
this.serialNumber = "123456789"
this.productionOrder = "123456789"
this.serialNumber = "123456789"
this.model = "model_name"
this.assemblySteps = [new Step()]
this.testingSteps = [new Step()]
this.packingSteps = [new Step()]
this.startDate = Date.now()
this.endDate = Date.now()
this.timer = 0
this.complete = false
this.paused = false
this.started = false
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.