Skip to content

Commit

Permalink
Remove deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed Jun 26, 2024
1 parent f1da80d commit 5a8b608
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 692 deletions.
13 changes: 1 addition & 12 deletions compiler/src/model/metamodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,9 @@ export class Property {
description?: string
docUrl?: string
docId?: string
since?: string
serverDefault?: boolean | string | number | string[] | number[]
deprecation?: Deprecation
availability?: Availabilities
stability?: Stability
/**
* If specified takes precedence over `name` when generating code. `name` is always the value
* to be sent over the wire
Expand Down Expand Up @@ -226,7 +224,7 @@ export class Interface extends BaseType {
*/
generics?: TypeName[]
inherits?: Inherits
implements?: Inherits[]
implements?: Inherits[] // Unused!

/**
* Behaviors directly implemented by this interface
Expand Down Expand Up @@ -333,7 +331,6 @@ export class EnumMember {
codegenName?: string
description?: string
deprecation?: Deprecation
since?: string
availability?: Availabilities
}

Expand Down Expand Up @@ -415,14 +412,6 @@ export class Endpoint {

urls: UrlTemplate[]

/**
* The version when this endpoint reached its current stability level.
* Missing data means "forever", i.e. before any of the target client versions produced from this spec.
*/
since?: string
stability?: Stability
visibility?: Visibility
featureFlag?: string
requestMediaType?: string[]
responseMediaType?: string[]
privileges?: {
Expand Down
33 changes: 0 additions & 33 deletions compiler/src/model/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -669,22 +669,6 @@ export function hoistRequestAnnotations (
// Apply the availabilities to the Endpoint.
for (const [availabilityName, availabilityValue] of Object.entries(availabilities)) {
endpoint.availability[availabilityName] = availabilityValue

// Backfilling deprecated fields on an endpoint.
if (availabilityName === 'stack') {
if (availabilityValue.since !== undefined) {
endpoint.since = availabilityValue.since
}
if (availabilityValue.stability !== undefined) {
endpoint.stability = availabilityValue.stability
}
if (availabilityValue.visibility !== undefined) {
endpoint.visibility = availabilityValue.visibility
}
if (availabilityValue.featureFlag !== undefined) {
endpoint.featureFlag = availabilityValue.featureFlag
}
}
}
} else {
assert(jsDocs, false, `Unhandled tag: '${tag}' with value: '${value}' on request ${request.name.name}`)
Expand Down Expand Up @@ -787,16 +771,6 @@ function hoistPropertyAnnotations (property: model.Property, jsDocs: JSDoc[]): v
property.availability = {}
for (const [availabilityName, availabilityValue] of Object.entries(availabilities)) {
property.availability[availabilityName] = availabilityValue

// Backfilling deprecated fields on a property.
if (availabilityName === 'stack') {
if (availabilityValue.since !== undefined) {
property.since = availabilityValue.since
}
if (availabilityValue.stability !== undefined) {
property.stability = availabilityValue.stability
}
}
}
} else if (tag === 'doc_id') {
assert(jsDocs, value.trim() !== '', `Property ${property.name}'s @doc_id is cannot be empty`)
Expand Down Expand Up @@ -898,13 +872,6 @@ function hoistEnumMemberAnnotations (member: model.EnumMember, jsDocs: JSDoc[]):
member.availability = {}
for (const [availabilityName, availabilityValue] of Object.entries(availabilities)) {
member.availability[availabilityName] = availabilityValue

// Backfilling deprecated fields on a property.
if (availabilityName === 'stack') {
if (availabilityValue.since !== undefined) {
member.since = availabilityValue.since
}
}
}
} else {
assert(jsDocs, false, `Unhandled tag: '${tag}' with value: '${value}' on enum member ${member.name}`)
Expand Down
5 changes: 0 additions & 5 deletions compiler/test/request-availability/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,4 @@ test('Request @availability can fulfill all the fields', t => {
stack: { stability: 'beta', visibility: 'feature_flag', featureFlag: 'abc', since: '1.2.3' },
serverless: { visibility: 'private', stability: 'experimental' }
});
// Assert backfilled values are correct
t.true(endpoint?.visibility === 'feature_flag');
t.true(endpoint?.stability === 'beta');
t.true(endpoint?.featureFlag === 'abc');
t.true(endpoint?.since === '1.2.3');
})
Loading

0 comments on commit 5a8b608

Please sign in to comment.