pull/5055/head
James Elliott 2023-03-12 09:33:40 +11:00 committed by GitHub
parent 739685c2ec
commit 482f23b506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 12 deletions

View File

@ -118,14 +118,14 @@ func codeScriptsRunE(cmd *cobra.Command, args []string) (err error) {
return err
}
if resp, err = http.Get("https://api.github.com/repos/swagger-api/swagger-ui/tags"); err != nil {
if resp, err = http.Get("https://api.github.com/repos/swagger-api/swagger-ui/releases/latest"); err != nil {
return fmt.Errorf("failed to get latest version of the Swagger UI: %w", err)
}
defer resp.Body.Close()
var (
respJSON []GitHubTagsJSON
respJSON GitHubReleasesJSON
respRaw []byte
)
@ -137,14 +137,10 @@ func codeScriptsRunE(cmd *cobra.Command, args []string) (err error) {
return fmt.Errorf("failed to get latest version of the Swagger UI: %w", err)
}
if len(respJSON) < 1 {
return fmt.Errorf("failed to get latest version of the Swagger UI: the api returned zero results")
}
if strings.HasPrefix(respJSON[0].Name, "v") {
data.VersionSwaggerUI = respJSON[0].Name[1:]
if strings.HasPrefix(respJSON.TagName, "v") {
data.VersionSwaggerUI = respJSON.TagName[1:]
} else {
data.VersionSwaggerUI = respJSON[0].Name
data.VersionSwaggerUI = respJSON.TagName
}
fullPathScriptsGen := filepath.Join(root, pathScriptsGen)

View File

@ -30,6 +30,48 @@ type GitHubTagsJSON struct {
Name string `json:"name"`
}
type GitHubReleasesJSON struct {
ID int `json:"id"`
Name string `json:"name"`
TagName string `json:"tag_name"`
TargetCommitISH string `json:"target_commitish"`
NodeID string `json:"node_id"`
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
URL string `json:"url"`
AssetsURL string `json:"assets_url"`
UploadURL string `json:"upload_url"`
HTMLURL string `json:"html_url"`
TarballURL string `json:"tarball_url"`
ZipballURL string `json:"zipball_url"`
Assets []any `json:"assets"`
CreatedAt time.Time `json:"created_at"`
PublishedAt time.Time `json:"published_at"`
Author GitHubAuthorJSON `json:"author"`
Body string `json:"body"`
}
type GitHubAuthorJSON struct {
ID int `json:"id"`
Login string `json:"login"`
NodeID string `json:"node_id"`
AvatarURL string `json:"avatar_url"`
GravatarID string `json:"gravatar_id"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
FollowersURL string `json:"followers_url"`
FollowingURL string `json:"following_url"`
GistsURL string `json:"gists_url"`
StarredURL string `json:"starred_url"`
SubscriptionsURL string `json:"subscriptions_url"`
OrganizationsURL string `json:"organizations_url"`
ReposURL string `json:"repos_url"`
EventsURL string `json:"events_url"`
ReceivedEventsURL string `json:"received_events_url"`
Type string `json:"type"`
SiteAdmin bool `json:"site_admin"`
}
// DocsDataMisc represents the docs misc data schema.
type DocsDataMisc struct {
CSP TemplateCSP `json:"csp"`

View File

@ -7,5 +7,5 @@
package cmd
const (
versionSwaggerUI = "4.17.0"
versionSwaggerUI = "4.18.1"
)

View File

@ -2,7 +2,7 @@
title: "Accessibility"
description: "Authelia Development Accessibility Guidelines"
lead: "This section covers the accessibility guidelines we aim to respect during development."
date: 2023-03-06T11:42:13+11:00
date: 2023-03-06T20:17:57+11:00
draft: false
images: []
menu:

View File

@ -2,7 +2,7 @@
title: "Frequently Asked Questions"
description: "This guide shows a list of other frequently asked question documents as well as some general ones"
lead: "This guide shows a list of other frequently asked question documents as well as some general ones."
date: 2023-03-06T11:04:10+11:00
date: 2023-03-06T11:32:06+11:00
draft: false
images: []
menu: