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

openapi: Add support for external refs #11076

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

morysh
Copy link

@morysh morysh commented Jun 8, 2023

Set IsExternalRefsAllowed to true and provide a ReadFromURIFunc.

Fixes #8067

@CLAassistant
Copy link

CLAassistant commented Jun 8, 2023

CLA assistant check
All committers have signed the CLA.

@morysh morysh force-pushed the iss8067_support_external_openai_ref branch from 645aa72 to c3c773c Compare June 9, 2023 08:43
return nil, err
}

return ioutil.ReadAll(file)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return ioutil.ReadAll(file)
return io.ReadAll(file)

ioutil is deprecated. See #10732

Comment on lines 99 to 102
var relativePath string

if strings.HasPrefix(url.Path, "./") {
relativePath = strings.TrimRightFunc(key, func(r rune) bool { return r != '/' }) + strings.TrimPrefix(url.Path, "./")
} else {
relativePath = url.Path
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
var relativePath string
if strings.HasPrefix(url.Path, "./") {
relativePath = strings.TrimRightFunc(key, func(r rune) bool { return r != '/' }) + strings.TrimPrefix(url.Path, "./")
} else {
relativePath = url.Path
}
relativePath := url.Path
if strings.HasPrefix(url.Path, "./") {
relativePath = strings.TrimRightFunc(key, func(r rune) bool { return r != '/' }) + strings.TrimPrefix(url.Path, "./")
}

if err != nil {
return nil, err
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Missing defer file.Close()

Copy link

@andrew-werdna andrew-werdna Sep 24, 2023

Choose a reason for hiding this comment

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

just throwing this out there, but it looks like the contributor added the defer file.Close() on line 108

Set IsExternalRefsAllowed to true and provide a ReadFromURIFunc.

Fixes gohugoio#8067
@morysh morysh force-pushed the iss8067_support_external_openai_ref branch from c3c773c to 8ee09a6 Compare June 9, 2023 12:16
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.

Support loading external files in OpenAPI
4 participants