Example #1
0
func returnsToSchema(pidl *idl.Idl, t *idl.Type) *swagger2.Schema {
	sc := new(swagger2.Schema)
	// sc.Title = f.Name
	if t.IsVoid() {
		// nil schema means the operation returns no content
		return nil
	} else {
		it := typeToItems(pidl, t)
		sc.Ref = it.Ref
		sc.Type = it.Type
		sc.Format = it.Format
		sc.ItemsDef.Items = it.Items
		sc.Enum = it.Enum
		sc.AdditionalProperties = it.AdditionalProperties
	}
	return sc
}
Example #2
0
File: go.go Project: babelrpc/babel
// formatType returns the Type as a string in format suitable for C#.
func (gen *goGenerator) formatType(t *idl.Type) string {
	var s string
	ms, ok := goTypes[t.Name]
	if !ok {
		ms = t.Name
	}
	if t.IsList() {
		s = fmt.Sprintf(ms, gen.formatType(t.ValueType))
	} else if t.IsMap() {
		s = fmt.Sprintf(ms, goTypes[t.KeyType.Name], gen.formatType(t.ValueType))
	} else if t.IsBinary() {
		s = ms
	} else if t.IsPrimitive() {
		s = "*" + ms
	} else if t.IsEnum(gen.tplRootIdl) {
		s = "*" + ms
	} else if t.IsVoid() {
		s = ""
	} else {
		s = "*" + ms
	}
	return s
}
Example #3
0
func (gen *javaGenerator) isVoid(t *idl.Type) bool {
	return t.IsVoid()
}
Example #4
0
func (gen *csharpGenerator) isVoid(t *idl.Type) bool {
	return t.IsVoid()
}