Hello Everyone,
In my last article related to smartdocs, We have discussed about multiple issues related to SmartDocs & how it fails to address basic things.
In this article, we are going to see solutions to some of the issues & how they are addressed. I will be updating this article moving forward to fix critical things related to SmartDocs. Feel free to share your feedback using comments.
Fix SmartDocs issue using below custom extension module,
Issue 1 : Original Spec Lost
Solution:
Issue 2 : Limited data available in handlebar variables in the template
Solution:
Issue 3 : Request Body Sample is incomplete - Fails to render properly if spec contain parameters which are objects / arrays inside object
Solution :
Issue 4 : Default values missing in sample request body sample
Solution :
More fixes are coming soon. Stay tuned & Leave your feedback !
Hope it's helpful. Feel free to provide feedback of the above module using comments below.
-------------------------------
Anil Sagar
Learn Apigee Concepts in 4 Minutes - HandsOn
@mark.ferguson FYI.. You might be interested in above solution.
Thanks for doing this. I have a question... where are smartdocs.hbr copies stored? For example, when you create a new model it copies your method template. Where is that template copy stored?
@Jack Petraitis , You can upload default smartdocs copy in Configuration > SmartDocs in Developer Portal. Navigate using black color admin menu on top of screen. Hope it helps.
@Anil Sagar I saw that module contains model.js file and you customized it to add new features. What will it happen when we upgrade to a new release? Will these new features be included in the new release? Or will you publish new compatible version of the module? Thanks for your help.
@donghyunlee , Welcome to Apigee Community.
I am trying my best to have these features in the new release. If not, Will publish new compatible version of the module.
Hope it helps.
Hi, has anyone tried using this in conjunction with the smartdocs service module. I tried and have had issues. https://github.com/anil614sagar/smartdocs_extend/issues/3
@Anil Sagar, would you recommend downloading your version of the module or the fork by achieve-internet which is 7 commits ahead of you? Any reason why you have not merged those commits?
@Anil Sagar When I click "Download Original Spec" it downloads a blank file titled "1". I thought the problem might be that one has to import the spec after smartdocs_extend has been installed. So I deleted the model and then imported it again after the module was installed. But the file is still blank when clicking "Download Original Spec." Thanks for all your work on this.
@Shai Gluskin , I have merged the commits.
@Anil SagarThanks so much. After I updated the smartdocs_extend module with the latest version with the commits that you merged I was able to see that a json version of the spec is now stored in the database and I could download it using the "Download Original Spec" button. Of course, any spec that I want to be available in this way, I need to delete and re-import it
@Anil Sagar @ GoogleI'm getting
"TypeError: obj is undefined"
referencing two parts of the template's js:
if (obj.hasOwnProperty('properties')) { for (k in obj['properties']) { obj['properties'][k].name = k; reqResParams.push(obj['properties'][k]); if (obj['properties'][k].hasOwnProperty('properties')){ extractParametersInfo( obj['properties'][k], reqResParams); }
extractParametersInfo(requestParamsSchema, reqResParams);
In the page source I can see the definitions data I want to display on the page in the source code. It follows
Apigee.APIModel.expandedSchema={"profit_centers":{
<br>
I need help getting that data to print from the template. I used the handlebars {{api_raw_spec}}
but didn't succeed.
Hi @Anil Sagar
I'm new in Apigee,
I am trying to show sample request payload if request contains object within an object with out $ref reference, so I was looking at the solution suggested by you, I saw smartdocs_extend module contains model.js but not able to get the sample on request payload. Kindly suggest me.
Have these fixes been merged into the latest version of Smartdocs? We are running Smartdocs Version 7.x-5.9 and the Smartdocs Extension.
We are still not seeing the Request Body sample. (Issue 3) However, the schema displays in the edit view of the method. If a $ref is used, the $ref displays in the edit view but not the expanded schema.