Skip to content

Commit 445af4e

Browse files
committed
Acl subject type fix
1 parent fbb2ba6 commit 445af4e

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@povio/openapi-codegen-cli",
3-
"version": "0.13.9",
3+
"version": "0.13.10",
44
"main": "./dist/index.js",
55
"bin": {
66
"openapi-codegen": "./dist/sh.js"

src/generators/const/acl.const.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ export const CASL_ABILITY_BINDING = {
1111
abilityTuple: "AbilityTuple",
1212
pureAbility: "PureAbility",
1313
forcedSubject: "ForcedSubject",
14-
subject: "Subject",
14+
subjectType: "Subject",
15+
subject: "subject",
1516
};
1617
export const CASL_ABILITY_IMPORT: Import = {
1718
bindings: [
1819
CASL_ABILITY_BINDING.abilityTuple,
1920
CASL_ABILITY_BINDING.pureAbility,
2021
CASL_ABILITY_BINDING.forcedSubject,
22+
CASL_ABILITY_BINDING.subjectType,
2123
CASL_ABILITY_BINDING.subject,
2224
],
2325
from: "@casl/ability",

src/generators/generate/generateAcl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function generateAppAcl(resolver: SchemaResolver, tags: string[]) {
5353
const caslAbilityTupleImport: Import = {
5454
bindings: [
5555
CASL_ABILITY_BINDING.pureAbility,
56-
...(tags.length === 0 ? [CASL_ABILITY_BINDING.subject, CASL_ABILITY_BINDING.abilityTuple] : []),
56+
...(tags.length === 0 ? [CASL_ABILITY_BINDING.subjectType, CASL_ABILITY_BINDING.abilityTuple] : []),
5757
],
5858
from: CASL_ABILITY_IMPORT.from,
5959
};
@@ -79,6 +79,6 @@ export function generateAppAcl(resolver: SchemaResolver, tags: string[]) {
7979
tags,
8080
namespaces,
8181
abilityTuple: CASL_ABILITY_BINDING.abilityTuple,
82-
subject: CASL_ABILITY_BINDING.subject,
82+
subjectType: CASL_ABILITY_BINDING.subjectType,
8383
});
8484
}

src/generators/templates/app-acl.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type {{appAbilities}} =
1111
{{#if includeNamespace}}{{#each namespaces as | namespace |}} | {{namespace}}.{{../allAbilities}}{{/each}}
1212
{{else}}{{#each tags as | tag |}} | {{tagAllAbilitiesName tag}}{{/each}}{{/if}}
1313
{{else}}
14-
{{abilityTuple}}<string, {{subject}}>;
14+
{{abilityTuple}}<string, {{subjectType}}>;
1515
{{/if}}
1616

1717
export type AppAbility = PureAbility<{{appAbilities}}>;

0 commit comments

Comments
 (0)