Skip to content

Commit

Permalink
Merge pull request #30 from superfaceai/hotfix/allow-enum-in-list
Browse files Browse the repository at this point in the history
hotfix: Allow enum inside list in Profile IO Analyzer
  • Loading branch information
martinalbert authored Jan 27, 2021
2 parents 20ed549 + e68e3ab commit 0973619
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## [Unreleased]

### Fixed
* Allow enum inside list in Profile IO Analyzer

## [0.0.11] - 2021-01-19

### Added
* Public `parseDocumentId` for partial parsing

Expand Down Expand Up @@ -112,6 +117,7 @@
* Usecase result parsing as optional

[Unreleased]: https://github.com/superfaceai/parser/compare/v0.0.11...HEAD
[0.0.12]: https://github.com/superfaceai/parser/compare/v0.0.11...v0.0.12
[0.0.11]: https://github.com/superfaceai/parser/compare/v0.0.10...v0.0.11
[0.0.10]: https://github.com/superfaceai/parser/compare/v0.0.9...v0.0.10
[0.0.9]: https://github.com/superfaceai/parser/compare/v0.0.8...v0.0.9
Expand Down
4 changes: 0 additions & 4 deletions src/interpreter/constructs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ export interface VisitConstruct<T extends ts.Node = ts.Node> {
inputStructure?: ObjectStructure,
isOutcomeWithCondition?: boolean
): ConstructResult;
visitInput?(
node: ts.PropertyAccessExpression,
structure: ObjectStructure
): StructureType | undefined;
}

const VALID_CONSTRUCT_RESULT: ConstructResult = {
Expand Down
6 changes: 1 addition & 5 deletions src/interpreter/profile-io-analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
UnionStructure,
UseCaseStructure,
} from './profile-output';
import { isEnumStructure, isUnionStructure } from './profile-output.utils';
import { isUnionStructure } from './profile-output.utils';

const debug = createDebug('superface-parser:profile-io-analyzer');

Expand Down Expand Up @@ -172,10 +172,6 @@ export class ProfileIOAnalyzer implements ProfileVisitor {
visitListDefinitionNode(node: ListDefinitionNode): StructureType {
const value = this.visit(node.elementType);

if (isEnumStructure(value)) {
throw new Error('Something went very wrong, this should not happen!');
}

return {
kind: 'ListStructure',
value,
Expand Down
2 changes: 1 addition & 1 deletion src/interpreter/profile-output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface NonNullStructure extends Structure {
*/
export interface ListStructure extends Structure {
kind: 'ListStructure';
value: Exclude<StructureType, EnumStructure>;
value: StructureType;
}

/**
Expand Down

0 comments on commit 0973619

Please sign in to comment.