def _generate_ftd_api_docs(args, api_spec, template_ctx, errors_codes): generator.ResourceDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx, api_spec) \ .generate_doc_files(args.dist, args.models) generator.ModelDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx, api_spec) \ .generate_doc_files(args.dist, args.models) generator.ApiIntroductionDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx) \ .generate_doc_files(args.dist) if errors_codes: generator.ErrorDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx) \ .generate_doc_files(args.dist, errors_codes)
def _generate_ftd_api_docs(args, api_spec, template_ctx, errors_codes): if template_ctx['ftd_version'] == '7.0.0': # SSLGroupType has incorrect representation in 7.0.0 API spec, as it doesn't contain possible enum values. # We need to add these enum values here to generate docs and represent possible values. api_spec['models']['SSLGroupType']['enum'] = [ "GROUP_14", "GROUP_15", "GROUP_19", "GROUP_20", "GROUP_21" ] generator.ResourceDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx, api_spec) \ .generate_doc_files(args.dist, args.models) generator.ModelDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx, api_spec) \ .generate_doc_files(args.dist, args.models) generator.ApiIntroductionDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx) \ .generate_doc_files(args.dist) if errors_codes: generator.ErrorDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx) \ .generate_doc_files(args.dist, errors_codes) generator.StaticDocGenerator(DEFAULT_TEMPLATE_DIR, template_ctx, FTD_API_STATIC_TEMPLATE_DIR) \ .generate_doc_files(args.dist)
import argparse import json from docs import generator from docs import build parser = argparse.ArgumentParser(description='Generates error page') parser.add_argument('--src', type=str, help='Path to json file with error code definition', required=True) parser.add_argument( '--dist', type=str, help='An output directory for generated page with error codes', required=True) args = parser.parse_args() with open(args.src, 'r') as src_file: error_codes = json.load(src_file) generator.ErrorDocGenerator(build.DEFAULT_TEMPLATE_DIR, {}).generate_doc_files(args.dist, error_codes)