Git Product home page Git Product logo

goapidoc's Introduction

Introduction

Stars Earned Collaborated Stars Followers Repositories GitHub Page

  • ๐Ÿ‘‹ Hi! Here is AoiHosizora (้’ใ„ใปใ—ใžใ‚‰), majors in Intelligent Software and Robotics, Software Engineering.
  • ๐Ÿ“ Speaking languages: Mandarin Chinese (Native), Teo-Swa-uรช (Native), English (CET-6), Japanese (JLPT-N1).
  • ๐Ÿข Some owned GitHub organizations: ah-shellext & ah-forklib, my public email: [email protected].
  • ๐Ÿš€ Interest areas: distributed backend system development, desktop client and android client development.
  • โšก Favorite programming languages: Go, Dart, C#, Kotlin, Rust, Typescript, etc.

Coding status

goapidoc's People

Contributors

aoi-hosizora avatar

Stargazers

 avatar

Watchers

 avatar  avatar

goapidoc's Issues

[BUG] bug with has multiple tags in path

Demo code:

goapidoc.NewPath("GET", "/v1/policy", "ๆŸฅ่ฏขๆ‰€ๆœ‰็ญ–็•ฅ").
	WithTags("Policy").
	// WithTags("Administration").
	WithSecurities("Jwt").
	WithResponses(goapidoc.NewResponse(200).WithType("_Result<_Page<PolicyDto>>")),

The first tags (policy) will be ignore and only the last tag will be shown in spec.json.

Failed to parse unresolved generic parameter in swagger-ui

Errors
Hide
Resolver error at definitions._Page.properties.data.items.$ref
Could not resolve reference because of: Could not resolve pointer: /definitions/T does not exist in document
Resolver error at definitions._Result.properties.data.$ref
Could not resolve reference because of: Could not resolve pointer: /definitions/T does not exist in document
"data": {
  "type": "array",
  "required": true,
  "description": "page data",
  "items": {
    "originRef": "T",
    "$ref": "#/definitions/T"
  }
},

Complete the generate test

Complete the TestGenerate, not just use the if err != nil {}.

goapidoc/generate_test.go

Lines 383 to 399 in db16945

_, err := GenerateSwaggerYaml("./docs/api.yaml")
if err != nil {
log.Println(err)
t.Fatal("yaml")
}
_, err = GenerateSwaggerJson("./docs/api.json")
if err != nil {
log.Println(err)
t.Fatal("json")
}
_, err = GenerateApib("./docs/api.apib")
if err != nil {
log.Println(err)
t.Fatal("apib")
}

Add Get methods and add more Set methods

Sometimes I need to update some properties for existed value.
So it is necessity to use Get methods and use more Set methods to update those.

func RuntimeUpdateSwaggerSpec() {
	// config.Configs().Meta.Port
	host := goapidoc.GetDocument().GetHost()
	goapidoc.GetDocument().Host(host)
}

Add more test for apitype.go

Fix some potential bugs in apitype.go and rewrite test with test cases.

Some ugly tests now:

goapidoc/generate_test.go

Lines 105 to 114 in cf47f71

def := &Definition{
generics: []string{"T", "U", "V"},
properties: []*Property{
{typ: "inT[]"},
{typ: "O<inT[], T[], T, inT<int>>"},
{typ: "T"},
{typ: "tT<T<tT>[][], T>[]"},
{typ: "TtT<T,tT[],T[][]>[]"},
},
}

goapidoc/generate_test.go

Lines 162 to 167 in cf47f71

newDefs := prehandleGenericList(defs, []string{
"Result<Page<User>>",
"Result3<User, Page<Result2<Login, Page<Login>>>, String[]>",
"Integer",
"Result2<String, Result2<String, String>>",
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.