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

// Replace all words that do not conform [RFC3986-compliant] for ref #98

Closed
wants to merge 11 commits into from

Conversation

ccfish86
Copy link

@ccfish86 ccfish86 commented Feb 9, 2023

Replace all words that do not conform [RFC3986-compliant] for ref

#97

@@ -964,7 +965,7 @@ func (g *Generator) newSchemaFromStruct(t reflect.Type) *SchemaOrRef {
if t.Kind() != reflect.Struct {
return nil
}
name := g.typeName(t)
name := refRe.ReplaceAllString(g.typeName(t), "")

Choose a reason for hiding this comment

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

Isn't it better to escape the name altogether instead of removing specific parts/characters ?

name := url.QueryEscape(g.typeName(t))

Copy link
Author

Choose a reason for hiding this comment

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

For example:
the type name is ResponseHttpResult[Chemen-Gva/Server/Model/App/Resp.LoginResp]
the regexp ’s result: ResponseHttpResultRespLoginResp,
and url.QueryEscape 's resul: ResponseHttpResult%5BChemen-Gva%2FServer%2FModel%2FApp%2FResp.LoginResp%5D.
So ResponseHttpResultRespLoginResp looks more appropriate.

@ccfish86 ccfish86 closed this Feb 27, 2023
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.

2 participants