Skip to content

Commit

Permalink
Moved OpenAPI specs to seperate folders
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalvanderheiden committed Apr 28, 2024
1 parent d99bf34 commit 22de590
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -409,4 +409,7 @@ FodyWeavers.xsd
*.drawio.bkp

# Local test files
local.*
local.*

# Locally added OpenAPI specs from SAP APIM
infra/core/apic/openapi/sap/*
4 changes: 2 additions & 2 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ var resourceToken = toLower(uniqueString(subscription().id, environmentName, loc
var sapApiKeySecretName = 'sap-api-key'
var sapClientIdSecretName = 'sap-apim-client-id'
var sapSecretSecretName = 'sap-apim-secret'
var sapAppMetadataSchema = loadTextContent('./core/apic/metadata/sap-app-metadata-schema.json')
// var sapAppMetadataSchema = loadTextContent('./core/apic/metadata/sap-app-metadata-schema.json')
var rootUrl = !empty(sapApimDiscoveryUrl) ? split(sapApimDiscoveryUrl, '/apidiscovery')[0] : ''
var sapManagementPortalUrl = !empty(rootUrl) ? '${rootUrl}/shell/homepage' : ''
var sapDeveloperPortalUrl = !empty(rootUrl) ? '${rootUrl}/shell/configure' : ''
var apimOpenAPISpecFileLocation = 'infra/core/apic/openapi/API_BUSINESS_PARTNER.json'
var apimOpenAPISpecFileLocation = 'infra/core/apic/openapi/azure/API_BUSINESS_PARTNER.json'
// Organize resources in a resource group
resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: !empty(resourceGroupName) ? resourceGroupName : '${abbrs.resourcesResourceGroups}${environmentName}'
Expand Down
4 changes: 2 additions & 2 deletions scripts/sap-apim-discovery.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ $discoveryResponse.value | ForEach-Object {
$url = $_.apiDefinitions[0].url
$runtimeUri = $_.entryPoints[0].url
$apiName = ($name -replace "_", "").ToLower()
$releaseStatus = $_.releaseStatus
# $releaseStatus = $_.releaseStatus
$summary = $_.summary
$description = $_.description
Write-Host "API Discovered: $name - $url"
Write-Host "Retrieving API definition, saving as file"
$resourceResponse = Invoke-RestMethod -Uri $_.apiDefinitions[0].url -Headers $headers -Method Get -ContentType "application/json"
$jsonString = $resourceResponse | ConvertTo-Json -Depth 50
$newJsonFilePath = "infra\core\apic\openapi\$name.json"
$newJsonFilePath = "infra\core\apic\openapi\sap\$name.json"
$jsonString | Out-File -FilePath $newJsonFilePath -Force
# Output the file path for confirmation
Write-Output "OpenAPI Spec saved to: $newJsonFilePath"
Expand Down

0 comments on commit 22de590

Please sign in to comment.