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

Add json schema for built-in feature filters #903

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
106 changes: 106 additions & 0 deletions docs/FeatureManagement/TargetingFilter.v1.0.0.schema.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we name the file name Microsoft.Targeting.*?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with naming the file with "Microsoft.xxx". We don't have Microsoft prefix for feature flag and feature management schema. Should we change them all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have Microsoft prefixed to feature flag or feature management anywhere. It's just branding. For filters, Microsoft.Targeting is the actual complete name users put in their feature flags and we expect from the code.

If we do change the name, it will be unclear this is about filters, so we probably can put them in a subfolder, eg., FeatureManagement/FeatureFilters.

Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://azconfig.io/schemas/FeatureManagement/v1.0.0/TargetingFilter.json",
"type": "object",
"title": "A Microsoft Targeting Filter Declaration",
"required": [
"name"
],
"properties": {
"name": {
"$id": "#/properties/name",
"type": "string",
"title": "Targeting Filter Name",
"enum": [
"Microsoft.Targeting"
]
},
"parameters": {
"$id": "#/properties/parameters",
"type": "object",
"title": "Targeting Filter Parameters",
"properties": {
"Audience": {
"$id": "#/properties/parameters/properties/Audience",
"type": "object",
"title": "Targeting Filter Audience Parameter",
"properties": {
"DefaultRolloutPercentage": {
"$id": "#/properties/parameters/properties/Audience/properties/DefaultRolloutPercentage",
"type": "number",
"title": "Targeting Filter Default Rollout Percentage Parameter",
"minimum": 0,
"maximum": 100
},
"Users": {
"$id": "#/properties/parameters/properties/Audience/properties/Users",
"type": "array",
"title": "Targeting Filter Users Parameter",
"items": {
"type": "string"
}
},
"Groups": {
"$id": "#/properties/parameters/properties/Audience/properties/Groups",
"type": "array",
"title": "Targeting Filter Groups Parameter",
"items": {
"$id": "#/properties/parameters/properties/Audience/properties/Groups/items/Group",
"type": "object",
"title": "Targeting Filter Group Parameter",
"properties": {
"Name": {
"$id": "#/properties/parameters/properties/Audience/properties/Groups/items/Group/Name",
"type": "string",
"title": "Targeting Filter Group Name Parameter"
},
"RolloutPercentage": {
"$id": "#/properties/parameters/properties/Audience/properties/Groups/items/Group/RolloutPercentage",
"type": "number",
"title": "Targeting Filter Group RolloutPercentage Parameter",
"minimum": 0,
"maximum": 100
}
},
"required": [
"Name",
"RolloutPercentage"
]
}
},
"Exclusion": {
"$id": "#/properties/parameters/properties/Audience/properties/Exclusion",
"type": "object",
"title": "Targeting Filter Exclusion Parameter",
"properties": {
"Users": {
"$id": "#/properties/parameters/properties/Audience/properties/Exclusion/Users",
"type": "array",
"title": "Targeting Filter Exclusion Users Parameter",
"items": {
"type": "string"
}
},
"Groups": {
"$id": "#/properties/parameters/properties/Audience/properties/Exclusion/Groups",
"type": "array",
"title": "Targeting Filter Exclusion Groups Parameter",
"items": {
"type": "string"
}
}
}
}
},
"required": [
"DefaultRolloutPercentage"
]
}
},
"required": [
"Audience"
]
}
}
}
53 changes: 53 additions & 0 deletions docs/FeatureManagement/TimeWindowFilter.v1.0.0.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://azconfig.io/schemas/FeatureManagement/v1.0.0/TimeWindowFilter.json",
"type": "object",
"title": "A Microsoft Time Window Filter Declaration",
"required": [
"name"
],
"properties": {
"name": {
"$id": "#/properties/name",
"type": "string",
"title": "Time Window Filter Name",
"enum": ["Microsoft.TimeWindow"]
},
"parameters": {
"$id": "#/properties/parameters",
"type": "object",
"title": "Time Window Filter Parameters",
"properties": {
"Start": {
"$id": "#/properties/parameters/properties/Start",
"type": "string",
"title": "Time Window Filter Start Parameter",
"examples": [
"Wed, 1 May 2024 12:00:00 GMT",
"Wed, 1 May 2024 20:00:00 +0800"
]
},
"End": {
"$id": "#/properties/parameters/properties/End",
"type": "string",
"title": "Time Window Filter End Parameter",
"examples": [
"Thu, 2 May 2024 12:00:00 GMT",
"Thu, 2 May 2024 20:00:00 +0800"
]
}
},
"anyOf": [
{ "required": [
"Start"
]
},
{ "required": [
"End"
]
}
]
}
}
}
160 changes: 160 additions & 0 deletions docs/FeatureManagement/TimeWindowFilter.v2.0.0.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://azconfig.io/schemas/FeatureManagement/v2.0.0/TimeWindowFilter.json",
"type": "object",
"title": "A Microsoft Time Window Filter Declaration",
"required": [
"name"
],
"properties": {
"name": {
"$id": "#/properties/name",
"type": "string",
"title": "Time Window Filter Name",
"enum": [
"Microsoft.TimeWindow"
]
},
"parameters": {
"$id": "#/properties/parameters",
"type": "object",
"title": "Time Window Filter Parameters",
"properties": {
"Start": {
"$id": "#/properties/parameter/properties/Start",
"type": "string",
"title": "Time Window Filter Start Parameter",
"examples": [
"Wed, 1 May 2024 12:00:00 GMT",
"Wed, 1 May 2024 20:00:00 +0800"
]
},
"End": {
"$id": "#/properties/parameters/properties/End",
"type": "string",
"title": "Time Window Filter End Parameter",
"examples": [
"Thu, 2 May 2024 12:00:00 GMT",
"Thu, 2 May 2024 20:00:00 +0800"
]
},
"Recurrence": {
"$id": "#/properties/parameters/properties/Recurrence",
"type": "object",
"title": "Time Window Filter Recurrence Parameter",
"properties": {
"Pattern": {
"$id": "#/properties/parameters/properties/Recurrence/properties/Pattern",
"type": "object",
"title": "Time Window Filter Recurrence Pattern Parameter",
"required": [
"Type"
],
"properties": {
"Type": {
"$id": "#/properties/parameters/properties/Recurrence/properties/Pattern/properties/Type",
"type": "string",
"title": "Time Window Filter Recurrence Pattern Type Parameter",
"enum": [
"Daily",
"Weekly"
]
},
"Interval": {
"$id": "#/properties/parameters/properties/Recurrence/properties/Pattern/properties/Interval",
"type": "number",
"title": "Time Window Filter Recurrence Pattern Interval Parameter",
"default": 1
},
"DaysOfWeek": {
"$id": "#/properties/parameters/properties/Recurrence/properties/Pattern/properties/DaysOfWeek",
"type": "array",
"title": "Time Window Filter Recurrence Weekly Pattern DaysOfWeek Parameter",
"items": {
"$id": "#/properties/parameters/properties/Recurrence/properties/Pattern/properties/DaysOfWeek/items",
"type": "string",
"title": "DayOfWeek",
"enum": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
]
}
},
"FirstDayOfWeek": {
zhiyuanliang-ms marked this conversation as resolved.
Show resolved Hide resolved
"$id": "#/properties/parameters/properties/Recurrence/properties/Pattern/properties/FirstDayOfWeek",
"type": "string",
"title": "Time Window Filter Recurrence Weekly Pattern FirstDayOfWeek Parameter",
"enum": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
]
}
}
},
"Range": {
"required": [
"Type"
],
"properties": {
"Type": {
"$id": "#/properties/parameters/properties/Recurrence/properties/Range/properties/Type",
"type": "string",
"title": "Time Window Filter Recurrence Range Type Parameter",
"enum": [
"NoEnd",
"EndDate",
"Numbered"
]
},
"EndDate": {
"$id": "#/properties/parameters/properties/Recurrence/properties/Range/properties/EndDate",
"type": "string",
"title": "Time Window Filter Recurrence End Date Parameter",
"examples": [
"Wed, 1 May 2024 12:00:00 GMT",
"Wed, 1 May 2024 20:00:00 +0800"
]
},
"NumberOfOccurrences": {
"$id": "#/properties/parameters/properties/Recurrence/properties/Range/properties/NumberOfOccurrences",
"type": "number",
"title": "Time Window Filter Recurrence Number Of Occurrences Parameter"
}
}
}
}
}
},
"anyOf": [
{
"required": [
"Start"
]
},
{
"required": [
"End"
]
},
{
"required": [
"Start",
"End",
"Recurrence"
]
}
]
}
}
}