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
Closed

Unable to POST on endpoint with recursive model #3706

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

Comments

@mmussche2
Copy link

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
Copy link
Member

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
Copy link
Contributor

@dhmlau #3722 should fix the issue

@mmussche2
Copy link
Author

@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
Copy link
Member

bajtos commented Sep 27, 2019

@raymondfeng can you PTAL?

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

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

@raymondfeng
Copy link
Contributor

@mmussche2 Can you verify #3897?

@mmussche2
Copy link
Author

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
Copy link
Contributor

You probably need to import repository module too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants