Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #2435 #2442

Merged
merged 2 commits into from Sep 24, 2022
Merged

fix #2435 #2442

merged 2 commits into from Sep 24, 2022

Conversation

bensonfx
Copy link
Contributor

  1. support header path generate
  2. fix path type path generate

test api:

type UserLoginReq {
    Name string `json:"name"`
    Id int64 `path:"id"`
    Email string `form:"email,optional"`
    Nonce string `header:"nonce,optional"`
}
type ReplyStatus {
    Code int `json:"code"`
    Msg int `json:"msg"`
}
@server(
    prefix: api
    group: user
)
service demo-api {
    @doc "user login"
    @handler Login
    get /user/login/:id (UserLoginReq) returns (ReplyStatus)
}
// demo.ts
import * as components from "./demoComponents"
export * from "./demoComponents"

/**
 * @description "user login"
 * @param params
 * @param req
 * @param headers
 */
export function login(params: components.UserLoginReqParams, req: components.UserLoginReq, headers: components.UserLoginReqHeaders, id: number) {
	return webapi.get<components.ReplyStatus>(`/api/user/login/${id}`, params, req, headers)
}
//demoComponents.ts

// Code generated by goctl. DO NOT EDIT.

export interface UserLoginReq {
	name: string
}
export interface UserLoginReqParams {
	email: string
}
export interface UserLoginReqHeaders {
	nonce: string
}

export interface ReplyStatus {
	code: number
	msg: number
}

@bensonfx bensonfx marked this pull request as draft September 22, 2022 15:34
@bensonfx bensonfx marked this pull request as ready for review September 22, 2022 15:35
Copy link
Contributor

@kevwan kevwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kevwan kevwan merged commit e7acadb into zeromicro:master Sep 24, 2022
@bensonfx bensonfx deleted the fix_ts_gen_header_path branch September 26, 2022 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants