2
0

RendererProtocol.swift 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2023, gRPC Authors All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. //===----------------------------------------------------------------------===//
  17. //
  18. // This source file is part of the SwiftOpenAPIGenerator open source project
  19. //
  20. // Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
  21. // Licensed under Apache License v2.0
  22. //
  23. // See LICENSE.txt for license information
  24. // See CONTRIBUTORS.txt for the list of SwiftOpenAPIGenerator project authors
  25. //
  26. // SPDX-License-Identifier: Apache-2.0
  27. //
  28. //===----------------------------------------------------------------------===//
  29. /// An object that renders structured Swift representations
  30. /// into Swift files.
  31. ///
  32. /// Rendering is the last phase of the generator pipeline.
  33. protocol RendererProtocol {
  34. /// Renders the specified structured code into a raw Swift file.
  35. /// - Parameters:
  36. /// - code: A structured representation of the Swift code.
  37. /// - config: The configuration of the generator.
  38. /// - diagnostics: The collector to which to emit diagnostics.
  39. /// - Returns: A raw file with Swift contents.
  40. /// - Throws: An error if an issue occurs during rendering.
  41. func render(structured code: StructuredSwiftRepresentation) throws -> SourceFile
  42. }