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

Unable to POST on endpoint with recursive model #3706

Closed
mmussche2 opened this issue Sep 11, 2019 · 8 comments · Fixed by #3897
Assignees
Labels
bug

Comments

@mmussche2
Copy link

@mmussche2 mmussche2 commented Sep 11, 2019

Related to #3674
I have updated my openapi-v3 dependency, now my API starts correctly, but I can't send a post on the associated endpoint, I get an internal server error :

{
    "error": {
        "statusCode": 500,
        "name": "RangeError",
        "message": "Maximum call stack size exceeded",
        "stack": "RangeError: Maximum call stack size exceeded\n    at Object.entries.forEach (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:95:43)\n    at Array.forEach (<anonymous>)\n    at ReportDefinitionRepository.definePersistedModel (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:91:47)\n    at ReportDefinitionRepository.resolvePropertyType (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:120:20)\n    at Object.entries.forEach (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:96:51)\n    at Array.forEach (<anonymous>)\n    at ReportDefinitionRepository.definePersistedModel (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:91:47)\n    at ReportDefinitionRepository.resolvePropertyType (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:120:20)\n    at Object.entries.forEach (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:96:51)\n    at Array.forEach (<anonymous>)\n    at ReportDefinitionRepository.definePersistedModel (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:91:47)\n    at ReportDefinitionRepository.resolvePropertyType (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:120:20)\n    at Object.entries.forEach (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:96:51)\n    at Array.forEach (<anonymous>)\n    at ReportDefinitionRepository.definePersistedModel (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:91:47)\n    at ReportDefinitionRepository.resolvePropertyType (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:120:20)"
    }
}

when replacing

@property.array(ReportState, {})
 states: ReportState[];

by

 @property.array(Object, {})
  states: ReportState[];

it works, but then the recursive model is not specified

@mmussche2 mmussche2 added the bug label Sep 11, 2019
@dhmlau

This comment has been minimized.

Copy link
Contributor

@dhmlau dhmlau commented Sep 12, 2019

@raymondfeng , does your PR #3722 take care of this too? Thanks.

@dhmlau dhmlau self-assigned this Sep 12, 2019
@raymondfeng

This comment has been minimized.

Copy link
Member

@raymondfeng raymondfeng commented Sep 12, 2019

@dhmlau #3722 should fix the issue

@mmussche2

This comment has been minimized.

Copy link
Author

@mmussche2 mmussche2 commented Sep 26, 2019

@raymondfeng I've update @loopback/repository to version 1.14.0 and loopback/repository-json-schema to version 1.10.0, and I still have the issue.
loopback/openapi-v3 is in version 1.9.6, do I need to update another package ?

@bajtos

This comment has been minimized.

Copy link
Member

@bajtos bajtos commented Sep 27, 2019

@raymondfeng can you PTAL?

@bajtos bajtos assigned raymondfeng and unassigned dhmlau Sep 27, 2019
@mmussche2

This comment has been minimized.

Copy link
Author

@mmussche2 mmussche2 commented Oct 8, 2019

@raymondfeng @bajtos
Still no progress on this issue ? Is there anything I can provide to help with this ?

@raymondfeng

This comment has been minimized.

Copy link
Member

@raymondfeng raymondfeng commented Oct 8, 2019

@mmussche2 Can you verify #3897?

@mmussche2

This comment has been minimized.

Copy link
Author

@mmussche2 mmussche2 commented Oct 10, 2019

@raymondfeng
After importing packages openapi-v3 and repository-json-schema from your branch, I still have an error :

RangeError: Maximum call stack size exceeded\n    at Object.entries.forEach (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:95:43)\n   
 at Array.forEach (<anonymous>)\n    at ReportDefinitionRepository.definePersistedModel (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:91:47)\n    
at ReportDefinitionRepository.resolvePropertyType (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:120:20)\n    
at Object.entries.forEach (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:96:51)\n    
at Array.forEach (<anonymous>)\n    at ReportDefinitionRepository.definePersistedModel (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:91:47)\n   
 at ReportDefinitionRepository.resolvePropertyType (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:120:20)\n    
at Object.entries.forEach (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:96:51)\n    
at Array.forEach (<anonymous>)\n    at ReportDefinitionRepository.definePersistedModel (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:91:47)\n    
at ReportDefinitionRepository.resolvePropertyType (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:120:20)\n    
at Object.entries.forEach (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:96:51)\n    
at Array.forEach (<anonymous>)\n    at ReportDefinitionRepository.definePersistedModel (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:91:47)\n    
at ReportDefinitionRepository.resolvePropertyType (C:\\Users\\mmussche\\Documents\\workspace\\Boccard\\ta-api-core-2\\node_modules\\@loopback\\repository\\dist\\repositories\\legacy-juggler-bridge.js:120:20)"
@raymondfeng

This comment has been minimized.

Copy link
Member

@raymondfeng raymondfeng commented Oct 10, 2019

You probably need to import repository module too.

raymondfeng added a commit that referenced this issue Oct 11, 2019
raymondfeng added a commit that referenced this issue Oct 15, 2019
raymondfeng added a commit that referenced this issue Oct 15, 2019
raymondfeng added a commit that referenced this issue Oct 17, 2019
raymondfeng added a commit that referenced this issue Oct 21, 2019
raymondfeng added a commit that referenced this issue Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.