How to use the prance.util.fs function in prance

To help you get started, we’ve selected a few prance examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jfinkhaeuser / prance / tests / View on Github external
def test_issue_23_partial_resolution_files():
  specs = get_specs('tests/specs/with_externals.yaml')
  res = resolver.RefResolver(specs,
      resolve_types = resolver.RESOLVE_FILES

  # By default, all externals need to be resolved.
  from prance.util.path import path_get

  val = path_get(res.specs, ('paths', '/pets', 'get', 'responses', '200', 'schema'))
  assert '$ref' not in val

  val = path_get(res.specs, ('paths', '/pets', 'get', 'responses', 'default', 'schema'))
  assert '$ref' not in val

  val = path_get(res.specs, ('paths', '/pets', 'post', 'responses', 'default', 'schema'))
  assert '$ref' not in val
github jfinkhaeuser / prance / prance / View on Github external
def __write_to_file(filename, specs):  # noqa: N802
  Write specs to the given filename.

  This takes into account file name extensions as per `fs.write_file`.
  from prance.util import fs, formats
  contents = formats.serialize_spec(specs, filename)
  fs.write_file(filename, contents)
github python-microservices / pyms / pyms / flask / services / View on Github external
def merge_swagger_file(main_file: str):
    Generate swagger into a single file
    :param main_file: Swagger file path
    input_file = Path(main_file)
    output_file = Path(input_file.parent, 'swagger-complete.yaml')

    contents = formats.serialize_spec(