Skip to content

Commit f38e772

Browse files
Comments & rename to clarify blocklist behavior
1 parent d1f8696 commit f38e772

File tree

3 files changed

+18
-27
lines changed

3 files changed

+18
-27
lines changed

generator/autogenlist.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import { postProcessor as policyProcessor } from './processors/Microsoft.Authori
88
import { postProcessor as securityInsightsPostProcessor } from './processors/Microsoft.SecurityInsights';
99
import { lowerCaseEquals } from './utils';
1010

11-
// Going forwards, providers are onboarded by default.
12-
// The providers listed here are the only ones **not** onboarded.
11+
// New providers are onboarded by default. The providers listed here are the only ones **not** onboarded.
1312
const disabledProviders: AutoGenConfig[] = [
1413
{
1514
basePath: 'advisor/resource-manager',
@@ -71,6 +70,12 @@ const disabledProviders: AutoGenConfig[] = [
7170
namespace: 'Microsoft.DataProtection',
7271
disabledForAutogen: true,
7372
},
73+
{
74+
// Disabled as the swagger spec contains a type ("DateTimeRfc1123") which autorest is unable to parse: https://github.com/Azure/autorest.azureresourceschema/issues/71
75+
basePath: 'domainservices/resource-manager',
76+
namespace: 'Microsoft.AAD',
77+
disabledForAutogen: true,
78+
},
7479
{
7580
basePath: 'dfp/resource-manager',
7681
namespace: 'Microsoft.Dynamics365Fraudprotection',
@@ -484,10 +489,6 @@ const autoGenList: AutoGenConfig[] = [
484489
basePath: 'EnterpriseKnowledgeGraph/resource-manager',
485490
namespace: 'Microsoft.EnterpriseKnowledgeGraph',
486491
},
487-
{
488-
basePath: 'domainservices/resource-manager',
489-
namespace: 'Microsoft.AAD',
490-
},
491492
{
492493
basePath: 'eventhub/resource-manager',
493494
namespace: 'Microsoft.EventHub',

generator/constants.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,12 @@ export const generatedSchemasTemplatePath = path.join(__dirname, 'resources/auto
3434
export const autorestCoreVersion = '3.0.6374';
3535
export const azureresourceschemaVersion = '3.0.92';
3636

37-
// paths in this list won't even appear in list-basepaths
38-
export const blocklist = [
37+
// paths in this list won't even appear in list-basepaths.
38+
// This list should only contain spec paths that should DEFINITELY be excluded from generation.
39+
// For now - that should just be Azure Stack providers, and deprecated providers.
40+
export const excludedBasePathPrefixes = [
3941
/* Azure Stack resource providers */
40-
'azsadmin/resource-manager/azurebridge',
41-
'azsadmin/resource-manager/backup',
42-
'azsadmin/resource-manager/commerce',
43-
'azsadmin/resource-manager/compute',
44-
'azsadmin/resource-manager/containerregistry',
45-
'azsadmin/resource-manager/deployment',
46-
'azsadmin/resource-manager/fabric',
47-
'azsadmin/resource-manager/gallery',
48-
'azsadmin/resource-manager/infrastructureinsights',
49-
'azsadmin/resource-manager/keyvault',
50-
'azsadmin/resource-manager/network',
51-
'azsadmin/resource-manager/storage',
52-
'azsadmin/resource-manager/subscriptions',
53-
'azsadmin/resource-manager/update',
54-
'azsadmin/resource-manager/user-subscriptions',
42+
'azsadmin/',
5543
/* Microsoft.CustomerInsights is deprecated */
56-
'customer-insights/resource-manager',
44+
'customer-insights/',
5745
];

generator/specs.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export async function generateBasePaths(localPath: string) {
5454
return filePaths
5555
.map(p => p.substring(0, p.lastIndexOf(path.sep)))
5656
.map(getBasePathString.bind(null, localPath))
57-
.filter(p => !isBlocklisted(p));
57+
.filter(p => !isExcludedBasePath(p));
5858
}
5959

6060
export function getBasePathString(localPath: string, basePath: string) {
@@ -70,8 +70,10 @@ export function getPackageString(readme: string) {
7070
.find((_, index, obj) => index > 0 && obj[index - 1] === 'specification');
7171
}
7272

73-
function isBlocklisted(basePath: string) {
74-
return constants.blocklist.includes(basePath);
73+
function isExcludedBasePath(basePath: string) {
74+
return constants.excludedBasePathPrefixes
75+
.map(prefix => prefix.toLowerCase())
76+
.some(prefix => basePath.toLowerCase().startsWith(prefix));
7577
}
7678

7779
export async function prepareReadme(readme: string, autoGenConfig?: AutoGenConfig) {

0 commit comments

Comments
 (0)