Skip to content

Commit b051cc0

Browse files
- API sprawl CI check in place.
- Future API doc.
1 parent 0475d1c commit b051cc0

File tree

7 files changed

+599
-0
lines changed

7 files changed

+599
-0
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ jobs:
141141
- name: Check out code into the Go module directory
142142
uses: actions/checkout@v2
143143

144+
- name: API sprawl check
145+
run: ./cicd/scripts/hack/check_api_growth.sh
146+
144147
- name: Setup system dependencies
145148
run: |
146149
sudo apt-get update
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
echo "Checking for API sprawl..."
5+
6+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
7+
TMP_DIR="$(mktemp -d)"
8+
trap 'rm -rf "$TMP_DIR"' EXIT
9+
10+
echo "TMP_DIR=$TMP_DIR"
11+
12+
echo "Changing to root dir: $ROOT_DIR"
13+
14+
cd "$ROOT_DIR"
15+
16+
# Regenerate current API snapshots
17+
grep -Rho 'func [A-Z][A-Za-z0-9_]*' --include='*.go' --exclude-dir={vendor,testdata} . \
18+
| sort -u > "$TMP_DIR/exported_funcs.txt"
19+
20+
grep -Rnoh '^type [A-Z][A-Za-z0-9_]* interface' --include='*.go' --exclude-dir={vendor,testdata} . \
21+
| sed 's/^[^:]*://g' | sort -u > "$TMP_DIR/exported_interfaces.txt"
22+
23+
grep -Rnoh '^type [A-Z][A-Za-z0-9_]* struct' --include='*.go' --exclude-dir={vendor,testdata} . \
24+
| sed 's/^[^:]*://g' | sort -u > "$TMP_DIR/exported_structs.txt"
25+
26+
fail=0
27+
28+
check_file() {
29+
local baseline="$1"
30+
local current="$2"
31+
local label="$3"
32+
33+
if [[ ! -f "$baseline" ]]; then
34+
echo "Baseline file missing: $baseline"
35+
fail=1
36+
return
37+
fi
38+
39+
# Show lines present in current but not in baseline (i.e. additions).
40+
local added
41+
added="$(comm -13 <(sort "$baseline") <(sort "$current") || true)"
42+
43+
if [[ -n "$added" ]]; then
44+
echo "API growth detected in $label:"
45+
echo "$added"
46+
echo
47+
fail=1
48+
fi
49+
}
50+
51+
52+
check_file "cicd/tools/api/exported_funcs.txt" "$TMP_DIR/exported_funcs.txt" "exported functions"
53+
check_file "cicd/tools/api/exported_interfaces.txt" "$TMP_DIR/exported_interfaces.txt" "exported interfaces"
54+
check_file "cicd/tools/api/exported_structs.txt" "$TMP_DIR/exported_structs.txt" "exported structs"
55+
56+
if [[ "$fail" -ne 0 ]]; then
57+
echo "API sprawl check FAILED: new exported symbols were introduced."
58+
echo "If this is intentional, update tools/api/*.txt and FUTURE_API.md in the same PR."
59+
exit 1
60+
fi
61+
62+
echo "API sprawl check PASSED: no new exported symbols."

cicd/tools/api/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
These are reference points for the acceptable bresadth of the API. In general, it ought to be non-increasing.

cicd/tools/api/exported_funcs.txt

Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
func CallFromSignature
2+
func CartesianProduct
3+
func ClientProtocolTypeFromString
4+
func DecompressToPath
5+
func DefaultLinkHeaderTransformer
6+
func Execute
7+
func ExtractHTTPElement
8+
func ExtractParameterisedURL
9+
func ExtractProviderDesignation
10+
func FilePathJoin
11+
func FindLatest
12+
func FindLatestStable
13+
func Gcd
14+
func Get
15+
func GetAccessToken
16+
func GetAuthCtx
17+
func GetAwsEc2ListMultiResponseReader
18+
func GetAwsEc2ListSingleResponseReader
19+
func GetContrivedPagesResponseReader
20+
func GetControlAttributes
21+
func GetCurrentAuthUser
22+
func GetDB
23+
func GetDBMSInternalCfg
24+
func GetDescribeHeader
25+
func GetFilePathFromRepositoryRoot
26+
func GetFilePathUnescapedFromRepositoryRoot
27+
func GetForwardSlashFilePathFromRepositoryRoot
28+
func GetGCCfg
29+
func GetGoogleFoldersListResponseReader
30+
func GetHTTPClient
31+
func GetK8SNodesListMultiResponseReader
32+
func GetKStoreCfg
33+
func GetLogger
34+
func GetMockLocalRegistry
35+
func GetMockRegistry
36+
func GetMonitorRequest
37+
func GetNamespaceCfg
38+
func GetPrefixPrefix
39+
func GetProviderDocBytes
40+
func GetRequestMediaType
41+
func GetResourcesHeader
42+
func GetResourcesRegisterDocBytes
43+
func GetResponseMediaType
44+
func GetRoundTripper
45+
func GetSQLBackendCfg
46+
func GetSQLEngineSetupDDL
47+
func GetServiceDocBytes
48+
func GetServicesHeader
49+
func GetSubObjFromNode
50+
func GetSubObjTyped
51+
func GetTabulation
52+
func GetTestingView
53+
func GetTxnCoordinatorCfgCfg
54+
func InterfaceToBytes
55+
func InterfaceToSQLType
56+
func IsAcceptableMediaType
57+
func IsJSONSynonym
58+
func IsNil
59+
func IsXMLSynonym
60+
func Lcm
61+
func LcmMultiple
62+
func LoadProviderAndServiceFromPaths
63+
func LoadProviderByName
64+
func LoadProviderDocFromBytes
65+
func LoadProviderDocFromFile
66+
func LoadResourcesShallow
67+
func LoadServiceDocFromBytes
68+
func LoadServiceDocFromFile
69+
func LoadServiceSubsetDocFromBytes
70+
func MakeSuffixMapFromParameterMap
71+
func MarshalXMLUserInput
72+
func NewAddressSpaceAnalysisPassManager
73+
func NewAddressSpaceFormulator
74+
func NewAddressSpaceGrammar
75+
func NewAliasMap
76+
func NewAnalyzerCfg
77+
func NewAnySdkArgList
78+
func NewAnySdkClientConfigurator
79+
func NewAnySdkOpStoreDesignation
80+
func NewAuthUtility
81+
func NewAwsSignTransport
82+
func NewBasicDiscoveryAdapter
83+
func NewBrickMap
84+
func NewColumnDescriptor
85+
func NewDataFlowCfg
86+
func NewDefaultCredentialAzureTokenSource
87+
func NewDropDoubleUnderscoreParamsTranslator
88+
func NewEmptyOperationStore
89+
func NewEmptyProviderService
90+
func NewEmptyResource
91+
func NewExecContext
92+
func NewExecPayload
93+
func NewFileValidator
94+
func NewFuzzyPair
95+
func NewGetQueryToPostFormEncodedTranslator
96+
func NewHTTPArmoury
97+
func NewHTTPArmouryParameters
98+
func NewHTTPElement
99+
func NewHTTPPreparator
100+
func NewHTTPPreparatorConfig
101+
func NewHttpClientConfiguratorInput
102+
func NewHttpParameters
103+
func NewHttpPreparatorStream
104+
func NewInterrogator
105+
func NewJSONPathResolver
106+
func NewLocalTemplateExecutor
107+
func NewMethodAnalysisInput
108+
func NewMethodAnalyzer
109+
func NewNaiveBodyTranslator
110+
func NewNilTranslator
111+
func NewNopMapStream
112+
func NewOperationSelector
113+
func NewOptionalAddressableRequestBodyProperty
114+
func NewParameter
115+
func NewParameterBinding
116+
func NewParameterSuffixMap
117+
func NewParameterTranslator
118+
func NewParameters
119+
func NewPrefixedTranslator
120+
func NewProvider
121+
func NewProviderServiceResourceAnalyzer
122+
func NewProvidersList
123+
func NewQueryTransposer
124+
func NewRadixTree
125+
func NewRegexpShorthand
126+
func NewRegexpStringMetcher
127+
func NewRegistry
128+
func NewRequestTranslator
129+
func NewRequiredAddressableRequestBodyProperty
130+
func NewResourceAddressSpaceExpander
131+
func NewResourceRegister
132+
func NewResponse
133+
func NewRouter
134+
func NewSQLEngine
135+
func NewSQLPersistenceSystem
136+
func NewService
137+
func NewServiceLevelStaticAnalyzer
138+
func NewSessionContext
139+
func NewSimpleMockRegistryRoundTripper
140+
func NewSimpleProjectionMapStream
141+
func NewStandardAddressSpaceExpansionConfig
142+
func NewStandardBrickMapConfig
143+
func NewStandardGQLReader
144+
func NewStandardMapStream
145+
func NewStandardMapStreamCollection
146+
func NewStandardOutputPacket
147+
func NewStandardParamInputStrem
148+
func NewStandardStaticAnalyzerFactoryFactory
149+
func NewStandardTransformerLocator
150+
func NewStaticAnalyzer
151+
func NewStreamTransformerFactory
152+
func NewStringSchema
153+
func NewTTLDiscoveryStore
154+
func NewTemplateStreamTransformer
155+
func NewTestSchema
156+
func NewTransport
157+
func NewTxnCounterManager
158+
func NewViewNameMangler
159+
func NewViewNameUnmangler
160+
func NewXMLShorthand
161+
func NewXMLStringShorthand
162+
func NewXPathResolver
163+
func NewwHTTPAnySdkArgList
164+
func NormaliseMediaType
165+
func OAuthToGoogle
166+
func ObtainServerURLsFromServers
167+
func ParseURLHost
168+
func ProviderTypeConditionIsValid
169+
func ReadService
170+
func RenderTemplateFromSerializable
171+
func ResourceConditionIsValid
172+
func ResourceKeyExists
173+
func RevokeGoogleAuth
174+
func SanitiseServerURL
175+
func ServiceConditionIsValid
176+
func ServiceKeyExists
177+
func Set
178+
func SetLogger
179+
func SplitSearchPath
180+
func TestAliasedAddressSpaceGoogleCurrent
181+
func TestAwareListVolumesMulti
182+
func TestBasicAddressSpaceAWSCurrent
183+
func TestBasicAddressSpaceGoogleCurrent
184+
func TestBestEffortXMLStreamTransform
185+
func TestConfigDrivenAliasedAddressSpaceGoogleCurrent
186+
func TestDeepDiscoveryGoogleCurrent
187+
func TestDiscovery01
188+
func TestDiscoveryAWS
189+
func TestFatConfigDrivenAliasedAddressSpaceGoogleCurrent
190+
func TestFragmentedResourcesFile
191+
func TestGet
192+
func TestGetControlAttributes
193+
func TestGetLogger
194+
func TestGetStruct
195+
func TestHeavyAliasedAddressSpaceAWSCurrent
196+
func TestHeavyAliasedAddressSpaceGoogleCurrent
197+
func TestIndirectGoogleComputeResourcesJsonRead
198+
func TestIndirectGoogleComputeServiceSubsetAccess
199+
func TestIndirectGoogleComputeServiceSubsetJsonRead
200+
func TestIntelligentAliasedAddressSpaceGoogleCurrent
201+
func TestJSONPathHandle
202+
func TestJSONPathHandleEnforcedResponseMediaType
203+
func TestJSONRequestBody
204+
func TestListProviderVersionsRegistry
205+
func TestListProvidersRegistry
206+
func TestLocalExec
207+
func TestLocalRegistryIndirectGoogleComputeServiceSubsetAccess
208+
func TestLocalTemplateClient
209+
func TestLocalTemplatedCompositeServiceFile
210+
func TestLocalValidateAndParseValidProviderFile
211+
func TestMeaningfulStreamTransform
212+
func TestMeaningfulXMLStreamTransform
213+
func TestMethodLevelVariableHostRoutingFutureProofed
214+
func TestMonolithicCompositeServiceFile
215+
func TestNewAddressSpace
216+
func TestNoFallbackViewApi
217+
func TestOpensslCertTextStreamTransform
218+
func TestPersistence01
219+
func TestPersistenceSetup
220+
func TestPlaceholder
221+
func TestProviderPull
222+
func TestProviderPullAndPersist
223+
func TestRegistryArrayTopLevelResponse
224+
func TestRegistryCanHandlePolymorphismAllOf
225+
func TestRegistryCanHandleUnspecifiedResponseWithDefaults
226+
func TestRegistryIndirectGoogleComputeResourcesJsonRead
227+
func TestRegistryIndirectGoogleComputeServiceMethodResolutionSeparateDocs
228+
func TestRegistryIndirectGoogleComputeServiceSubsetAccess
229+
func TestRegistryLocalTemplated
230+
func TestRegistryProviderLatestVersion
231+
func TestRegistrySimpleOktaApplicationServiceRead
232+
func TestRenderEnvTemplate
233+
func TestRenderEnvTemplateExotic
234+
func TestRenderEnvURLTemplateExotic
235+
func TestRenderErroneousTemplateFromSerializable
236+
func TestRenderNilURLTemplateFromSerializable
237+
func TestRenderTemplate
238+
func TestRenderTemplateFromSerializable
239+
func TestRenderURLTemplateFromSerializable
240+
func TestSearchAliasedAddressSpaceGoogleCurrent
241+
func TestSet
242+
func TestSetDollar
243+
func TestSetLogger
244+
func TestSetStruct
245+
func TestSetStructAll
246+
func TestShallowDiscoveryGoogleCurrent
247+
func TestShallowDiscoveryGoogleLegacy
248+
func TestSimpleAWSec2ServiceJsonReadAndDumpString
249+
func TestSimpleGoogleComputeResourcesJsonRead
250+
func TestSimpleGoogleComputeServiceJsonReadAndDumpString
251+
func TestSimpleOktaApplicationServiceJsonReadAndDumpString
252+
func TestSimpleOktaApplicationServiceRead
253+
func TestSimpleOktaApplicationServiceReadAndDump
254+
func TestSimpleOktaApplicationServiceReadAndDumpString
255+
func TestSimpleStreamTransform
256+
func TestSimpleTextXMLStreamTransform
257+
func TestSimpleViewApi
258+
func TestSplitCompositeServiceFile
259+
func TestSplitPath
260+
func TestSplitPathLong
261+
func TestStandardControlAttributes
262+
func TestStaticHostRouting
263+
func TestTransformedXMLHTTPHandle
264+
func TestValidateAndParseGoogleProviderFile
265+
func TestValidateAndParse_ValidJSON
266+
func TestVariableHostRouting
267+
func TestVariableHostRoutingFutureProofed
268+
func TestXMLMArshal
269+
func TestXMLRequestBody
270+
func TestXMLSchemaInterrogation
271+
func TestXPathHandle
272+
func TranslateServiceKeyGenericProviderToIql
273+
func TrimSelectItemsKey
274+
func ValidateAndParse

0 commit comments

Comments
 (0)