@@ -22,13 +22,15 @@ import (
2222const (
2323 sunsetExtensionName = "x-sunset"
2424 apiVersionExtensionName = "x-xgen-version"
25+ teamExtensionName = "x-xgen-owner-team"
2526)
2627
2728type Sunset struct {
2829 Operation string `json:"http_method" yaml:"http_method"`
2930 Path string `json:"path" yaml:"path"`
3031 Version string `json:"version" yaml:"version"`
3132 SunsetDate string `json:"sunset_date" yaml:"sunset_date"`
33+ Team string `json:"team" yaml:"team"`
3234}
3335
3436func NewSunsetListFromSpec (spec * load.SpecInfo ) []* Sunset {
@@ -37,6 +39,7 @@ func NewSunsetListFromSpec(spec *load.SpecInfo) []*Sunset {
3739
3840 for path , pathBody := range paths .Map () {
3941 for operationName , operationBody := range pathBody .Operations () {
42+ teamName := newTeamNameFromOperation (operationBody )
4043 extensions := newExtensionsFrom2xxResponse (operationBody .Responses .Map ())
4144 if extensions == nil {
4245 continue
@@ -57,6 +60,7 @@ func NewSunsetListFromSpec(spec *load.SpecInfo) []*Sunset {
5760 Path : path ,
5861 SunsetDate : sunsetExt .(string ),
5962 Version : apiVersion .(string ),
63+ Team : teamName ,
6064 }
6165
6266 sunsets = append (sunsets , & sunset )
@@ -66,6 +70,13 @@ func NewSunsetListFromSpec(spec *load.SpecInfo) []*Sunset {
6670 return sunsets
6771}
6872
73+ func newTeamNameFromOperation (op * openapi3.Operation ) string {
74+ if value , ok := op .Extensions [teamExtensionName ]; ok {
75+ return value .(string )
76+ }
77+ return ""
78+ }
79+
6980func newExtensionsFrom2xxResponse (responsesMap map [string ]* openapi3.ResponseRef ) map [string ]any {
7081 if val , ok := responsesMap ["200" ]; ok {
7182 return newExtensionsFromContent (val .Value .Content )
0 commit comments