-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use Kelp::Base -strict; | ||
use Test::More; | ||
use Test::Deep; | ||
use YAML::PP; | ||
use Path::Tiny; | ||
|
||
my $yaml = YAML::PP->new; | ||
|
||
my $content = do { | ||
local $/; | ||
my $data = <DATA>; | ||
$yaml->load_string($data); | ||
}; | ||
|
||
my $config_data = path(__FILE__)->parent->child('conf')->child('whelk_openapi.pl')->slurp_utf8; | ||
my $config = eval $config_data; | ||
|
||
|
||
my $encoded = $yaml->dump_string({info => {description => $config->{api_openapi}{info}{description}}}); | ||
my $content2 = $yaml->load_string($encoded); | ||
|
||
$encoded =~ s/\r/CR/g; | ||
$encoded =~ s/\n/LF/g; | ||
diag $encoded; | ||
|
||
is_deeply $content, $content2, 'no bug ok'; | ||
|
||
done_testing; | ||
|
||
__DATA__ | ||
info: | ||
description: |- | ||
An API (Application Programming Interface) is a set of protocols, tools, and definitions that allows different software applications to communicate with each other. APIs define the methods and data formats that applications can use to request and exchange information, enabling seamless integration between diverse systems. By providing a standardized way for applications to interact, APIs simplify the development process, allowing developers to leverage existing functionalities without having to build them from scratch. This can significantly enhance the efficiency and scalability of software projects. | ||
APIs can be designed for various purposes, including web services, operating systems, libraries, and databases. Web APIs, for example, enable web applications to communicate with servers over the internet, often using HTTP/HTTPS protocols. They typically follow REST (Representational State Transfer) or SOAP (Simple Object Access Protocol) architectures, each with its own conventions and best practices. RESTful APIs use standard HTTP methods like GET, POST, PUT, and DELETE, and usually return data in JSON or XML formats. By providing a clear and consistent interface, APIs empower developers to create robust, flexible, and interoperable applications that can easily integrate with other services and platforms. | ||