question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doc API standard

See original GitHub issue

背景

为保证文档中 API 描述信息的一致规范,拟按照现有书写规范,及 #25056、#20907 中对 string 和 boolean 的讨论结果,将 API 中各类型和书写方式进行统一。并写入 Wiki 中。

  • Wiki

链接

https://ant.design/components/button-cn/#API

目标

https://github.com/ant-design/ant-design/wiki/API-Naming-rules

举例

参数 说明 类型 默认值
htmlType xxx string button
type xxx horizontal | vertical horizontal
disabled xxx boolean false
minLength xxx number 0
style xxx CSSProperties -
character xxx (props) => ReactNode -
offset xxx [number, number] [0, 0]
value xxx string | number small

约定

  • string 类型时,默认值使用 ``
  • 也可在类型中列举 string 可选值。
  • boolean 类型时,默认值使用 true 或 false。
  • number 类型时,默认值直接使用数字。
  • function 类型时,在类型中使用箭头函数表达式。
  • 默认值使用 - 。
  • 说明末尾无句号。
  • API 顺序按照字母顺序进行排列,特殊情况可放在一起(如:xs sm md)。

Examples

Property Description Type Default
htmlType xxx string button
type xxx horizontal | vertical horizontal
disabled xxx boolean false
minLength xxx number 0
style xxx CSSProperties -
character xxx (props) => ReactNode -
offset xxx [number, number] [0, 0]
value xxx string | number small

Promise

  • When string type, the Default use ``.
  • Can also list string optional values ​​in Type.
  • When boolean type, the Default value is true or false.
  • When number type, the Default value use numbers directly.
  • When function type, use an arrow function expression in Type.
  • No default value use - .
  • Capitalize the first letter in Description apart from someProp.
  • No period at the end of the Description.
  • API order is arranged in alphabetical order, and can be put together under special circumstances (such as: xs sm md).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

4reactions
xrkffggcommented, Jul 2, 2020

Done.

2reactions
xrkffggcommented, Jun 24, 2020

已更新 Wiki,计划 4.4.0 上线后,再逐步统一。

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Write API Documentation: Best Practices and ...
An API specification is like a template of your future docs, the unified language that describes the design of your API, explains how...
Read more >
API Documentation Guide and Best Practices
API docs, or API description documents, are the collection of references, tutorials, and examples that help developers use your API. Your API's documentation...
Read more >
Understanding the Differences Between API ...
We are often asked about the differences between API specifications and API ... In some ways, the OpenAPI 3.0.1 document is also API...
Read more >
API Document Format and Style Manual - MyCommittees
API DOCUMENT FORMAT AND STYLE MANUAL. 3. Standard. A document, established by consensus and approved by a recognized body, that provides, for common....
Read more >
Overview (Java Platform SE 7 )
API Specification. This document is the API specification for the Java™ Platform, Standard Edition. See: Description ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found