The OpenAPI Specification (formerly known as the Swagger RESTful API
Documentation Specification) defines a format for describing RESTful
APIs. The Swagger project provides a set of tools for working with this
format, including a hosted validator which provides a validation badge
and JSON result.[1] This commit adds shields.io support for this badge.
The service currently only provides validation of files conforming to
version 2.0 of the OpenAPI Specification. This commit adds a path
component for specifying the version under the assumption that the
validator may support version 3.0 or later as they are released.
It accepts the URL to validate as two path components, a scheme followed
by the rest of the URL, to match the convention used for the JIRA host
and webpage online shields.
Changes in v2:
- Use bitbucket in try.html example for clarity.
- Change /v/ in URL to /valid/ to avoid conflict with v=version.
1. https://github.com/swagger-api/validator-badge
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
The following warning is emitted by Node.js:
> DeprecationWarning: Using Buffer without `new` will soon stop working. Use `new
> Buffer()`, or preferably `Buffer.from()`, `Buffer.allocUnsafe()` or
> `Buffer.alloc()` instead.
This patch removes this warning.
Projects that have '0' technical debt would otherwise receive a
lightgrey badge instead of a brightgreen one.
Signed-off-by: Sebastian Hoß <mail@shoss.de>
The old LRU implementation stored a list's indices to reference items in that
list, but deletions from the list made indices point to the wrong slot.
Functionally, it meant that deleted slots were not guaranteed to be the oldest
slot.
Using a linked list fixes that.
Prior to this patch, time spend in badge.js (computing text width and
compressing the SVG with SVGO) averaged 8.4 ms.
After this patch, it clocks at 2.4 ms on average.
Assuming this is the CPU bottleneck, it means that servers used to only be able
to handle 119 req/s (empirically, it is closer to 100 req/s). It should now
handle 416 req/s (although a better guess is at 1/0.004 = 250 req/s).
- Use metric() for the displayed number
- Use encodeURI() for API parameters
- Explicitly use a condition expression instead of a number where a boolean is expected
Part of #790.
As raised by Adriaan (@agboom), the .github-user-tokens.json file was
incorrectly exposed, causing the risk of users' GitHub tokens to be used
by other entities for the purpose of increasing their rate limits by
pretending to be shields.io.