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

tools/importer-rest-api-specs: refactoring the Parser package #4307

Open
wants to merge 50 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
4faf78e
`tools/importer-rest-api-specs`: refactoring the `commonschema` Match…
tombuildsstuff Jul 4, 2024
6f0d58c
`tools/importer-rest-api-specs`: refactoring the Constant package
tombuildsstuff Jul 4, 2024
2fd586e
`tools/importer-rest-api-specs`: porting the Network workaround into …
tombuildsstuff Jul 5, 2024
0ee4fe6
`tools/importer-rest-api-specs`: porting the `dataworkarounds` packag…
tombuildsstuff Jul 5, 2024
4f12c8f
`tools/importer-rest-api-specs`: scaffolding out the logic to parse a…
tombuildsstuff Jul 5, 2024
f822225
`tools/importer-rest-api-specs`: porting over the "remove unused item…
tombuildsstuff Jul 5, 2024
26e33dc
`tools/importer-rest-api-specs`: adding a shim to the updated `datawo…
tombuildsstuff Jul 5, 2024
e19e9b2
dependencies: updating to `v0.69.0` of `github.com/hashicorp/go-azure…
tombuildsstuff Jul 5, 2024
52bbbaa
`tools/importer-rest-api-specs`: refactoring the `normalization` pack…
tombuildsstuff Jul 5, 2024
a8fe51a
`tools/importer-rest-api-specs`: moving all of the `cleanup` items in…
tombuildsstuff Jul 5, 2024
26b1965
`tools/importer-rest-api-specs`: adding inner most sdk operation obje…
tombuildsstuff Jul 5, 2024
9f60d53
`tools/importer-rest-api-specs`: moving the `commonids` into a subpac…
tombuildsstuff Jul 5, 2024
dc07f97
`tools/data-api-sdk`: removing an empty todo file
tombuildsstuff Jul 5, 2024
74d644b
`tools/importer-rest-api-specs`: refactoring more logic out to the ne…
tombuildsstuff Jul 5, 2024
3819ffb
`tools/importer-rest-api-specs`: moving another `ignore` function
tombuildsstuff Jul 5, 2024
afc2bdd
WIP
tombuildsstuff Jul 9, 2024
98153d5
tools/importer-rest-api-specs: reimplementing #4290 atop the rebase
tombuildsstuff Jul 10, 2024
5b87f24
`tools/importer-rest-api-specs`: adding a placeholder for parsing an …
tombuildsstuff Jul 10, 2024
cc928e6
`tools/importer-rest-api-specs`: refactoring the parser into smaller …
tombuildsstuff Jul 12, 2024
fdcce78
`tools/importer-rest-api-specs`: fixing an issue where the `validate`…
tombuildsstuff Jul 12, 2024
53de393
`tools/importer-rest-api-specs`: title-casing the ReferenceName - whi…
tombuildsstuff Jul 12, 2024
b670864
`tools/importer-rest-api-specs`: ensuring that TypeSpec examples are …
tombuildsstuff Jul 12, 2024
436dbee
`tools/importer-rest-api-specs`: trimming `*.json` from the filename …
tombuildsstuff Jul 12, 2024
d1cd128
`tools/importer-rest-api-specs`: removing (most) of the old code path
tombuildsstuff Jul 12, 2024
71a166f
`tools/data-api-sdk`: making IsCommonType required so this is more ex…
tombuildsstuff Jul 12, 2024
1c64b98
`tools/importer-rest-api-specs`: fixing the validation
tombuildsstuff Jul 12, 2024
ea46701
`tools/importer-rest-api-specs`: re-enabling most of the tests
tombuildsstuff Jul 12, 2024
35fd4de
`tools/importer-rest-api-specs`: consolidating/porting over the data …
tombuildsstuff Jul 15, 2024
d3fb3ed
`tools/importer-rest-api-specs`: fixing the test format
tombuildsstuff Jul 15, 2024
99f58f4
tools/importer-rest-api-specs: skipping the local test
tombuildsstuff Jul 15, 2024
d3e6e8d
`tools/importer-rest-api-specs`: fixing the non-discriminator tests
tombuildsstuff Jul 15, 2024
ae96976
`tools/importer-rest-api-specs`: updating/reworking the supplementary…
tombuildsstuff Jul 15, 2024
1572179
`importer-rest-api-specs`: fix up discriminator handling for datafactory
manicminer Jul 17, 2024
924eae6
`importer-rest-api-specs`: run end-to-end import on code change
manicminer Jul 17, 2024
dfb8822
`importer-rest-api-specs`: shelve SupplementaryData support for now, …
manicminer Jul 17, 2024
603c3ed
`importer-rest-api-specs`: implement `-services` argument
manicminer Jul 17, 2024
9673038
`importer-rest-api-specs`: operate on maps instead of passing them ar…
manicminer Jul 17, 2024
a55bf59
`importer-rest-api-specs`: normalize swagger tag names to prevent dup…
manicminer Jul 18, 2024
8458a26
`importer-rest-api-specs`: normalize API resources after parsing all …
manicminer Jul 18, 2024
9952ebc
`importer-rest-api-specs`: ensure new APIResource is populated
manicminer Jul 18, 2024
b9c46b6
`importer-rest-api-specs`: maps are pointers
manicminer Jul 19, 2024
39e5851
Merge branch 'main' into refactor/importer-rest-api-specs-iv
manicminer Jul 19, 2024
751a6c3
`importer-rest-api-specs`: dereference more maps
manicminer Jul 19, 2024
b7c19d9
`importer-rest-api-specs`: remove use of strings.Title, dereference m…
manicminer Jul 19, 2024
4fcd170
limit scope of SDK generation test to the SDK being tested
manicminer Jul 19, 2024
31b45ca
`importer-rest-api-specs`: two loops become one
manicminer Jul 19, 2024
903069e
`importer-rest-api-specs`: workaround inconsistent casing of "Virtual…
manicminer Jul 19, 2024
fa472ea
Revert "`importer-rest-api-specs`: two loops become one"
manicminer Jul 19, 2024
26ddb5c
`importer-rest-api-specs`: normalize "attachednetworks" segment of re…
manicminer Jul 19, 2024
eb88006
Merge branch 'main' into refactor/importer-rest-api-specs-iv
manicminer Sep 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .github/workflows/unit-test-end-to-end-resource-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths:
- '.github/workflows/**'
- 'config/**'
- 'tools/importer-rest-api-specs/**'

jobs:
test:
Expand All @@ -32,4 +33,4 @@ jobs:
- name: "Run the Go SDK Generator"
run: |
# go go gadget generator
./scripts/automation-generate-go-sdk.sh
./scripts/automation-generate-go-sdk.sh resource-manager
27 changes: 19 additions & 8 deletions scripts/automation-generate-go-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@
set -e

DIR="$(cd "$(dirname "$0")" && pwd)/.."
sourceDataType="${1}"

usage() {
echo "Usage: automation-generate-go-sdk.sh sourceDataType" >&2
echo "" >&2
echo "sourceDataType is required and should be one of:" >&2
echo " microsoft-graph" >&2
echo " resource-manager" >&2
echo "" >&2
}

if [[ "${sourceDataType}" == "" ]]; then
echo "sourceDataType not specified" >&2
echo "" >&2
usage
exit 1
fi

function buildAndInstallDependencies {
echo "Outputting Go Version.."
Expand All @@ -31,15 +48,9 @@ function runWrapper {
local apiDefinitionsDirectory=$1
local outputDirectory=$2

echo "Running Wrapper for Resource Manager.."
cd "${DIR}/tools/wrapper-automation"
./wrapper-automation resource-manager go-sdk \
--api-definitions-dir="../../$apiDefinitionsDirectory"\
--output-dir="../../$outputDirectory"

echo "Running Wrapper for Microsoft Graph.."
echo "Running Wrapper.."
cd "${DIR}/tools/wrapper-automation"
./wrapper-automation microsoft-graph go-sdk \
./wrapper-automation "${sourceDataType}" go-sdk \
--api-definitions-dir="../../$apiDefinitionsDirectory"\
--output-dir="../../$outputDirectory"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package helpers

import "github.com/hashicorp/pandora/tools/data-api-sdk/v1/models"

// InnerMostSDKOperationOptionObjectDefinition returns the inner most SDKOperationOptionObjectDefinition.
//
// In the event of an SDKOperationOptionObjectDefinition with no NestedItem, the current item will be returned.
// In the event of a NestedItem being present, or a NestedItem having a NestedItem, this method
// will recurse until it finds the SDKOperationOptionObjectDefinition without a NestedItem.
//
// This is useful for obtaining the inner type for assignment purposes.
func InnerMostSDKOperationOptionObjectDefinition(input models.SDKOperationOptionObjectDefinition) models.SDKOperationOptionObjectDefinition {
if input.NestedItem != nil {
return InnerMostSDKOperationOptionObjectDefinition(*input.NestedItem)
}

return input
}
6 changes: 0 additions & 6 deletions tools/data-api-sdk/v1/helpers/todo.go

This file was deleted.

2 changes: 1 addition & 1 deletion tools/data-api-sdk/v1/models/sdk_object_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type SDKObjectDefinition struct {
ReferenceName *string `json:"referenceName,omitempty"`

// ReferenceNameIsCommonType specifies whether the referenced Constant or Model is a common type
ReferenceNameIsCommonType *bool `json:"referenceNameIsCommonType,omitempty"`
ReferenceNameIsCommonType bool `json:"referenceNameIsCommonType"`

// Type specifies the Type that represents this SDK Object Definition. This can be either a
// Simple type (e.g. a String/Integer), a Reference to a Constant/Model or a more complex object
Expand Down
3 changes: 3 additions & 0 deletions tools/importer-rest-api-specs/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import: build
import-with-api: build
./importer-rest-api-specs import --data-api=http://localhost:8080

validate: build
./importer-rest-api-specs validate

test: build
go test -v ./... -timeout=60m

Expand Down
148 changes: 0 additions & 148 deletions tools/importer-rest-api-specs/components/discovery/data.go

This file was deleted.

Loading
Loading